Rebased to release grub2-2.12 for fedora-41

Signed-off-by: Leo Sandoval <lsandova@redhat.com>
This commit is contained in:
Leo Sandoval 2024-07-10 12:20:32 -06:00
parent f9093b2645
commit ab7ed2db6e
403 changed files with 5164 additions and 17560 deletions

View file

@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 5984e92d29..9462248128 100644
index 656301eaf22..376ca47efe4 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n

View file

@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925.
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index f8cbb8d7a2..d3e879b8e5 100644
index 32c480daeb2..7516a015be0 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2
@ -31,7 +31,7 @@ index f8cbb8d7a2..d3e879b8e5 100644
GRUB_FS \
GRUB_FONT \
GRUB_PRELOAD_MODULES \
@@ -246,6 +242,7 @@ export GRUB_DEFAULT \
@@ -250,6 +246,7 @@ export GRUB_DEFAULT \
GRUB_BACKGROUND \
GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \
@ -40,7 +40,7 @@ index f8cbb8d7a2..d3e879b8e5 100644
GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 9462248128..80685b15f4 100644
index 376ca47efe4..30f27f15b83 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -10,10 +10,10 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666.
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi
index f8b4b3b21a..69f08d289f 100644
index a225f9a88d2..974bc0ddb07 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1519,13 +1519,10 @@ boot sequence. If you have problems, set this option to @samp{text} and
@@ -1552,13 +1552,10 @@ boot sequence. If you have problems, set this option to @samp{text} and
GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER
@ -31,7 +31,7 @@ index f8b4b3b21a..69f08d289f 100644
@item GRUB_OS_PROBER_SKIP_LIST
List of space-separated FS UUIDs of filesystems to be ignored from os-prober
@@ -1853,9 +1850,10 @@ than zero; otherwise 0.
@@ -1889,9 +1886,10 @@ than zero; otherwise 0.
@section Multi-boot manual config
Currently autogenerating config files for multi-boot environments depends on
@ -46,7 +46,7 @@ index f8b4b3b21a..69f08d289f 100644
First create a separate GRUB partition, big enough to hold GRUB. Some of the
following entries show how to load OS installer images from this same partition,
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 80685b15f4..1b91c102f3 100644
index 30f27f15b83..f300e46fc6a 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -13,10 +13,10 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
index 9f74a96b19..dccf3bb300 100644
index 977757f2cc9..10f967f2563 100644
--- a/grub-core/loader/i386/linux.c
+++ b/grub-core/loader/i386/linux.c
@@ -649,13 +649,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -661,13 +661,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
{
grub_file_t file = 0;
struct linux_i386_kernel_header lh;
@ -33,7 +33,7 @@ index 9f74a96b19..dccf3bb300 100644
grub_dl_ref (my_mod);
@@ -669,7 +671,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -681,7 +683,15 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
if (! file)
goto fail;
@ -50,7 +50,7 @@ index 9f74a96b19..dccf3bb300 100644
{
if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
@@ -677,6 +687,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -689,6 +699,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
goto fail;
}
@ -60,7 +60,7 @@ index 9f74a96b19..dccf3bb300 100644
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
{
grub_error (GRUB_ERR_BAD_OS, "invalid magic number");
@@ -784,13 +797,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -796,13 +809,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* We've already read lh so there is no need to read it second time. */
len -= sizeof(lh);
@ -78,7 +78,7 @@ index 9f74a96b19..dccf3bb300 100644
}
linux_params.code32_start = prot_mode_target + lh.code32_start - GRUB_LINUX_BZIMAGE_ADDR;
@@ -853,7 +864,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -865,7 +876,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
/* The other parameters are filled when booting. */
@ -87,7 +87,7 @@ index 9f74a96b19..dccf3bb300 100644
grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
(unsigned) real_size, (unsigned) prot_size);
@@ -1007,9 +1018,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -1019,9 +1030,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
}
len = prot_file_size;
@ -98,7 +98,7 @@ index 9f74a96b19..dccf3bb300 100644
if (grub_errno == GRUB_ERR_NONE)
{
@@ -1020,6 +1029,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
@@ -1032,6 +1041,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fail:

View file

@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
index 8be4c3b3f4..4b1750e360 100644
index 4adeee9ae00..600530a742b 100644
--- a/grub-core/loader/i386/pc/linux.c
+++ b/grub-core/loader/i386/pc/linux.c
@@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

View file

@ -20,10 +20,10 @@ Subject: [PATCH] re-write .gitignore
create mode 100644 util/bash-completion.d/.gitignore
diff --git a/.gitignore b/.gitignore
index f6a1bd0517..208d1d2325 100644
index 4d0dfb700e4..a18787dcfe6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -275,3 +275,153 @@ widthspec.bin
@@ -279,3 +279,153 @@ widthspec.bin
/xfs_test
/xzcompress_test
/zfs_test
@ -179,7 +179,7 @@ index f6a1bd0517..208d1d2325 100644
+/widthspec.h
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000000..e1d849ef95
index 00000000000..e1d849ef95b
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,5 @@
@ -190,7 +190,7 @@ index 0000000000..e1d849ef95
+/version*.texi
diff --git a/grub-core/.gitignore b/grub-core/.gitignore
new file mode 100644
index 0000000000..2acce28115
index 00000000000..2acce281159
--- /dev/null
+++ b/grub-core/.gitignore
@@ -0,0 +1,16 @@
@ -212,14 +212,14 @@ index 0000000000..2acce28115
+/trigtables.c
diff --git a/grub-core/lib/.gitignore b/grub-core/lib/.gitignore
new file mode 100644
index 0000000000..6815459140
index 00000000000..68154591404
--- /dev/null
+++ b/grub-core/lib/.gitignore
@@ -0,0 +1 @@
+/libgcrypt-grub/
diff --git a/include/grub/gcrypt/.gitignore b/include/grub/gcrypt/.gitignore
new file mode 100644
index 0000000000..8fbf564624
index 00000000000..8fbf5646246
--- /dev/null
+++ b/include/grub/gcrypt/.gitignore
@@ -0,0 +1,2 @@
@ -227,7 +227,7 @@ index 0000000000..8fbf564624
+gcrypt.h
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000000..f507e7741e
index 00000000000..f507e7741e3
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,5 @@
@ -238,7 +238,7 @@ index 0000000000..f507e7741e
+/stamp-po
diff --git a/util/bash-completion.d/.gitignore b/util/bash-completion.d/.gitignore
new file mode 100644
index 0000000000..6813a527ad
index 00000000000..6813a527ad3
--- /dev/null
+++ b/util/bash-completion.d/.gitignore
@@ -0,0 +1,2 @@

View file

@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 91 insertions(+)
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c
index 4d493ab766..3a6689abb1 100644
index 11b2beb2ff2..e2ecc65d2d8 100644
--- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)
@ -100,7 +100,7 @@ index 4d493ab766..3a6689abb1 100644
+ return 0;
+}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index c4ebe9e22a..70614de156 100644
index bd44310005d..d3f53d93d87 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -34,6 +34,9 @@
@ -137,7 +137,7 @@ index c4ebe9e22a..70614de156 100644
grub_errno = GRUB_ERR_NONE;
}
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index 25158407dd..ad80399246 100644
index 14ff09094f0..dab8fd2aeb0 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -28,6 +28,9 @@
@ -162,10 +162,10 @@ index 25158407dd..ad80399246 100644
{
char *line;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 73e2f46447..0a599607f3 100644
index dddb385149e..4f6e6aaa098 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -254,6 +254,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
@@ -251,6 +251,8 @@ int EXPORT_FUNC(grub_ieee1275_devalias_next) (struct grub_ieee1275_devalias *ali
void EXPORT_FUNC(grub_ieee1275_children_peer) (struct grub_ieee1275_devalias *alias);
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias);

View file

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
index 85ecf06b4d..05c88dcf49 100644
index 4e534c683eb..3dbe88e8933 100644
--- a/grub-core/term/terminfo.c
+++ b/grub-core/term/terminfo.c
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,

View file

@ -15,10 +15,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c
index 20cbbd761e..04df9d2c66 100644
index e74de32483f..810a089a934 100644
--- a/grub-core/kern/ieee1275/cmain.c
+++ b/grub-core/kern/ieee1275/cmain.c
@@ -90,7 +90,10 @@ grub_ieee1275_find_options (void)
@@ -89,7 +89,10 @@ grub_ieee1275_find_options (void)
}
if (rc >= 0 && grub_strncmp (tmp, "IBM", 3) == 0)
@ -31,10 +31,10 @@ index 20cbbd761e..04df9d2c66 100644
/* Old Macs have no key repeat, newer ones have fully working one.
The ones inbetween when repeated key generates an escaoe sequence
diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c
index 17a3dbbb57..b8e4b3feb3 100644
index ca3d3c3b2c8..5592e4bb7c9 100644
--- a/grub-core/video/ieee1275.c
+++ b/grub-core/video/ieee1275.c
@@ -352,9 +352,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
@@ -351,9 +351,12 @@ static struct grub_video_adapter grub_video_ieee1275_adapter =
GRUB_MOD_INIT(ieee1275_fb)
{
@ -51,14 +51,14 @@ index 17a3dbbb57..b8e4b3feb3 100644
GRUB_MOD_FINI(ieee1275_fb)
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h
index 0a599607f3..b5a1d49bbc 100644
index 4f6e6aaa098..db0ec5f4c68 100644
--- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h
@@ -148,6 +148,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN,
@@ -145,6 +145,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_POWER_VM,
GRUB_IEEE1275_FLAG_RAW_DEVNAMES,
+
GRUB_IEEE1275_FLAG_POWER_KVM,
+
+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
};

View file

@ -10,10 +10,10 @@ Apparently these go in a new place now.
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 7517fc49d9..8331f95b64 100644
index cd667a2eb75..ae3a49321ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -314,6 +314,14 @@ AC_SUBST(grubdirname)
@@ -319,6 +319,14 @@ AC_SUBST(grubdirname)
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
[Default grub directory name])
@ -28,7 +28,7 @@ index 7517fc49d9..8331f95b64 100644
#
# Checks for build programs.
#
@@ -525,6 +533,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
@@ -534,6 +542,9 @@ HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
# Check for target programs.
#
@ -39,7 +39,7 @@ index 7517fc49d9..8331f95b64 100644
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
tmp_ac_tool_prefix="$ac_tool_prefix"
diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am
index 136287cf1b..61108f0542 100644
index 136287cf1bf..61108f05429 100644
--- a/util/bash-completion.d/Makefile.am
+++ b/util/bash-completion.d/Makefile.am
@@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source)

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 58 insertions(+), 27 deletions(-)
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index 8397886fa0..d7a222e681 100644
index 6a90e091f22..6444ee6f969 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout)

View file

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/commands/minicmd.c | 20 ++++++++++++++++----
grub-core/kern/efi/efi.c | 9 +++++++--
grub-core/kern/emu/main.c | 2 +-
grub-core/kern/emu/misc.c | 5 +++--
grub-core/kern/emu/misc.c | 9 +++++----
grub-core/kern/i386/coreboot/init.c | 2 +-
grub-core/kern/i386/qemu/init.c | 2 +-
grub-core/kern/ieee1275/init.c | 2 +-
@ -24,10 +24,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/uboot/init.c | 6 +++---
grub-core/kern/xen/init.c | 2 +-
include/grub/misc.h | 2 +-
14 files changed, 48 insertions(+), 21 deletions(-)
14 files changed, 50 insertions(+), 23 deletions(-)
diff --git a/grub-core/commands/minicmd.c b/grub-core/commands/minicmd.c
index fa498931ed..2bd3ac76f2 100644
index fa498931ed2..2bd3ac76f2d 100644
--- a/grub-core/commands/minicmd.c
+++ b/grub-core/commands/minicmd.c
@@ -182,12 +182,24 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
@ -60,10 +60,10 @@ index fa498931ed..2bd3ac76f2 100644
}
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 8cff7be028..05d8237a9b 100644
index b93ae3aba12..885d7c6420e 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -165,11 +165,16 @@ grub_reboot (void)
@@ -175,11 +175,16 @@ grub_reboot (void)
}
void
@ -76,14 +76,14 @@ index 8cff7be028..05d8237a9b 100644
+ rc = GRUB_EFI_SUCCESS;
+
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
efi_call_4 (grub_efi_system_table->boot_services->exit,
- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
+ grub_efi_image_handle, rc, 0, 0);
grub_efi_system_table->boot_services->exit (grub_efi_image_handle,
- GRUB_EFI_SUCCESS, 0, 0);
+ rc, 0, 0);
for (;;) ;
}
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
index 425bb96034..55ea5a11cc 100644
index 855b11c3dec..38c1576a2ef 100644
--- a/grub-core/kern/emu/main.c
+++ b/grub-core/kern/emu/main.c
@@ -67,7 +67,7 @@ grub_reboot (void)
@ -96,10 +96,19 @@ index 425bb96034..55ea5a11cc 100644
grub_reboot ();
}
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index dfd8a8ec48..0ff13bcaf8 100644
index 521220b49d2..16c79bc9488 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -151,9 +151,10 @@ xasprintf (const char *fmt, ...)
@@ -83,7 +83,7 @@ grub_util_error (const char *fmt, ...)
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
- grub_exit ();
+ grub_exit (1);
}
void *
@@ -152,12 +152,13 @@ xasprintf (const char *fmt, ...)
#if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
void
@ -107,13 +116,17 @@ index dfd8a8ec48..0ff13bcaf8 100644
+__attribute__ ((noreturn))
+grub_exit (int rc)
{
-#if defined (GRUB_KERNEL)
+#if defined (GRUB_KERNEL) && !defined (GRUB_MACHINE_EFI)
grub_reboot ();
#endif
- exit (1);
+ exit (rc < 0 ? 1 : rc);
}
#endif
diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c
index 3314f027fe..36f9134b7b 100644
index 4fae8b571f1..feaf9295e30 100644
--- a/grub-core/kern/i386/coreboot/init.c
+++ b/grub-core/kern/i386/coreboot/init.c
@@ -41,7 +41,7 @@ extern grub_uint8_t _end[];
@ -126,7 +139,7 @@ index 3314f027fe..36f9134b7b 100644
/* We can't use grub_fatal() in this function. This would create an infinite
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
diff --git a/grub-core/kern/i386/qemu/init.c b/grub-core/kern/i386/qemu/init.c
index 271b6fbfab..9fafe98f01 100644
index 08f81d25e68..604fc94b5a0 100644
--- a/grub-core/kern/i386/qemu/init.c
+++ b/grub-core/kern/i386/qemu/init.c
@@ -42,7 +42,7 @@ extern grub_uint8_t _end[];
@ -139,11 +152,11 @@ index 271b6fbfab..9fafe98f01 100644
/* We can't use grub_fatal() in this function. This would create an infinite
loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index d483e35eed..e71d158416 100644
index fb7d1a3bacf..50c65b2f6e5 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack;
#endif
@@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack;
#define BYTE22 (DY_MEM_V2 | DRC_INFO)
void
-grub_exit (void)
@ -152,7 +165,7 @@ index d483e35eed..e71d158416 100644
grub_ieee1275_exit ();
}
diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c
index 2ed3ff3191..5c40c34078 100644
index 2ed3ff3191e..5c40c34078d 100644
--- a/grub-core/kern/mips/arc/init.c
+++ b/grub-core/kern/mips/arc/init.c
@@ -276,7 +276,7 @@ grub_halt (void)
@ -165,7 +178,7 @@ index 2ed3ff3191..5c40c34078 100644
GRUB_ARC_FIRMWARE_VECTOR->exit ();
diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c
index 7b96531b98..dff598ca7b 100644
index 5bd721260f6..97b09b0eeea 100644
--- a/grub-core/kern/mips/loongson/init.c
+++ b/grub-core/kern/mips/loongson/init.c
@@ -304,7 +304,7 @@ grub_halt (void)
@ -178,7 +191,7 @@ index 7b96531b98..dff598ca7b 100644
grub_halt ();
}
diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c
index be88b77d22..8b6c55ffc0 100644
index b5477b87ffa..69488a34e7c 100644
--- a/grub-core/kern/mips/qemu_mips/init.c
+++ b/grub-core/kern/mips/qemu_mips/init.c
@@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused)))
@ -191,10 +204,10 @@ index be88b77d22..8b6c55ffc0 100644
grub_halt ();
}
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 3af336ee22..63b586d09c 100644
index 7cee5d75c3c..11037dc0227 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1209,9 +1209,18 @@ grub_abort (void)
@@ -1311,9 +1311,18 @@ grub_abort (void)
grub_getkey ();
}
@ -215,7 +228,7 @@ index 3af336ee22..63b586d09c 100644
grub_fatal (const char *fmt, ...)
{
diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c
index 3e338645c5..be2a5be1d0 100644
index 3e338645c57..be2a5be1d07 100644
--- a/grub-core/kern/uboot/init.c
+++ b/grub-core/kern/uboot/init.c
@@ -39,9 +39,9 @@ extern grub_size_t grub_total_module_size;
@ -240,7 +253,7 @@ index 3e338645c5..be2a5be1d0 100644
else if (ver > API_SIG_VERSION)
{
diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
index 782ca72952..708b060f32 100644
index 782ca72952a..708b060f324 100644
--- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c
@@ -584,7 +584,7 @@ grub_machine_init (void)
@ -253,15 +266,15 @@ index 782ca72952..708b060f32 100644
struct sched_shutdown arg;
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 7d2b551969..fd18e6320b 100644
index 1b35a167fde..72aff15750d 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -353,7 +353,7 @@ int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt,
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
@@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) WARN_UNUSED_RESULT;
-void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
+void EXPORT_FUNC(grub_exit) (int rc) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint64_t d,
grub_uint64_t *r);

View file

@ -6,14 +6,14 @@ Subject: [PATCH] Make efi machines load an env block from a variable
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/Makefile.core.def | 1 +
grub-core/kern/efi/init.c | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
grub-core/kern/efi/init.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 45d3edaa4d..c865a08b02 100644
index 1571421d7e8..0bffbfea917 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -207,6 +207,7 @@ kernel = {
@@ -219,6 +219,7 @@ kernel = {
efi = kern/efi/acpi.c;
efi = kern/efi/sb.c;
efi = kern/lockdown.c;
@ -22,10 +22,10 @@ index 45d3edaa4d..c865a08b02 100644
i386_multiboot = kern/i386/pc/acpi.c;
i386_coreboot = kern/acpi.c;
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index 7facacf09c..6d39bd3ad2 100644
index 6c54af6e79e..b5201974a76 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -27,8 +27,11 @@
@@ -28,8 +28,11 @@
#include <grub/env.h>
#include <grub/mm.h>
#include <grub/kernel.h>
@ -36,8 +36,8 @@ index 7facacf09c..6d39bd3ad2 100644
+
#ifdef GRUB_STACK_PROTECTOR
static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
@@ -82,6 +85,36 @@ stack_protector_init (void)
static grub_efi_char16_t stack_chk_fail_msg[] =
@@ -103,6 +106,36 @@ stack_protector_init (void)
grub_addr_t grub_modbase;
@ -58,7 +58,7 @@ index 7facacf09c..6d39bd3ad2 100644
+static void
+grub_efi_env_init (void)
+{
+ grub_efi_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
+ grub_guid_t efi_grub_guid = GRUB_EFI_GRUB_VARIABLE_GUID;
+ struct grub_envblk envblk_s = { NULL, 0 };
+ grub_envblk_t envblk = &envblk_s;
+
@ -71,19 +71,14 @@ index 7facacf09c..6d39bd3ad2 100644
+ grub_free (envblk_s.buf);
+}
+
void
__attribute__ ((__optimize__ ("-fno-stack-protector"))) void
grub_efi_init (void)
{
@@ -108,10 +141,11 @@ grub_efi_init (void)
efi_call_4 (grub_efi_system_table->boot_services->set_watchdog_timer,
0, 0, 0, NULL);
@@ -128,6 +161,7 @@ grub_efi_init (void)
grub_efi_system_table->boot_services->set_watchdog_timer (0, 0, 0, NULL);
+ grub_efi_env_init ();
grub_efidisk_init ();
}
-void (*grub_efi_net_config) (grub_efi_handle_t hnd,
+void (*grub_efi_net_config) (grub_efi_handle_t hnd,
char **device,
char **path);
grub_efi_register_debug_commands ();

View file

@ -15,11 +15,11 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub.d/20_ppc_terminfo.in
diff --git a/Makefile.util.def b/Makefile.util.def
index f8b356cc1f..2c9b283a23 100644
index 9432365a9df..09bfcadd976 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -508,6 +508,13 @@ script = {
condition = COND_HOST_LINUX;
@@ -517,6 +517,13 @@ script = {
installdir = grubconf;
};
+script = {
@ -34,7 +34,7 @@ index f8b356cc1f..2c9b283a23 100644
common = util/grub.d/30_os-prober.in;
diff --git a/util/grub.d/20_ppc_terminfo.in b/util/grub.d/20_ppc_terminfo.in
new file mode 100644
index 0000000000..10d6658682
index 00000000000..10d66586820
--- /dev/null
+++ b/util/grub.d/20_ppc_terminfo.in
@@ -0,0 +1,114 @@

View file

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index 73967e2f5b..d1de9fa687 100644
index 731c07c2901..463dafdba02 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void)
@ -44,7 +44,7 @@ index 73967e2f5b..d1de9fa687 100644
}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 70614de156..62571e6dfc 100644
index d3f53d93d87..08f48c71df1 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/grub-core/commands/wildcard.c b/grub-core/commands/wildcard.c
index cc3290311f..8f67a4be7f 100644
index ed65865050a..5455242c352 100644
--- a/grub-core/commands/wildcard.c
+++ b/grub-core/commands/wildcard.c
@@ -488,6 +488,12 @@ check_file (const char *dir, const char *basename)
@ -47,7 +47,7 @@ index cc3290311f..8f67a4be7f 100644
*optr++ = iptr[1];
iptr += 2;
diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c
index ed0b149dca..8e2294d8ff 100644
index ed0b149dca5..8e2294d8ff6 100644
--- a/grub-core/lib/cmdline.c
+++ b/grub-core/lib/cmdline.c
@@ -20,6 +20,12 @@
@ -97,7 +97,7 @@ index ed0b149dca..8e2294d8ff 100644
*buf++ = *c;
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
index ad80399246..0c6dd9c520 100644
index dab8fd2aeb0..c19b4bf700e 100644
--- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c
@@ -56,6 +56,12 @@ static struct grub_script_scope *scope = 0;

View file

@ -28,10 +28,10 @@ Signed-off-by: Will Thompson <wjt@endlessm.com>
create mode 100644 grub-core/commands/loadenv.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index c865a08b02..c15e91943b 100644
index 0bffbfea917..47c0fc755a2 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -814,6 +814,16 @@ module = {
@@ -842,6 +842,16 @@ module = {
common = commands/blocklist.c;
};
@ -48,7 +48,7 @@ index c865a08b02..c15e91943b 100644
module = {
name = boot;
common = commands/boot.c;
@@ -980,6 +990,7 @@ module = {
@@ -1009,6 +1019,7 @@ module = {
module = {
name = loadenv;
common = commands/loadenv.c;
@ -58,7 +58,7 @@ index c865a08b02..c15e91943b 100644
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
new file mode 100644
index 0000000000..e907a6a5d2
index 00000000000..e907a6a5d28
--- /dev/null
+++ b/grub-core/commands/blscfg.c
@@ -0,0 +1,1177 @@
@ -1240,7 +1240,7 @@ index 0000000000..e907a6a5d2
+ grub_unregister_extcmd (oldcmd);
+}
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
index cc5971f4db..782761c31a 100644
index e9e9d94eff5..2c5d1a0ef9a 100644
--- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c
@@ -143,7 +143,7 @@ legacy_file (const char *filename)
@ -1263,7 +1263,7 @@ index cc5971f4db..782761c31a 100644
}
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
index 3fd664aac3..163b9a0904 100644
index 16644584978..dfcb19e0ff8 100644
--- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c
@@ -28,6 +28,8 @@
@ -1358,7 +1358,7 @@ index 3fd664aac3..163b9a0904 100644
grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args)
{
diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c
index 720e6d8ea3..b194123eb6 100644
index 720e6d8ea3b..b194123eb67 100644
--- a/grub-core/commands/menuentry.c
+++ b/grub-core/commands/menuentry.c
@@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
@ -1430,7 +1430,7 @@ index 720e6d8ea3..b194123eb6 100644
src[len - 1] = ch;
args[argc - 1] = src;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 62571e6dfc..7ca2e5400b 100644
index 08f48c71df1..1317279c081 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -21,6 +21,7 @@
@ -1455,7 +1455,7 @@ index 62571e6dfc..7ca2e5400b 100644
grub_free ((void *) entry->title);
diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h
new file mode 100644
index 0000000000..952f46121b
index 00000000000..952f46121bd
--- /dev/null
+++ b/grub-core/commands/loadenv.h
@@ -0,0 +1,93 @@
@ -1553,7 +1553,7 @@ index 0000000000..952f46121b
+ return 0;
+}
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
index 8f3be3ae70..ebafec6895 100644
index 0c5519387b2..441a9eca07c 100644
--- a/include/grub/compiler.h
+++ b/include/grub/compiler.h
@@ -56,4 +56,6 @@
@ -1564,7 +1564,7 @@ index 8f3be3ae70..ebafec6895 100644
+
#endif /* ! GRUB_COMPILER_HEADER */
diff --git a/include/grub/menu.h b/include/grub/menu.h
index ee2b5e9104..0acdc2aa6b 100644
index ee2b5e91045..0acdc2aa6bf 100644
--- a/include/grub/menu.h
+++ b/include/grub/menu.h
@@ -20,6 +20,16 @@
@ -1595,7 +1595,7 @@ index ee2b5e9104..0acdc2aa6b 100644
typedef struct grub_menu_entry *grub_menu_entry_t;
diff --git a/include/grub/normal.h b/include/grub/normal.h
index 218cbabcca..8839ad85a1 100644
index 218cbabccaf..8839ad85a19 100644
--- a/include/grub/normal.h
+++ b/include/grub/normal.h
@@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes,

View file

@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin <dmarlin@redhat.com>
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index d3e879b8e5..8ea2315ebc 100644
index 7516a015be0..7b355115dd4 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -248,7 +248,8 @@ export GRUB_DEFAULT \
@@ -252,7 +252,8 @@ export GRUB_DEFAULT \
GRUB_ENABLE_CRYPTODISK \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
@ -34,10 +34,10 @@ index d3e879b8e5..8ea2315ebc 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index e8b01c0d0c..dc75a1c30b 100644
index cc393be7eda..00d4b220ccb 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -153,6 +153,13 @@ EOF
@@ -155,6 +155,13 @@ EOF
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
initrd $(echo $initrd_path)
@ -51,7 +51,7 @@ index e8b01c0d0c..dc75a1c30b 100644
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
@@ -236,6 +243,14 @@ while [ "x$list" != "x" ] ; do
@@ -250,6 +257,14 @@ for linux in ${reverse_sorted_list}; do
gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
fi

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 93a90233ea..858b526c92 100644
index 6a316a5ba77..c2d8b093762 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -43,6 +43,8 @@ if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_

View file

@ -13,20 +13,20 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 7ca2e5400b..98372217ad 100644
index 1317279c081..568c2adfa16 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term,
grub_term_cls (term);
- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
+ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted)
return;
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
index 8a87109b15..9a4319d4f4 100644
index 8a87109b152..9a4319d4f4f 100644
--- a/tests/util/grub-shell-tester.in
+++ b/tests/util/grub-shell-tester.in
@@ -56,7 +56,7 @@ for option in "$@"; do
@ -39,10 +39,10 @@ index 8a87109b15..9a4319d4f4 100644
--modules=*)
ms=`echo "$option" | sed -e 's/--modules=//'`
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
index 93e9f51484..ec1182bf93 100644
index 496e1bab33c..e0570c88e15 100644
--- a/tests/util/grub-shell.in
+++ b/tests/util/grub-shell.in
@@ -209,7 +209,7 @@ for option in "$@"; do
@@ -243,7 +243,7 @@ for option in "$@"; do
usage
exit 0 ;;
-v | --version)
@ -50,9 +50,9 @@ index 93e9f51484..ec1182bf93 100644
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--trim)
trim=1
trim=1 ;;
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index dc75a1c30b..4a499c53a6 100644
index 00d4b220ccb..901745707f1 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
@ -68,7 +68,7 @@ index dc75a1c30b..4a499c53a6 100644
fi
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 3b1f470492..ada20775a1 100644
index 94dd8be1342..98ee5bc58dc 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -3,20 +3,21 @@ From: Fedora Ninjas <grub2-owner@fedoraproject.org>
Date: Mon, 13 Jan 2014 21:50:59 -0500
Subject: [PATCH] Add .eh_frame to list of relocations stripped
Signed-off-by: Peter Jones <pjones@redhat.com>
---
conf/Makefile.common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 2a1a886f6d..191b1a70c6 100644
index b8f216f6cd3..ece9ed8a1bf 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
-STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
+STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
if !COND_emu
if COND_HAVE_ASM_USCORE
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free

View file

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 4a499c53a6..cf8d118698 100644
index 901745707f1..9c31a94decb 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@"

View file

@ -17,7 +17,7 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 98372217ad..bf24e65713 100644
index 568c2adfa16..0b2bbee19c3 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 51 insertions(+), 46 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index bf24e65713..0a99768f75 100644
index 0b2bbee19c3..4c89892fa70 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

View file

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index cf8d118698..5f6d3c8d52 100644
index 9c31a94decb..b7809091b36 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"

View file

@ -7,38 +7,26 @@ Related: rhbz#1148652
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/ieee1275/init.c | 28 +++++----
grub-core/kern/ieee1275/init.c | 34 ++++++-----
grub-core/net/net.c | 2 +-
grub-core/normal/main.c | 134 ++++++++++++++++++++---------------------
3 files changed, 82 insertions(+), 82 deletions(-)
3 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index e71d158416..0cd2a62723 100644
index 50c65b2f6e5..51c1e1c9d9f 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -127,23 +127,25 @@ grub_machine_get_bootlocation (char **device, char **path)
@@ -170,23 +170,25 @@ grub_machine_get_bootlocation (char **device, char **path)
grub_free (canon);
}
else
- *device = grub_ieee1275_encode_devname (bootpath);
- grub_free (type);
-
- filename = grub_ieee1275_get_filename (bootpath);
- if (filename)
{
- char *lastslash = grub_strrchr (filename, '\\');
-
- /* Truncate at last directory. */
- if (lastslash)
+ {
+ filename = grub_ieee1275_get_filename (bootpath);
+ if (filename)
{
- *lastslash = '\0';
- grub_translate_ieee1275_path (filename);
+ {
+ char *lastslash = grub_strrchr (filename, '\\');
- *path = filename;
- }
+
+ /* Truncate at last directory. */
+ if (lastslash)
+ {
@ -49,17 +37,32 @@ index e71d158416..0cd2a62723 100644
+ }
+ }
+ *device = grub_ieee1275_encode_devname (bootpath);
}
+ }
+
+ grub_free (type);
grub_free (type);
-
- filename = grub_ieee1275_get_filename (bootpath);
- if (filename)
- {
- char *lastslash = grub_strrchr (filename, '\\');
-
- /* Truncate at last directory. */
- if (lastslash)
- {
- *lastslash = '\0';
- grub_translate_ieee1275_path (filename);
-
- *path = filename;
- }
- }
grub_free (bootpath);
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 4d3eb5c1a5..0ef148f4ad 100644
index 8cad4fb6d4d..54451cea2a7 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1869,7 +1869,7 @@ grub_net_search_config_file (char *config)
@@ -2005,7 +2005,7 @@ grub_net_search_config_file (char *config)
/* Remove the remaining minus sign at the end. */
config[config_len] = '\0';
@ -69,7 +72,7 @@ index 4d3eb5c1a5..0ef148f4ad 100644
static struct grub_preboot *fini_hnd;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 0a99768f75..55558cc0b9 100644
index 4c89892fa70..3463f444f74 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config)

View file

@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 5f6d3c8d52..786dbabb4a 100644
index b7809091b36..993c53ad92e 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -78,6 +78,32 @@ case x"$GRUB_FS" in
@@ -80,6 +80,32 @@ case x"$GRUB_FS" in
;;
esac
@ -48,7 +48,7 @@ index 5f6d3c8d52..786dbabb4a 100644
title_correction_code=
linux_entry ()
@@ -91,17 +117,11 @@ linux_entry ()
@@ -93,17 +119,11 @@ linux_entry ()
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ x$type != xsimple ] ; then

View file

@ -29,10 +29,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub.d/01_users.in
diff --git a/configure.ac b/configure.ac
index 8331f95b64..7f59ad788f 100644
index ae3a49321ad..493e336ec6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath])
@@ -77,6 +77,7 @@ grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
@ -41,10 +41,10 @@ index 8331f95b64..7f59ad788f 100644
grub_TRANSFORM([grub-set-default])
grub_TRANSFORM([grub-sparc64-setup])
diff --git a/Makefile.util.def b/Makefile.util.def
index 2c9b283a23..4ee22c5daa 100644
index 09bfcadd976..95884956a68 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -452,6 +452,12 @@ script = {
@@ -455,6 +455,12 @@ script = {
installdir = grubconf;
};
@ -57,7 +57,7 @@ index 2c9b283a23..4ee22c5daa 100644
script = {
name = '10_windows';
common = util/grub.d/10_windows.in;
@@ -724,6 +730,13 @@ script = {
@@ -733,6 +739,13 @@ script = {
installdir = sbin;
};
@ -73,17 +73,17 @@ index 2c9b283a23..4ee22c5daa 100644
common = util/grub-mkconfig_lib.in;
diff --git a/docs/man/grub-set-password.h2m b/docs/man/grub-set-password.h2m
new file mode 100644
index 0000000000..10ee82f4d5
index 00000000000..10ee82f4d52
--- /dev/null
+++ b/docs/man/grub-set-password.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-set-password \- generate the user.cfg file containing the hashed grub bootloader password
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 8ea2315ebc..ba14cf6261 100644
index 7b355115dd4..5f2824d4f58 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -276,6 +276,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
@@ -280,6 +280,8 @@ for i in "${grub_mkconfig_dir}"/* ; do
*~) ;;
# emacsen autosave files. FIXME: support other editors
*/\#*\#) ;;
@ -94,7 +94,7 @@ index 8ea2315ebc..ba14cf6261 100644
echo
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
new file mode 100644
index 0000000000..5ebf50576d
index 00000000000..5ebf50576d6
--- /dev/null
+++ b/util/grub-set-password.in
@@ -0,0 +1,128 @@
@ -228,7 +228,7 @@ index 0000000000..5ebf50576d
+fi
diff --git a/util/grub.d/01_users.in b/util/grub.d/01_users.in
new file mode 100644
index 0000000000..db2f44bfb7
index 00000000000..db2f44bfb78
--- /dev/null
+++ b/util/grub.d/01_users.in
@@ -0,0 +1,11 @@

View file

@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik <jbacik@fb.com>
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c
index e8ad34b84d..7d4b822626 100644
index 93dee0caa1b..902ab7e8ae6 100644
--- a/grub-core/net/tcp.c
+++ b/grub-core/net/tcp.c
@@ -106,6 +106,18 @@ struct tcphdr
@ -39,7 +39,7 @@ index e8ad34b84d..7d4b822626 100644
struct tcp_pseudohdr
{
grub_uint32_t src;
@@ -566,7 +578,7 @@ grub_net_tcp_open (char *server,
@@ -571,7 +583,7 @@ grub_net_tcp_open (char *server,
grub_net_tcp_socket_t socket;
static grub_uint16_t in_port = 21550;
struct grub_net_buff *nb;
@ -48,7 +48,7 @@ index e8ad34b84d..7d4b822626 100644
int i;
grub_uint8_t *nbd;
grub_net_link_level_address_t ll_target_addr;
@@ -635,20 +647,24 @@ grub_net_tcp_open (char *server,
@@ -640,20 +652,24 @@ grub_net_tcp_open (char *server,
}
tcph = (void *) nb->data;

View file

@ -6,18 +6,18 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++
grub-core/net/drivers/efi/efinet.c | 53 ++++++++++--
grub-core/net/drivers/efi/efinet.c | 84 +++++++++++++-----
grub-core/net/net.c | 72 +++++++++++++++
grub-core/net/tftp.c | 4 +
grub-core/net/tftp.c | 3 +
include/grub/efi/api.h | 129 +++++++++++++++++++++++++--
include/grub/net.h | 60 +++++++++++++
6 files changed, 477 insertions(+), 14 deletions(-)
6 files changed, 491 insertions(+), 30 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 6fb5627025..e28fb6a09f 100644
index abe45ef7bf6..02d2c2614cb 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -902,6 +902,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
@@ -905,6 +905,179 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
@ -198,7 +198,7 @@ index 6fb5627025..e28fb6a09f 100644
grub_bootp_init (void)
{
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5388f952ba..173fb63153 100644
index 3ea25cf9894..2af8742f904 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -18,11 +18,14 @@
@ -216,16 +216,16 @@ index 5388f952ba..173fb63153 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -329,7 +332,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -346,7 +349,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path)
{
struct grub_net_card *card;
- grub_efi_device_path_t *dp;
+ grub_efi_device_path_t *dp, *ldp = NULL;
dp = grub_efi_get_device_path (hnd);
if (! dp)
@@ -340,14 +343,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
struct grub_net_network_level_interface *inter;
grub_efi_device_path_t *vlan_dp;
grub_efi_uint16_t vlan_dp_len;
@@ -361,14 +364,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe;
struct grub_efi_pxe_mode *pxe_mode;
@ -246,7 +246,7 @@ index 5388f952ba..173fb63153 100644
int match;
/* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6
@@ -356,7 +364,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -377,7 +385,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
devices. We skip them when enumerating cards, so here we need to
find matching MAC device.
*/
@ -254,7 +254,7 @@ index 5388f952ba..173fb63153 100644
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
@@ -373,16 +380,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -394,41 +401,70 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (!match)
continue;
}
@ -265,11 +265,6 @@ index 5388f952ba..173fb63153 100644
continue;
+
pxe_mode = pxe->mode;
- grub_net_configure_by_dhcp_ack (card->name, card, 0,
- (struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
- 1, device, path);
+ if (pxe_mode->using_ipv6)
+ {
+ grub_net_link_level_address_t hwaddr;
@ -281,41 +276,86 @@ index 5388f952ba..173fb63153 100644
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
+ if (!pxe_mode->dhcp_ack_received)
+ continue;
+
- inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
- (struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
- 1, device, path);
+ hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ grub_memcpy (hwaddr.mac,
+ card->efi_net->mode->current_address,
+ sizeof (hwaddr.mac));
+
+ intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
- if (inter != NULL)
+ inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
+ (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
+ 1, device, path);
+ if (intf && device && path)
+ if (inter && device && path)
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ }
+ else
+ {
{
- /*
- * Search the device path for any VLAN subtype and use it
- * to configure the interface.
- */
- vlan_dp = dp;
+ grub_dprintf ("efinet", "using ipv4 and dhcp\n");
+ grub_net_configure_by_dhcp_ack (card->name, card, 0,
+ (struct grub_net_bootp_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
+ inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
+ (struct grub_net_bootp_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ }
return;
+ if (inter != NULL)
{
- if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
- GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
+ /*
+ * Search the device path for any VLAN subtype and use it
+ * to configure the interface.
+ */
+ vlan_dp = dp;
+
+ while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
{
- vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
- inter->vlantag = vlan->vlan_id;
- break;
+ if (GRUB_EFI_DEVICE_PATH_TYPE (vlan_dp) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE &&
+ GRUB_EFI_DEVICE_PATH_SUBTYPE (vlan_dp) == GRUB_EFI_VLAN_DEVICE_PATH_SUBTYPE)
+ {
+ vlan = (grub_efi_vlan_device_path_t *) vlan_dp;
+ inter->vlantag = vlan->vlan_id;
+ break;
+ }
+
+ vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
+ vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
-
- vlan_dp_len = GRUB_EFI_DEVICE_PATH_LENGTH (vlan_dp);
- vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
+ return;
}
- return;
}
}
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 0ef148f4ad..22f2689aae 100644
index 54451cea2a7..20c55257647 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -960,6 +960,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
@@ -984,6 +984,78 @@ grub_net_network_level_interface_register (struct grub_net_network_level_interfa
grub_net_network_level_interfaces = inter;
}
+int
+grub_ipv6_get_masksize (grub_uint16_t be_mask[8])
+grub_ipv6_get_masksize (grub_uint16_t *be_mask)
+{
+ grub_uint8_t *mask;
+ grub_uint16_t mask16[8];
@ -390,10 +430,10 @@ index 0ef148f4ad..22f2689aae 100644
grub_err_t
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter,
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 7f44b30f52..4ab2f5c735 100644
index 409b1d09bcd..f300a9d4007 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -358,18 +358,22 @@ tftp_open (struct grub_file *file, const char *filename)
@@ -359,6 +359,7 @@ tftp_open (struct grub_file *file, const char *filename)
file->not_easily_seekable = 1;
file->data = data;
@ -401,14 +441,13 @@ index 7f44b30f52..4ab2f5c735 100644
err = grub_net_resolve_address (file->device->net->server, &addr);
if (err)
{
+ grub_dprintf("tftp", "Address resolution failed: %d\n", err);
grub_free (data);
@@ -369,11 +370,13 @@ tftp_open (struct grub_file *file, const char *filename)
return err;
}
+ grub_dprintf("tftp", "opening connection\n");
data->sock = grub_net_udp_open (addr,
TFTP_SERVER_PORT, tftp_receive,
port ? port : TFTP_SERVER_PORT, tftp_receive,
file);
if (!data->sock)
{
@ -417,10 +456,10 @@ index 7f44b30f52..4ab2f5c735 100644
return grub_errno;
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index f1a52210c0..117469450d 100644
index d44d00ad7d5..c6d702831f7 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -592,10 +592,16 @@ typedef void *grub_efi_handle_t;
@@ -637,10 +637,16 @@ typedef void *grub_efi_handle_t;
typedef void *grub_efi_event_t;
typedef grub_efi_uint64_t grub_efi_lba_t;
typedef grub_efi_uintn_t grub_efi_tpl_t;
@ -441,7 +480,7 @@ index f1a52210c0..117469450d 100644
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@@ -1474,16 +1480,127 @@ struct grub_efi_simple_text_output_interface
@@ -1521,16 +1527,127 @@ struct grub_efi_simple_text_output_interface
};
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
@ -572,10 +611,10 @@ index f1a52210c0..117469450d 100644
typedef struct grub_efi_pxe
diff --git a/include/grub/net.h b/include/grub/net.h
index 7ae4b6bd80..8a05ec4fe7 100644
index 844e501c128..bf8430a6364 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -447,6 +447,51 @@ struct grub_net_bootp_packet
@@ -450,6 +450,51 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -627,7 +666,7 @@ index 7ae4b6bd80..8a05ec4fe7 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53
@@ -482,6 +527,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -485,6 +530,21 @@ grub_net_configure_by_dhcp_ack (const char *name,
grub_size_t size,
int is_def, char **device, char **path);

View file

@ -12,14 +12,14 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------
grub-core/net/drivers/efi/efinet.c | 20 +-
grub-core/net/drivers/efi/efinet.c | 18 +-
grub-core/net/ip.c | 39 ++
include/grub/efi/api.h | 2 +-
include/grub/net.h | 91 ++--
5 files changed, 1002 insertions(+), 209 deletions(-)
5 files changed, 1001 insertions(+), 208 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 08b6b2b5d6..fe93b80f1c 100644
index 02d2c2614cb..e0aec25233d 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -24,6 +24,98 @@
@ -121,7 +121,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
struct grub_dhcp_discover_options
{
@@ -604,6 +696,584 @@ out:
@@ -610,6 +702,584 @@ out:
return err;
}
@ -427,7 +427,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
+ grub_dhcp6_session_t se;
+ struct grub_datetime date;
+ grub_err_t err;
+ grub_int32_t t = 0;
+ grub_int64_t t = 0;
+
+ se = grub_malloc (sizeof (*se));
+
@ -706,7 +706,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
/*
* This is called directly from net/ip.c:handle_dgram(), because those
* BOOTP/DHCP packets are a bit special due to their improper
@@ -672,6 +1342,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
@@ -678,6 +1348,77 @@ grub_net_process_dhcp (struct grub_net_buff *nb,
}
}
@ -784,7 +784,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
static grub_err_t
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
@@ -897,180 +1638,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
@@ -903,180 +1644,174 @@ grub_cmd_bootp (struct grub_command *cmd __attribute__ ((unused)),
return err;
}
@ -1119,7 +1119,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
void
grub_bootp_init (void)
@@ -1084,11 +1819,15 @@ grub_bootp_init (void)
@@ -1090,11 +1825,15 @@ grub_bootp_init (void)
cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt,
N_("VAR INTERFACE NUMBER DESCRIPTION"),
N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value."));
@ -1136,10 +1136,10 @@ index 08b6b2b5d6..fe93b80f1c 100644
grub_unregister_command (cmd_bootp);
grub_unregister_command (cmd_dhcp);
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index a673bea807..8e25680db0 100644
index 2af8742f904..3e2432fb61c 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -393,9 +393,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -410,9 +410,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
pxe_mode = pxe->mode;
if (pxe_mode->using_ipv6)
{
@ -1149,7 +1149,7 @@ index a673bea807..8e25680db0 100644
grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
pxe_mode->dhcp_ack_received ? "yes" : "no",
@@ -403,15 +400,14 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -420,14 +417,13 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (!pxe_mode->dhcp_ack_received)
continue;
@ -1158,26 +1158,24 @@ index a673bea807..8e25680db0 100644
- card->efi_net->mode->current_address,
- sizeof (hwaddr.mac));
-
- intf = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
- inter = grub_net_configure_by_dhcpv6_ack (card->name, card, 0, &hwaddr,
- (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
- 1, device, path);
- if (intf && device && path)
+ grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
+ (struct grub_net_dhcp6_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
+ inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
+ (struct grub_net_dhcp6_packet *)
+ &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack),
+ 1, device, path);
+ if (grub_errno)
+ grub_print_error ();
+ if (device && path)
if (inter && device && path)
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
}
else
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index a5896f6dc2..ce6bdc75c6 100644
index 3c3d0be0e57..f967618e53f 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -239,6 +239,45 @@ handle_dgram (struct grub_net_buff *nb,
@@ -240,6 +240,45 @@ handle_dgram (struct grub_net_buff *nb,
{
struct udphdr *udph;
udph = (struct udphdr *) nb->data;
@ -1224,10 +1222,10 @@ index a5896f6dc2..ce6bdc75c6 100644
{
const struct grub_net_bootp_packet *bootp;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 9962880147..7614b58dca 100644
index c6d702831f7..c1b869db520 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1532,7 +1532,7 @@ typedef struct grub_efi_pxe_ip_filter
@@ -1570,7 +1570,7 @@ typedef struct grub_efi_pxe_ip_filter
{
grub_efi_uint8_t filters;
grub_efi_uint8_t ip_count;
@ -1237,10 +1235,10 @@ index 9962880147..7614b58dca 100644
} grub_efi_pxe_ip_filter_t;
diff --git a/include/grub/net.h b/include/grub/net.h
index d55d505a03..543251f727 100644
index bf8430a6364..ff901b96e22 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -451,50 +451,65 @@ struct grub_net_bootp_packet
@@ -450,50 +450,65 @@ struct grub_net_bootp_packet
grub_uint8_t vendor[0];
} GRUB_PACKED;
@ -1336,7 +1334,7 @@ index d55d505a03..543251f727 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
@@ -532,12 +547,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -531,12 +546,12 @@ grub_net_configure_by_dhcp_ack (const char *name,
int is_def, char **device, char **path);
struct grub_net_network_level_interface *
@ -1355,7 +1353,7 @@ index d55d505a03..543251f727 100644
int
grub_ipv6_get_masksize(grub_uint16_t *mask);
@@ -554,6 +569,10 @@ void
@@ -553,6 +568,10 @@ void
grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_network_level_interface *iface);

View file

@ -24,10 +24,10 @@ Resolves: rhbz#1226325
create mode 100644 util/grub-get-kernel-settings.in
diff --git a/configure.ac b/configure.ac
index 7f59ad788f..0d0e6782a1 100644
index 493e336ec6c..3602b4ab62b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ grub_TRANSFORM([grub-install])
@@ -70,6 +70,7 @@ grub_TRANSFORM([grub-install])
grub_TRANSFORM([grub-mkconfig])
grub_TRANSFORM([grub-mkfont])
grub_TRANSFORM([grub-mkimage])
@ -36,10 +36,10 @@ index 7f59ad788f..0d0e6782a1 100644
grub_TRANSFORM([grub-mklayout])
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
diff --git a/Makefile.util.def b/Makefile.util.def
index 4ee22c5daa..18a9242776 100644
index 95884956a68..84a17ef5cfa 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -716,6 +716,13 @@ script = {
@@ -725,6 +725,13 @@ script = {
installdir = sbin;
};
@ -55,17 +55,17 @@ index 4ee22c5daa..18a9242776 100644
common = util/grub-set-default.in;
diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m
new file mode 100644
index 0000000000..b8051f01f3
index 00000000000..b8051f01f3a
--- /dev/null
+++ b/docs/man/grub-get-kernel-settings.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
index 44bf135b9f..5c4acd496d 100644
index 213ce1e57cf..da7fca5efac 100644
--- a/util/bash-completion.d/grub-completion.bash.in
+++ b/util/bash-completion.d/grub-completion.bash.in
@@ -264,6 +264,28 @@ have ${__grub_sparc64_setup_program} && \
@@ -275,6 +275,28 @@ have ${__grub_sparc64_setup_program} && \
unset __grub_sparc64_setup_program
@ -96,7 +96,7 @@ index 44bf135b9f..5c4acd496d 100644
#
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
new file mode 100644
index 0000000000..7e87dfccc0
index 00000000000..7e87dfccc0e
--- /dev/null
+++ b/util/grub-get-kernel-settings.in
@@ -0,0 +1,88 @@
@ -189,7 +189,7 @@ index 0000000000..7e87dfccc0
+ echo export GRUB_UPDATE_DEFAULT_KERNEL
+fi
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index ba14cf6261..005f093809 100644
index 5f2824d4f58..28e92515795 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@"
@ -210,10 +210,10 @@ index ba14cf6261..005f093809 100644
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
GRUB_DISABLE_LINUX_UUID="true"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 786dbabb4a..292e333324 100644
index 993c53ad92e..e8ab4082f87 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -111,7 +111,8 @@ linux_entry ()
@@ -113,7 +113,8 @@ linux_entry ()
os="$1"
version="$2"
type="$3"
@ -223,7 +223,7 @@ index 786dbabb4a..292e333324 100644
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
@@ -123,6 +124,9 @@ linux_entry ()
@@ -125,6 +126,9 @@ linux_entry ()
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
fi
@ -233,7 +233,7 @@ index 786dbabb4a..292e333324 100644
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
@@ -306,11 +310,15 @@ while [ "x$list" != "x" ] ; do
@@ -320,11 +324,15 @@ for linux in ${reverse_sorted_list}; do
fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
@ -251,7 +251,7 @@ index 786dbabb4a..292e333324 100644
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
@@ -319,10 +327,15 @@ while [ "x$list" != "x" ] ; do
@@ -333,10 +341,15 @@ for linux in ${reverse_sorted_list}; do
is_top_level=false
fi
@ -266,6 +266,6 @@ index 786dbabb4a..292e333324 100644
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
- linux_entry "${OS}" "${version}" recovery \
+ linux_entry "${OS}" "${version}" recovery standard \
"single ${GRUB_CMDLINE_LINUX}"
"${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
fi
done

View file

@ -5,18 +5,18 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
---
grub-core/Makefile.core.def | 3 ++
grub-core/kern/misc.c | 8 +++++-
grub-core/kern/misc.c | 6 ++++
grub-core/lib/arm64/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++
grub-core/lib/backtrace.c | 2 ++
grub-core/lib/i386/backtrace.c | 14 +++++++++-
5 files changed, 87 insertions(+), 2 deletions(-)
5 files changed, 86 insertions(+), 1 deletion(-)
create mode 100644 grub-core/lib/arm64/backtrace.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index c15e91943b..058c88ac3a 100644
index 47c0fc755a2..63f053b3add 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -188,6 +188,9 @@ kernel = {
@@ -199,6 +199,9 @@ kernel = {
softdiv = lib/division.c;
@ -27,19 +27,19 @@ index c15e91943b..058c88ac3a 100644
i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c;
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 63b586d09c..a3e215155b 100644
index 11037dc0227..465a8e74ea7 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -24,6 +24,7 @@
#include <grub/term.h>
#include <grub/env.h>
@@ -26,6 +26,7 @@
#include <grub/i18n.h>
#include <grub/types.h>
#include <grub/charset.h>
+#include <grub/backtrace.h>
union printf_arg
{
@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
static void __attribute__ ((noreturn))
@@ -1301,6 +1302,11 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
void __attribute__ ((noreturn))
grub_abort (void)
{
+#ifndef GRUB_UTIL
@ -48,14 +48,11 @@ index 63b586d09c..a3e215155b 100644
+#endif
+#endif
grub_printf ("\nAborted.");
-
+
#ifndef GRUB_UTIL
if (grub_term_inputs)
#endif
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
new file mode 100644
index 0000000000..1079b5380e
index 00000000000..1079b5380e1
--- /dev/null
+++ b/grub-core/lib/arm64/backtrace.c
@@ -0,0 +1,62 @@
@ -122,7 +119,7 @@ index 0000000000..1079b5380e
+}
+
diff --git a/grub-core/lib/backtrace.c b/grub-core/lib/backtrace.c
index 825a8800e2..c0ad6ab8be 100644
index 825a8800e25..c0ad6ab8be1 100644
--- a/grub-core/lib/backtrace.c
+++ b/grub-core/lib/backtrace.c
@@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
@ -142,7 +139,7 @@ index 825a8800e2..c0ad6ab8be 100644
}
diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c
index c3e03c7275..c67273db3a 100644
index c3e03c7275c..c67273db3ae 100644
--- a/grub-core/lib/i386/backtrace.c
+++ b/grub-core/lib/i386/backtrace.c
@@ -15,11 +15,23 @@

View file

@ -9,11 +9,11 @@ time.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
docs/grub-dev.texi | 4 +-
docs/grub.texi | 321 ++++++++++++++++++++++++++++-------------------------
2 files changed, 171 insertions(+), 154 deletions(-)
docs/grub.texi | 357 ++++++++++++++++++++++++++++-------------------------
2 files changed, 189 insertions(+), 172 deletions(-)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index 6c629a23e2..19f708ee66 100644
index 1276c59302a..04c6678cb6b 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -1,7 +1,7 @@
@ -35,7 +35,7 @@ index 6c629a23e2..19f708ee66 100644
@setchapternewpage odd
diff --git a/docs/grub.texi b/docs/grub.texi
index 69f08d289f..0615d0ed97 100644
index 974bc0ddb07..c30701b4e1f 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -1,7 +1,7 @@
@ -72,31 +72,7 @@ index 69f08d289f..0615d0ed97 100644
@end direntry
@setchapternewpage odd
@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}.
* Platform-specific operations:: Platform-specific operations
* Supported kernels:: The list of supported kernels
* Troubleshooting:: Error messages produced by GRUB
-* Invoking grub-install:: How to use the GRUB installer
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
-* Invoking grub-mkpasswd-pbkdf2::
+* Invoking grub2-install:: How to use the GRUB installer
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
+* Invoking grub2-mkpasswd-pbkdf2::
Generate GRUB password hashes
-* Invoking grub-mkrelpath:: Make system path relative to its root
-* Invoking grub-mkrescue:: Make a GRUB rescue image
-* Invoking grub-mount:: Mount a file system using GRUB
-* Invoking grub-probe:: Probe device information for GRUB
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
+* Invoking grub2-mkrelpath:: Make system path relative to its root
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
+* Invoking grub2-mount:: Mount a file system using GRUB
+* Invoking grub2-probe:: Probe device information for GRUB
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
* Obtaining and Building GRUB:: How to obtain and build GRUB
* Reporting bugs:: Where you should send a bug report
* Future:: Some future plans on GRUB
@@ -230,7 +230,7 @@ surprising.
@@ -223,7 +223,7 @@ surprising.
@item
@file{grub.cfg} is typically automatically generated by
@ -105,7 +81,7 @@ index 69f08d289f..0615d0ed97 100644
easier to handle versioned kernel upgrades.
@item
@@ -244,7 +244,7 @@ scripting language: variables, conditionals, and loops are available.
@@ -237,7 +237,7 @@ scripting language: variables, conditionals, and loops are available.
@item
A small amount of persistent storage is available across reboots, using the
@command{save_env} and @command{load_env} commands in GRUB and the
@ -114,7 +90,7 @@ index 69f08d289f..0615d0ed97 100644
(@pxref{Environment block}).
@item
@@ -549,7 +549,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
@@ -542,7 +542,7 @@ On OS which have device nodes similar to Unix-like OS GRUB tools use the
OS name. E.g. for GNU/Linux:
@example
@ -123,7 +99,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
On AROS we use another syntax. For volumes:
@@ -572,7 +572,7 @@ For disks we use syntax:
@@ -565,7 +565,7 @@ For disks we use syntax:
E.g.
@example
@ -132,7 +108,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
On Windows we use UNC path. For volumes it's typically
@@ -599,7 +599,7 @@ For disks it's
@@ -592,7 +592,7 @@ For disks it's
E.g.
@example
@ -141,7 +117,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
Beware that you may need to further escape the backslashes depending on your
@@ -609,7 +609,7 @@ When compiled with cygwin support then cygwin drive names are automatically
@@ -602,7 +602,7 @@ When compiled with cygwin support then cygwin drive names are automatically
when needed. E.g.
@example
@ -150,7 +126,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
@node Installation
@@ -622,7 +622,7 @@ from the source tarball, or as a package for your OS.
@@ -615,7 +615,7 @@ from the source tarball, or as a package for your OS.
After you have done that, you need to install the boot loader on a
drive (floppy or hard disk) by using the utility
@ -159,7 +135,7 @@ index 69f08d289f..0615d0ed97 100644
GRUB comes with boot images, which are normally put in the directory
@file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines
@@ -633,22 +633,22 @@ loader needs to find them (usually @file{/boot}) will be called
@@ -626,22 +626,22 @@ loader needs to find them (usually @file{/boot}) will be called
the @dfn{boot directory}.
@menu
@ -187,7 +163,7 @@ index 69f08d289f..0615d0ed97 100644
The usage is basically very simple. You only need to specify one
argument to the program, namely, where to install the boot loader. The
@@ -657,13 +657,13 @@ For example, under Linux the following will install GRUB into the MBR
@@ -650,13 +650,13 @@ For example, under Linux the following will install GRUB into the MBR
of the first IDE disk:
@example
@ -203,7 +179,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
But all the above examples assume that GRUB should put images under
@@ -677,7 +677,7 @@ boot floppy with a filesystem. Here is an example:
@@ -670,7 +670,7 @@ boot floppy with a filesystem. Here is an example:
# @kbd{mke2fs /dev/fd0}
# @kbd{mount -t ext2 /dev/fd0 /mnt}
# @kbd{mkdir /mnt/boot}
@ -212,7 +188,7 @@ index 69f08d289f..0615d0ed97 100644
# @kbd{umount /mnt}
@end group
@end example
@@ -689,30 +689,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
@@ -682,30 +682,37 @@ floppy instead of exposing the USB drive as a hard disk (they call it
@example
# @kbd{losetup /dev/loop0 /dev/sdb1}
# @kbd{mount /dev/loop0 /mnt/usb}
@ -254,7 +230,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
@node Making a GRUB bootable CD-ROM
@@ -732,10 +739,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
@@ -725,10 +732,10 @@ usually also need to include a configuration file @file{grub.cfg} and some
other GRUB modules.
To make a simple generic GRUB rescue CD, you can use the
@ -267,7 +243,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
You will often need to include other files in your image. To do this, first
@@ -758,7 +765,7 @@ directory @file{iso/}.
@@ -751,7 +758,7 @@ directory @file{iso/}.
Finally, make the image:
@example
@ -276,7 +252,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
This produces a file named @file{grub.iso}, which then can be burned
@@ -774,7 +781,7 @@ storage devices.
@@ -767,7 +774,7 @@ storage devices.
@node Device map
@section The map between BIOS drives and OS devices
@ -285,7 +261,7 @@ index 69f08d289f..0615d0ed97 100644
etc.) read it to map BIOS drives to OS devices. This file consists of lines
like this:
@@ -1254,23 +1261,23 @@ need to write the whole thing by hand.
@@ -1269,23 +1276,23 @@ need to write the whole thing by hand.
@node Simple configuration
@section Simple configuration handling
@ -314,7 +290,7 @@ index 69f08d289f..0615d0ed97 100644
valid POSIX shell input; normally, it will just be a sequence of
@samp{KEY=value} lines, but if the value contains spaces or other special
characters then it must be quoted. For example:
@@ -1308,7 +1315,7 @@ works it's not recommended since titles often contain unstable device names
@@ -1323,7 +1330,7 @@ works it's not recommended since titles often contain unstable device names
and may be translated
If you set this to @samp{saved}, then the default menu entry will be that
@ -323,7 +299,7 @@ index 69f08d289f..0615d0ed97 100644
the environment block, which may not be available in all situations
(@pxref{Environment block}).
@@ -1319,7 +1326,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
@@ -1334,7 +1341,7 @@ If this option is set to @samp{true}, then, when an entry is selected, save
it as a new default entry for use by future runs of GRUB. This is only
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
@ -332,7 +308,7 @@ index 69f08d289f..0615d0ed97 100644
This option relies on the environment block, which may not be available in
all situations (@pxref{Environment block}).
@@ -1449,7 +1456,7 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
@@ -1481,15 +1488,15 @@ intel-uc.img intel-ucode.img amd-uc.img amd-ucode.img early_ucode.cpio microcode
@end example
@item GRUB_DISABLE_LINUX_UUID
@ -341,7 +317,17 @@ index 69f08d289f..0615d0ed97 100644
universally-unique identifiers (UUIDs) to identify the root filesystem to
the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
usually more reliable, but in some cases it may not be appropriate. To
@@ -1471,7 +1478,7 @@ If this option is set to @samp{true}, disable the generation of recovery
disable the use of UUIDs, set this option to @samp{true}.
@item GRUB_DISABLE_LINUX_PARTUUID
-If @command{grub-mkconfig} cannot identify the root filesystem via its
-universally-unique indentifier (UUID), @command{grub-mkconfig} can use the UUID
+If @command{grub2-mkconfig} cannot identify the root filesystem via its
+universally-unique indentifier (UUID), @command{grub2-mkconfig} can use the UUID
of the partition containing the filesystem to identify the root filesystem to
the Linux kernel via a @samp{root=PARTUUID=...} kernel parameter. This is not
as reliable as using the filesystem UUID, but is more reliable than using the
@@ -1503,7 +1510,7 @@ If this option is set to @samp{true}, disable the generation of recovery
mode menu entries.
@item GRUB_DISABLE_UUID
@ -350,7 +336,7 @@ index 69f08d289f..0615d0ed97 100644
universally-unique identifiers (UUIDs) to identify various filesystems to
search for files. This is usually more reliable, but in some cases it may
not be appropriate. To disable this use of UUIDs, set this option to
@@ -1482,12 +1489,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
@@ -1514,12 +1521,12 @@ not be appropriate. To disable this use of UUIDs, set this option to
@item GRUB_VIDEO_BACKEND
If graphical video support is required, either because the @samp{gfxterm}
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
@ -366,7 +352,7 @@ index 69f08d289f..0615d0ed97 100644
@item GRUB_GFXMODE
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
@@ -1519,7 +1526,7 @@ boot sequence. If you have problems, set this option to @samp{text} and
@@ -1552,7 +1559,7 @@ boot sequence. If you have problems, set this option to @samp{text} and
GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER
@ -375,7 +361,7 @@ index 69f08d289f..0615d0ed97 100644
@command{os-prober} program, if installed, to discover other operating
systems installed on the same system and generate appropriate menu entries
for them. Set this option to @samp{true} to disable this.
@@ -1529,7 +1536,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober
@@ -1562,7 +1569,7 @@ List of space-separated FS UUIDs of filesystems to be ignored from os-prober
output. For efi chainloaders it's <UUID>@@<EFI FILE>
@item GRUB_DISABLE_SUBMENU
@ -384,7 +370,7 @@ index 69f08d289f..0615d0ed97 100644
the kernel with highest version number and put all other found kernels
or alternative menu entries for recovery mode in submenu. For entries returned
by @command{os-prober} first entry will be put on top level and all others
@@ -1537,11 +1544,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
@@ -1570,11 +1577,11 @@ in submenu. If this option is set to @samp{true}, flat menu with all entries
on top level will be generated instead. Changing this option will require
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
and @samp{default} (@pxref{default}) environment variables as well as saved
@ -399,7 +385,7 @@ index 69f08d289f..0615d0ed97 100644
check for encrypted disks and generate additional commands needed to access
them during boot. Note that in this case unattended boot is not possible
because GRUB will wait for passphrase to unlock encrypted container.
@@ -1600,7 +1607,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
@@ -1633,7 +1640,7 @@ confusing @samp{GRUB_TIMEOUT_STYLE=countdown} or
@end table
@ -408,7 +394,48 @@ index 69f08d289f..0615d0ed97 100644
edit the scripts in @file{/etc/grub.d} directly.
@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
menu entries; simply type the menu entries you want to add at the end of
@@ -1862,7 +1869,7 @@ images as well.
@@ -1641,14 +1648,14 @@ that file, making sure to leave at least the first two lines intact.
@node Root Identifcation Heuristics
@section Root Identifcation Heuristics
-If the target operating system uses the Linux kernel, @command{grub-mkconfig}
+If the target operating system uses the Linux kernel, @command{grub2-mkconfig}
attempts to identify the root file system via a heuristic algoirthm. This
algorithm selects the identification method of the root file system by
considering three factors. The first is if an initrd for the target operating
system is also present. The second is @samp{GRUB_DISABLE_LINUX_UUID} and if set
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
system by its UUID. The third is @samp{GRUB_DISABLE_LINUX_PARTUUID} and if set
-to @samp{true}, prevents @command{grub-mkconfig} from identifying the root file
+to @samp{true}, prevents @command{grub2-mkconfig} from identifying the root file
system via the UUID of its enclosing partition. If the variables are assigned
any other value, that value is considered equivalent to @samp{false}. The
variables are also considered to be set to @samp{false} if they are not set.
@@ -1658,18 +1665,18 @@ filesystem to the initrd. Most initrd images determine the root file system by
checking the Linux kernel's command-line for the @samp{root} key and use its
value as the identification method of the root file system. To improve the
reliability of booting, most initrd images also allow the root file system to be
-identified by its UUID. Because of this behavior, the @command{grub-mkconfig}
+identified by its UUID. Because of this behavior, the @command{grub2-mkconfig}
command will set @samp{root} to @samp{root=UUID=...} to provide the initrd with
the filesystem UUID of the root file system.
If no initrd is detected or @samp{GRUB_DISABLE_LINUX_UUID} is set to @samp{true}
-then @command{grub-command} will identify the root filesystem by setting the
+then @command{grub2-command} will identify the root filesystem by setting the
kernel command-line variable @samp{root} to @samp{root=PARTUUID=...} unless
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true}. If
@samp{GRUB_DISABLE_LINUX_PARTUUID} is also set to @samp{true},
-@command{grub-command} will identify by its Linux device name.
+@command{grub2-command} will identify by its Linux device name.
-The following table summarizes the behavior of the @command{grub-mkconfig}
+The following table summarizes the behavior of the @command{grub2-mkconfig}
command.
@multitable {detected} {GRUB_DISABLE_LINUX_PARTUUID} {GRUB_DISABLE_LINUX_UUID} {Linux Root}
@@ -1898,7 +1905,7 @@ images as well.
Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
install self-compiled latest GRUB with:
@ -417,7 +444,7 @@ index 69f08d289f..0615d0ed97 100644
In all the OSes install GRUB tools but disable installing GRUB in bootsector,
so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
@@ -1872,20 +1879,20 @@ use by setting:
@@ -1908,20 +1915,20 @@ use by setting:
in /etc/default/grub
@ -441,7 +468,7 @@ index 69f08d289f..0615d0ed97 100644
@}
menuentry "Windows XP" @{
@@ -1948,15 +1955,15 @@ GRUB supports embedding a configuration file directly into the core image,
@@ -1984,15 +1991,15 @@ GRUB supports embedding a configuration file directly into the core image,
so that it is loaded before entering normal mode. This is useful, for
example, when it is not straightforward to find the real configuration file,
or when you need to debug problems with loading that file.
@ -460,7 +487,7 @@ index 69f08d289f..0615d0ed97 100644
After the embedded configuration file (if any) is executed, GRUB will load
the @samp{normal} module (@pxref{normal}), which will then read the real
@@ -1991,13 +1998,13 @@ included in the core image:
@@ -2027,13 +2034,13 @@ included in the core image:
@example
@group
search.fs_label grub root
@ -478,7 +505,7 @@ index 69f08d289f..0615d0ed97 100644
else
echo "Could not find an example configuration file!"
fi
@@ -2521,7 +2528,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
@@ -2557,7 +2564,7 @@ grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i38
@end group
@end example
@ -487,7 +514,7 @@ index 69f08d289f..0615d0ed97 100644
server.
The grub.cfg file is placed in the same directory as the path output by
@@ -2715,7 +2722,7 @@ team are:
@@ -2760,7 +2767,7 @@ team are:
@end table
To take full advantage of this function, install GRUB into the MBR
@ -496,7 +523,7 @@ index 69f08d289f..0615d0ed97 100644
If you have a laptop which has a similar feature and not in the above list
could you figure your address and contribute?
@@ -2776,7 +2783,7 @@ bytes.
@@ -2821,7 +2828,7 @@ bytes.
The sole function of @file{boot.img} is to read the first sector of the core
image from a local disk and jump to it. Because of the size restriction,
@file{boot.img} cannot understand any file system structure, so
@ -505,7 +532,7 @@ index 69f08d289f..0615d0ed97 100644
core image into @file{boot.img} when installing GRUB.
@item diskboot.img
@@ -2806,7 +2813,7 @@ images.
@@ -2851,7 +2858,7 @@ images.
@item core.img
This is the core image of GRUB. It is built dynamically from the kernel
@ -514,7 +541,7 @@ index 69f08d289f..0615d0ed97 100644
program. Usually, it contains enough modules to access @file{/boot/grub},
and loads everything else (including menu handling, the ability to load
target operating systems, and so on) from the file system at run-time. The
@@ -2858,7 +2865,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
@@ -2903,7 +2910,7 @@ GRUB 2 has no single Stage 2 image. Instead, it loads modules from
In GRUB 2, images for booting from CD-ROM drives are now constructed using
@file{cdboot.img} and @file{core.img}, making sure that the core image
contains the @samp{iso9660} module. It is usually best to use the
@ -523,7 +550,7 @@ index 69f08d289f..0615d0ed97 100644
@item nbgrub
There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by
@@ -3014,8 +3021,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
@@ -3071,8 +3078,8 @@ There are two ways to specify files, by @dfn{absolute file name} and by
An absolute file name resembles a Unix absolute file name, using
@samp{/} for the directory separator (not @samp{\} as in DOS). One
@ -534,7 +561,7 @@ index 69f08d289f..0615d0ed97 100644
disk. If you omit the device name in an absolute file name, GRUB uses
GRUB's @dfn{root device} implicitly. So if you set the root device to,
say, @samp{(hd1,1)} by the command @samp{set root=(hd1,1)} (@pxref{set}),
@@ -3023,8 +3030,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
@@ -3080,8 +3087,8 @@ then @code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}.
On ZFS filesystem the first path component must be
@var{volume}@samp{@@}[@var{snapshot}].
@ -545,7 +572,7 @@ index 69f08d289f..0615d0ed97 100644
@samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
snapshot name is omitted.
@@ -3427,7 +3434,7 @@ The more recent release of Minix would then be identified as
@@ -3500,7 +3507,7 @@ The more recent release of Minix would then be identified as
@samp{other>minix>minix-3.4.0}.
This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
@ -554,7 +581,7 @@ index 69f08d289f..0615d0ed97 100644
@node fallback
@@ -3517,7 +3524,7 @@ If this variable is set, it names the language code that the
@@ -3590,7 +3597,7 @@ If this variable is set, it names the language code that the
example, French would be named as @samp{fr}, and Simplified Chinese as
@samp{zh_CN}.
@ -563,7 +590,7 @@ index 69f08d289f..0615d0ed97 100644
reasonable default for this variable based on the system locale.
@@ -3525,10 +3532,10 @@ reasonable default for this variable based on the system locale.
@@ -3598,10 +3605,10 @@ reasonable default for this variable based on the system locale.
@subsection locale_dir
If this variable is set, it names the directory where translation files may
@ -576,7 +603,7 @@ index 69f08d289f..0615d0ed97 100644
default for this variable if internationalization is needed and any
translation files are available.
@@ -3646,7 +3653,7 @@ input. The default is not to pause output.
@@ -3738,7 +3745,7 @@ input. The default is not to pause output.
The location of the @samp{/boot/grub} directory as an absolute file name
(@pxref{File name syntax}). This is normally set by GRUB at startup based
@ -585,7 +612,7 @@ index 69f08d289f..0615d0ed97 100644
dynamically loaded from this directory, so it must be set correctly in order
for many parts of GRUB to work.
@@ -3737,17 +3744,17 @@ GRUB provides an ``environment block'' which can be used to save a small
@@ -3850,17 +3857,17 @@ GRUB provides an ``environment block'' which can be used to save a small
amount of state.
The environment block is a preallocated 1024-byte file, which normally lives
@ -605,8 +632,8 @@ index 69f08d289f..0615d0ed97 100644
+@command{grub2-mkconfig} uses this facility to implement
@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
@@ -4476,7 +4483,7 @@ Translate @var{string} into the current language.
@node Modules
@@ -4922,7 +4929,7 @@ Translate @var{string} into the current language.
The current language code is stored in the @samp{lang} variable in GRUB's
environment (@pxref{lang}). Translation files in MO format are read from
@ -615,7 +642,7 @@ index 69f08d289f..0615d0ed97 100644
@end deffn
@@ -4871,7 +4878,7 @@ Define a user named @var{user} with password @var{clear-password}.
@@ -5274,7 +5281,7 @@ Define a user named @var{user} with password @var{clear-password}.
@deffn Command password_pbkdf2 user hashed-password
Define a user named @var{user} with password hash @var{hashed-password}.
@ -624,7 +651,7 @@ index 69f08d289f..0615d0ed97 100644
to generate password hashes. @xref{Security}.
@end deffn
@@ -5814,8 +5821,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
@@ -6400,8 +6407,8 @@ The @samp{password} (@pxref{password}) and @samp{password_pbkdf2}
which has an associated password. @samp{password} sets the password in
plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
sets the password hashed using the Password-Based Key Derivation Function
@ -635,7 +662,7 @@ index 69f08d289f..0615d0ed97 100644
In order to enable authentication support, the @samp{superusers} environment
variable must be set to a list of usernames, separated by any of spaces,
@@ -5860,7 +5867,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@@ -6446,7 +6453,7 @@ menuentry "May be run by user1 or a superuser" --users user1 @{
@end group
@end example
@ -644,11 +671,13 @@ index 69f08d289f..0615d0ed97 100644
generating configuration files with authentication. You can use
@file{/etc/grub.d/40_custom} to add simple superuser authentication, by
adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
@@ -5887,7 +5894,17 @@ may halt or otherwise impact the boot process.
@@ -6472,8 +6479,18 @@ validation fails, then file @file{foo} cannot be opened. This failure
may halt or otherwise impact the boot process.
An initial trusted public key can be embedded within the GRUB @file{core.img}
using the @code{--pubkey} option to @command{grub-install}
-using the @code{--pubkey} option to @command{grub-install}
-(@pxref{Invoking grub-install}).
+using the @code{--pubkey} option to @command{grub2-install}
+(@pxref{Invoking grub2-install}).
+
+@comment Unfortunately --pubkey is not yet supported by grub2-install,
@ -663,7 +692,7 @@ index 69f08d289f..0615d0ed97 100644
GRUB uses GPG-style detached signatures (meaning that a file
@file{foo.sig} will be produced when file @file{foo} is signed), and
@@ -5907,8 +5924,8 @@ gpg --detach-sign /path/to/file
@@ -6493,8 +6510,8 @@ gpg --detach-sign /path/to/file
For successful validation of all of GRUB's subcomponents and the
loaded OS kernel, they must all be signed. One way to accomplish this
is the following (after having already produced the desired
@ -674,7 +703,7 @@ index 69f08d289f..0615d0ed97 100644
@example
@group
@@ -5930,7 +5947,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
@@ -6516,7 +6533,7 @@ See also: @ref{check_signatures}, @ref{verify_detached}, @ref{trust},
Note that internally signature enforcement is controlled by setting
the environment variable @code{check_signatures} equal to
@code{enforce}. Passing one or more @code{--pubkey} options to
@ -683,7 +712,16 @@ index 69f08d289f..0615d0ed97 100644
equal to @code{enforce} in @file{core.img} prior to processing any
configuration files.
@@ -6388,10 +6405,10 @@ Required files are:
@@ -6564,7 +6581,7 @@ UTF-8 strings as comma-separated values (CSV). See
@uref{https://github.com/rhboot/shim/blob/main/SBAT.md} for more details.
To add a data section containing the SBAT information into the binary, the
-@option{--sbat} option of @command{grub-mkimage} command should be used. The content
+@option{--sbat} option of @command{grub2-mkimage} command should be used. The content
of a CSV file, encoded with UTF-8, is copied as is to the .sbat data section into
the generated EFI binary. The CSV file can be stored anywhere on the file system.
@@ -6975,10 +6992,10 @@ Required files are:
GRUB's normal start-up procedure involves setting the @samp{prefix}
environment variable to a value set in the core image by
@ -696,7 +734,7 @@ index 69f08d289f..0615d0ed97 100644
things GRUB is supposed to do.
If, instead, you only get a rescue shell, this usually means that GRUB
@@ -6417,8 +6434,8 @@ normal
@@ -7004,8 +7021,8 @@ normal
However, any problem that leaves you in the rescue shell probably means that
GRUB was not correctly installed. It may be more useful to try to reinstall
@ -707,7 +745,7 @@ index 69f08d289f..0615d0ed97 100644
@itemize @bullet{}
@item
@@ -6430,7 +6447,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
@@ -7017,7 +7034,7 @@ is usually better to use UUIDs or file system labels and avoid depending on
drive ordering entirely.
@item
@ -716,14 +754,34 @@ index 69f08d289f..0615d0ed97 100644
to a partition but GRUB has already been installed in the master boot
record, then the GRUB installation in the partition will be ignored.
@@ -6461,21 +6478,21 @@ entry which claims partition start at block 0. This change will not hamper
bootability on other machines.
@@ -7052,33 +7069,33 @@ bootability on other machines.
@chapter User-space utilities
@menu
-* Invoking grub-install:: How to use the GRUB installer
-* Invoking grub-mkconfig:: Generate a GRUB configuration file
-* Invoking grub-mkpasswd-pbkdf2::
+* Invoking grub2-install:: How to use the GRUB installer
+* Invoking grub2-mkconfig:: Generate a GRUB configuration file
+* Invoking grub2-mkpasswd-pbkdf2::
Generate GRUB password hashes
-* Invoking grub-mkrelpath:: Make system path relative to its root
-* Invoking grub-mkrescue:: Make a GRUB rescue image
-* Invoking grub-mount:: Mount a file system using GRUB
-* Invoking grub-probe:: Probe device information for GRUB
-* Invoking grub-script-check:: Check GRUB script file for syntax errors
+* Invoking grub2-mkrelpath:: Make system path relative to its root
+* Invoking grub2-mkrescue:: Make a GRUB rescue image
+* Invoking grub2-mount:: Mount a file system using GRUB
+* Invoking grub2-probe:: Probe device information for GRUB
+* Invoking grub2-script-check:: Check GRUB script file for syntax errors
@end menu
-@node Invoking grub-install
-@chapter Invoking grub-install
-@section Invoking grub-install
+@node Invoking grub2-install
+@chapter Invoking grub2-install
+@section Invoking grub2-install
-The program @command{grub-install} generates a GRUB core image using
-@command{grub-mkimage} and installs it on your system. You must specify the
@ -744,7 +802,7 @@ index 69f08d289f..0615d0ed97 100644
@table @option
@item --help
@@ -6491,13 +6508,13 @@ separate partition or a removable disk.
@@ -7094,13 +7111,13 @@ separate partition or a removable disk.
If this option is not specified then it defaults to @file{/boot}, so
@example
@ -760,7 +818,7 @@ index 69f08d289f..0615d0ed97 100644
@end example
Here is an example in which you have a separate @dfn{boot} partition which is
@@ -6505,16 +6522,16 @@ mounted on
@@ -7108,16 +7125,16 @@ mounted on
@file{/mnt/boot}:
@example
@ -780,14 +838,14 @@ index 69f08d289f..0615d0ed97 100644
extra space in the bootloader embedding area for Reed-Solomon
error-correcting codes. This enables GRUB to still boot successfully
if some blocks are corrupted. The exact amount of protection offered
@@ -6527,17 +6544,17 @@ installation}) where GRUB does not reside in any unpartitioned space
@@ -7130,17 +7147,17 @@ installation}) where GRUB does not reside in any unpartitioned space
outside of the MBR. Disable the Reed-Solomon codes with this option.
@end table
-@node Invoking grub-mkconfig
-@chapter Invoking grub-mkconfig
-@section Invoking grub-mkconfig
+@node Invoking grub2-mkconfig
+@chapter Invoking grub2-mkconfig
+@section Invoking grub2-mkconfig
-The program @command{grub-mkconfig} generates a configuration file for GRUB
+The program @command{grub2-mkconfig} generates a configuration file for GRUB
@ -795,7 +853,7 @@ index 69f08d289f..0615d0ed97 100644
@example
-grub-mkconfig -o /boot/grub/grub.cfg
+grub-mkconfig -o /boot/grub2/grub.cfg
+grub2-mkconfig -o /boot/grub2/grub.cfg
@end example
-@command{grub-mkconfig} accepts the following options:
@ -803,21 +861,22 @@ index 69f08d289f..0615d0ed97 100644
@table @option
@item --help
@@ -6553,17 +6570,17 @@ it to standard output.
@@ -7156,17 +7173,17 @@ it to standard output.
@end table
-@node Invoking grub-mkpasswd-pbkdf2
-@chapter Invoking grub-mkpasswd-pbkdf2
-@section Invoking grub-mkpasswd-pbkdf2
+@node Invoking grub2-mkpasswd-pbkdf2
+@chapter Invoking grub2-mkpasswd-pbkdf2
+@section Invoking grub2-mkpasswd-pbkdf2
-The program @command{grub-mkpasswd-pbkdf2} generates password hashes for
+The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for
GRUB (@pxref{Security}).
@example
grub-mkpasswd-pbkdf2
-grub-mkpasswd-pbkdf2
+grub2-mkpasswd-pbkdf2
@end example
-@command{grub-mkpasswd-pbkdf2} accepts the following options:
@ -825,14 +884,14 @@ index 69f08d289f..0615d0ed97 100644
@table @option
@item -c @var{number}
@@ -6581,23 +6598,23 @@ Length of the salt. Defaults to 64.
@@ -7184,23 +7201,23 @@ Length of the salt. Defaults to 64.
@end table
-@node Invoking grub-mkrelpath
-@chapter Invoking grub-mkrelpath
-@section Invoking grub-mkrelpath
+@node Invoking grub2-mkrelpath
+@chapter Invoking grub2-mkrelpath
+@section Invoking grub2-mkrelpath
-The program @command{grub-mkrelpath} makes a file system path relative to
+The program @command{grub2-mkrelpath} makes a file system path relative to
@ -855,21 +914,22 @@ index 69f08d289f..0615d0ed97 100644
@table @option
@item --help
@@ -6608,17 +6625,17 @@ Print the version number of GRUB and exit.
@@ -7211,17 +7228,17 @@ Print the version number of GRUB and exit.
@end table
-@node Invoking grub-mkrescue
-@chapter Invoking grub-mkrescue
-@section Invoking grub-mkrescue
+@node Invoking grub2-mkrescue
+@chapter Invoking grub2-mkrescue
+@section Invoking grub2-mkrescue
-The program @command{grub-mkrescue} generates a bootable GRUB rescue image
+The program @command{grub2-mkrescue} generates a bootable GRUB rescue image
(@pxref{Making a GRUB bootable CD-ROM}).
@example
grub-mkrescue -o grub.iso
-grub-mkrescue -o grub.iso
+grub2-mkrescue -o grub.iso
@end example
-All arguments not explicitly listed as @command{grub-mkrescue} options are
@ -877,8 +937,12 @@ index 69f08d289f..0615d0ed97 100644
passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
Options passed to @command{xorriso} will normally be interpreted as
@command{mkisofs} options; if the option @samp{--} is used, then anything
@@ -6633,7 +6650,7 @@ mkdir -p disk/boot/grub
grub-mkrescue -o grub.iso disk
@@ -7233,10 +7250,10 @@ commonly used to add extra files to the image:
@example
mkdir -p disk/boot/grub
@r{(add extra files to @file{disk/boot/grub})}
-grub-mkrescue -o grub.iso disk
+grub2-mkrescue -o grub.iso disk
@end example
-@command{grub-mkrescue} accepts the following options:
@ -886,7 +950,7 @@ index 69f08d289f..0615d0ed97 100644
@table @option
@item --help
@@ -6661,15 +6678,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
@@ -7264,15 +7281,15 @@ Use @var{file} as the @command{xorriso} program, rather than the built-in
default.
@item --grub-mkimage=@var{file}
@ -897,16 +961,16 @@ index 69f08d289f..0615d0ed97 100644
-@node Invoking grub-mount
-@chapter Invoking grub-mount
-@section Invoking grub-mount
+@node Invoking grub2-mount
+@chapter Invoking grub2-mount
+@section Invoking grub2-mount
-The program @command{grub-mount} performs a read-only mount of any file
+The program @command{grub2-mount} performs a read-only mount of any file
system or file system image that GRUB understands, using GRUB's file system
drivers via FUSE. (It is only available if FUSE development files were
present when GRUB was built.) This has a number of uses:
@@ -6701,13 +6718,13 @@ even if nobody has yet written a FUSE module specifically for that file
@@ -7304,13 +7321,13 @@ even if nobody has yet written a FUSE module specifically for that file
system type.
@end itemize
@ -914,7 +978,8 @@ index 69f08d289f..0615d0ed97 100644
+Using @command{grub2-mount} is normally as simple as:
@example
grub-mount /dev/sda1 /mnt
-grub-mount /dev/sda1 /mnt
+grub2-mount /dev/sda1 /mnt
@end example
-@command{grub-mount} must be given one or more images and a mount point as
@ -922,7 +987,7 @@ index 69f08d289f..0615d0ed97 100644
non-option arguments (if it is given more than one image, it will treat them
as a RAID set), and also accepts the following options:
@@ -6729,13 +6746,13 @@ Show debugging output for conditions matching @var{string}.
@@ -7332,13 +7349,13 @@ Show debugging output for conditions matching @var{string}.
@item -K prompt|@var{file}
@itemx --zfs-key=prompt|@var{file}
Load a ZFS encryption key. If you use @samp{prompt} as the argument,
@ -938,22 +1003,33 @@ index 69f08d289f..0615d0ed97 100644
root of the supplied file system.
If @var{device} is just a number, then it will be treated as a partition
@@ -6753,10 +6770,10 @@ Print verbose messages.
@@ -7347,7 +7364,7 @@ an entire disk in @file{disk.img}, then you can use this command to mount
its second partition:
@example
-grub-mount -r 2 disk.img mount-point
+grub2-mount -r 2 disk.img mount-point
@end example
@item -v
@@ -7356,18 +7373,18 @@ Print verbose messages.
@end table
-@node Invoking grub-probe
-@chapter Invoking grub-probe
-@section Invoking grub-probe
+@node Invoking grub2-probe
+@chapter Invoking grub2-probe
+@section Invoking grub2-probe
-The program @command{grub-probe} probes device information for a given path
+The program @command{grub2-probe} probes device information for a given path
or device.
@example
@@ -6764,7 +6781,7 @@ grub-probe --target=fs /boot/grub
grub-probe --target=drive --device /dev/sda1
-grub-probe --target=fs /boot/grub
-grub-probe --target=drive --device /dev/sda1
+grub2-probe --target=fs /boot/grub
+grub2-probe --target=drive --device /dev/sda1
@end example
-@command{grub-probe} must be given a path or device as a non-option
@ -961,7 +1037,7 @@ index 69f08d289f..0615d0ed97 100644
argument, and also accepts the following options:
@table @option
@@ -6777,16 +6794,16 @@ Print the version number of GRUB and exit.
@@ -7380,16 +7397,16 @@ Print the version number of GRUB and exit.
@item -d
@itemx --device
If this option is given, then the non-option argument is a system device
@ -981,14 +1057,14 @@ index 69f08d289f..0615d0ed97 100644
@item -t @var{target}
@itemx --target=@var{target}
@@ -6839,19 +6856,19 @@ Print verbose messages.
@@ -7442,19 +7459,19 @@ Print verbose messages.
@end table
-@node Invoking grub-script-check
-@chapter Invoking grub-script-check
-@section Invoking grub-script-check
+@node Invoking grub2-script-check
+@chapter Invoking grub2-script-check
+@section Invoking grub2-script-check
-The program @command{grub-script-check} takes a GRUB script file
+The program @command{grub2-script-check} takes a GRUB script file
@ -998,7 +1074,7 @@ index 69f08d289f..0615d0ed97 100644
@example
-grub-script-check /boot/grub/grub.cfg
+grub-script-check /boot/grub2/grub.cfg
+grub2-script-check /boot/grub2/grub.cfg
@end example
-@command{grub-script-check} accepts the following options:

View file

@ -20,7 +20,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 18 insertions(+), 60 deletions(-)
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 1b91c102f3..4b27bd2015 100644
index f300e46fc6a..d7d423b2eaf 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -42,68 +42,25 @@ if [ -z "${OSPROBED}" ] ; then
@ -104,7 +104,7 @@ index 1b91c102f3..4b27bd2015 100644
}
EOF
}
@@ -292,11 +249,12 @@ EOF
@@ -296,11 +253,12 @@ EOF
echo "$title_correction_code"
;;
macosx)

View file

@ -19,12 +19,12 @@ variable and loading the config file from the subvolume.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
grub-core/fs/btrfs.c | 552 +++++++++++++++++++++++++++++++++++++++++++++++++--
grub-core/fs/btrfs.c | 558 ++++++++++++++++++++++++++++++++++++++++++++++++---
include/grub/btrfs.h | 1 +
2 files changed, 533 insertions(+), 20 deletions(-)
2 files changed, 536 insertions(+), 23 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 63203034df..f1fff7385b 100644
index ba0c583526d..f14fe9c1bda 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -38,6 +38,9 @@
@ -89,7 +89,7 @@ index 63203034df..f1fff7385b 100644
static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2,
256 * 1048576 * 2, 1048576ULL * 1048576ULL * 2
};
@@ -1173,6 +1195,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
@@ -1252,6 +1274,62 @@ grub_btrfs_read_logical (struct grub_btrfs_data *data, grub_disk_addr_t addr,
return GRUB_ERR_NONE;
}
@ -152,7 +152,7 @@ index 63203034df..f1fff7385b 100644
static struct grub_btrfs_data *
grub_btrfs_mount (grub_device_t dev)
{
@@ -1208,6 +1286,13 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1287,6 +1365,13 @@ grub_btrfs_mount (grub_device_t dev)
data->devices_attached[0].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -166,7 +166,7 @@ index 63203034df..f1fff7385b 100644
return data;
}
@@ -1673,6 +1758,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
@@ -1784,6 +1869,91 @@ get_root (struct grub_btrfs_data *data, struct grub_btrfs_key *key,
return GRUB_ERR_NONE;
}
@ -258,7 +258,7 @@ index 63203034df..f1fff7385b 100644
static grub_err_t
find_path (struct grub_btrfs_data *data,
const char *path, struct grub_btrfs_key *key,
@@ -1691,14 +1861,26 @@ find_path (struct grub_btrfs_data *data,
@@ -1802,14 +1972,26 @@ find_path (struct grub_btrfs_data *data,
char *origpath = NULL;
unsigned symlinks_max = 32;
@ -289,15 +289,18 @@ index 63203034df..f1fff7385b 100644
while (1)
{
while (path[0] == '/')
@@ -1871,9 +2053,21 @@ find_path (struct grub_btrfs_data *data,
@@ -1982,13 +2164,25 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
- err = get_root (data, key, tree, type);
- if (err)
- return err;
+ if (data->fs_tree)
+ {
{
- grub_free (direl);
- grub_free (path_alloc);
- grub_free (origpath);
- return err;
+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
+ *tree = data->fs_tree;
+ /* This is a tree root, so everything starts at objectid 256 */
@ -309,12 +312,16 @@ index 63203034df..f1fff7385b 100644
+ {
+ err = get_root (data, key, tree, type);
+ if (err)
+ return err;
+ }
+ {
+ grub_free (direl);
+ grub_free (path_alloc);
+ grub_free (origpath);
+ return err;
+ }
}
}
continue;
}
@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
@@ -2256,18 +2450,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
data->tree, file->offset, buf, len);
}
@ -336,7 +343,7 @@ index 63203034df..f1fff7385b 100644
grub_be_to_cpu16 (data->sblock.uuid[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]),
@@ -2134,6 +2320,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
@@ -2276,6 +2462,20 @@ grub_btrfs_uuid (grub_device_t device, char **uuid)
grub_be_to_cpu16 (data->sblock.uuid[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]),
grub_be_to_cpu16 (data->sblock.uuid[7]));
@ -357,7 +364,7 @@ index 63203034df..f1fff7385b 100644
grub_btrfs_unmount (data);
@@ -2190,6 +2390,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
@@ -2396,6 +2596,242 @@ grub_btrfs_embed (grub_device_t device __attribute__ ((unused)),
}
#endif
@ -600,7 +607,7 @@ index 63203034df..f1fff7385b 100644
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.fs_dir = grub_btrfs_dir,
@@ -2205,12 +2641,88 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2411,12 +2847,88 @@ static struct grub_fs grub_btrfs_fs = {
#endif
};
@ -690,7 +697,7 @@ index 63203034df..f1fff7385b 100644
+
+// vim: si et sw=2:
diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h
index 9d93fb6c18..234ad97677 100644
index 9d93fb6c182..234ad976771 100644
--- a/include/grub/btrfs.h
+++ b/include/grub/btrfs.h
@@ -29,6 +29,7 @@ enum

View file

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 8 Jan 2024 15:41:52 -0500
Subject: [PATCH] btrfs: fix a bad null check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
current gcc complains:
grub-core/fs/btrfs.c: In function grub_cmd_btrfs_info:
grub-core/fs/btrfs.c:2745:7: error: the comparison will always evaluate as true for the address of label will never be NULL [-Werror=address]
2745 | if (data->sblock.label)
| ^~~~
grub-core/fs/btrfs.c:92:8: note: label declared here
92 | char label[0x100];
| ^~~~~
cc1: all warnings being treated as errors
Obviously this check should be on the first data byte instead of the
symbol itself.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/fs/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index f14fe9c1bda..8e2b1e9f7bc 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2625,7 +2625,7 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
return grub_error (GRUB_ERR_BAD_ARGUMENT, "failed to open fs");
}
- if (data->sblock.label)
+ if (data->sblock.label[0])
grub_printf("Label: '%s' ", data->sblock.label);
else
grub_printf("Label: none ");

View file

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Masahiro Matsuya <mmatsuya@redhat.com>
Date: Sat, 29 Oct 2016 08:35:26 +0900
Subject: [PATCH] bz1374141 fix incorrect mask for ppc64
The netmask configured in firmware is not respected on ppc64 (big endian).
When 255.255.252.0 is set as netmask in firmware, the following is the value of bootpath string in grub_ieee1275_parse_bootpath().
/vdevice/l-lan@30000002:speed=auto,duplex=auto,192.168.88.10,,192.168.89.113,192.168.88.1,5,5,255.255.252.0,512
The netmask in this bootpath is no problem, since it's a value specified in firmware. But,
The value of 'subnet_mask.ipv4' was set with 0xfffffc00, and __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)) returned 16 (not 22).
As a result, 16 was used for netmask wrongly.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 0000 0011 0000 0000 0000 0000 # ~grub_le_to_cpu32 (subnet_mask.ipv4)
And, the count of zero with __builtin_ctz can be 16.
This patch changes it as below.
1111 1111 1111 1111 1111 1100 0000 0000 # subnet_mask.ipv4 (=0xfffffc00)
0000 0000 1111 1100 1111 1111 1111 1111 # grub_le_to_cpu32 (subnet_mask.ipv4)
1111 1111 1111 1111 1111 1100 0000 0000 # grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
0000 0000 0000 0000 0000 0011 1111 1111 # ~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))
The count of zero with __builtin_clz can be 22. (clz counts the number of one bits preceding the most significant zero bit)
Signed-off-by: Masahiro Matsuya <mmatsuya@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/net/drivers/ieee1275/ofnet.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index ac4e62a95c..3860b6f78d 100644
--- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
@@ -220,8 +220,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
flags);
inter->vlantag = vlantag;
grub_net_add_ipv4_local (inter,
- __builtin_ctz (~grub_le_to_cpu32 (subnet_mask.ipv4)));
-
+ __builtin_clz (~grub_swap_bytes32(grub_le_to_cpu32 (subnet_mask.ipv4))));
}
if (gateway_addr.ipv4 != 0)

View file

@ -12,10 +12,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
1 file changed, 2 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index f1fff7385b..ad1b56b716 100644
index 8e2b1e9f7bc..14e38a4df02 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2714,6 +2714,8 @@ GRUB_MOD_INIT (btrfs)
@@ -2920,6 +2920,8 @@ GRUB_MOD_INIT (btrfs)
subvol_set_env);
grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env,
subvolid_set_env);

View file

@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 76 insertions(+), 31 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index ad1b56b716..113c1f746c 100644
index 14e38a4df02..d47f9ab0352 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1256,6 +1256,7 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1335,6 +1335,7 @@ grub_btrfs_mount (grub_device_t dev)
{
struct grub_btrfs_data *data;
grub_err_t err;
@ -21,7 +21,7 @@ index ad1b56b716..113c1f746c 100644
if (!dev->disk)
{
@@ -1286,11 +1287,14 @@ grub_btrfs_mount (grub_device_t dev)
@@ -1365,11 +1366,14 @@ grub_btrfs_mount (grub_device_t dev)
data->devices_attached[0].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -40,7 +40,7 @@ index ad1b56b716..113c1f746c 100644
}
return data;
@@ -1855,24 +1859,39 @@ find_path (struct grub_btrfs_data *data,
@@ -1966,24 +1970,39 @@ find_path (struct grub_btrfs_data *data,
grub_size_t allocated = 0;
struct grub_btrfs_dir_item *direl = NULL;
struct grub_btrfs_key key_out;
@ -87,7 +87,7 @@ index ad1b56b716..113c1f746c 100644
}
else
{
@@ -1883,15 +1902,23 @@ find_path (struct grub_btrfs_data *data,
@@ -1994,15 +2013,23 @@ find_path (struct grub_btrfs_data *data,
while (1)
{
@ -120,7 +120,7 @@ index ad1b56b716..113c1f746c 100644
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
{
@@ -1902,7 +1929,9 @@ find_path (struct grub_btrfs_data *data,
@@ -2013,7 +2040,9 @@ find_path (struct grub_btrfs_data *data,
if (ctokenlen == 1 && ctoken[0] == '.')
{
@ -131,7 +131,7 @@ index ad1b56b716..113c1f746c 100644
continue;
}
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.')
@@ -1933,8 +1962,9 @@ find_path (struct grub_btrfs_data *data,
@@ -2044,8 +2073,9 @@ find_path (struct grub_btrfs_data *data,
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
key->object_id = key_out.offset;
@ -143,7 +143,7 @@ index ad1b56b716..113c1f746c 100644
continue;
}
@@ -2003,7 +2033,9 @@ find_path (struct grub_btrfs_data *data,
@@ -2114,7 +2144,9 @@ find_path (struct grub_btrfs_data *data,
return err;
}
@ -154,7 +154,7 @@ index ad1b56b716..113c1f746c 100644
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
{
struct grub_btrfs_inode inode;
@@ -2053,14 +2085,26 @@ find_path (struct grub_btrfs_data *data,
@@ -2164,14 +2196,26 @@ find_path (struct grub_btrfs_data *data,
path = path_alloc = tmp;
if (path[0] == '/')
{
@ -188,7 +188,7 @@ index ad1b56b716..113c1f746c 100644
}
else
{
@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs)
@@ -2922,6 +2966,7 @@ GRUB_MOD_INIT (btrfs)
subvolid_set_env);
grub_env_export ("btrfs_subvol");
grub_env_export ("btrfs_subvolid");

View file

@ -9,16 +9,16 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
grub-core/osdep/linux/getroot.c | 7 +++++++
grub-core/osdep/unix/config.c | 17 +++++++++++++++--
util/config.c | 10 ++++++++++
util/grub-install.c | 15 +++++++++++++++
util/grub-install.c | 14 ++++++++++++++
util/grub-mkrelpath.c | 6 ++++++
include/grub/emu/config.h | 1 +
6 files changed, 54 insertions(+), 2 deletions(-)
6 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 001b818fe5..caf9b1ccd3 100644
index 7dd775d2ad9..7c29b3523b4 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -376,6 +376,7 @@ get_btrfs_fs_prefix (const char *mount_path)
@@ -373,6 +373,7 @@ get_btrfs_fs_prefix (const char *mount_path)
return NULL;
}
@ -26,7 +26,7 @@ index 001b818fe5..caf9b1ccd3 100644
char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
@@ -519,6 +520,12 @@ again:
@@ -516,6 +517,12 @@ again:
{
ret = grub_find_root_devices_from_btrfs (dir);
fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path);
@ -40,7 +40,7 @@ index 001b818fe5..caf9b1ccd3 100644
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
{
diff --git a/grub-core/osdep/unix/config.c b/grub-core/osdep/unix/config.c
index 7d6325138c..46a881530c 100644
index 0b1f7618d21..0ce0e309ac0 100644
--- a/grub-core/osdep/unix/config.c
+++ b/grub-core/osdep/unix/config.c
@@ -82,6 +82,19 @@ grub_util_load_config (struct grub_util_config *cfg)
@ -75,7 +75,7 @@ index 7d6325138c..46a881530c 100644
argv[2] = script;
argv[3] = '\0';
diff --git a/util/config.c b/util/config.c
index ebcdd8f5e2..f044a880a7 100644
index ebcdd8f5e22..f044a880a76 100644
--- a/util/config.c
+++ b/util/config.c
@@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple)
@ -96,19 +96,19 @@ index ebcdd8f5e2..f044a880a7 100644
sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0)
{
diff --git a/util/grub-install.c b/util/grub-install.c
index 0fbe7f78c6..0f66f36d23 100644
index 7dc5657bb67..ec3ed49674b 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -827,6 +827,8 @@ fill_core_services (const char *core_services)
free (sysv_plist);
@@ -843,6 +843,8 @@ try_open (const char *path)
}
#endif
+extern int use_relative_path_on_btrfs;
+
int
main (int argc, char *argv[])
{
@@ -860,6 +862,9 @@ main (int argc, char *argv[])
@@ -876,6 +878,9 @@ main (int argc, char *argv[])
grub_util_load_config (&config);
@ -118,11 +118,10 @@ index 0fbe7f78c6..0f66f36d23 100644
if (!bootloader_id && config.grub_distributor)
{
char *ptr;
@@ -1352,6 +1357,16 @@ main (int argc, char *argv[])
fprintf (load_cfg_f, "set debug='%s'\n",
debug_image);
@@ -1366,6 +1371,15 @@ main (int argc, char *argv[])
relative_grubdir = xstrdup ("/");
}
+
+ if (config.is_suse_btrfs_snapshot_enabled
+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0)
+ {
@ -136,7 +135,7 @@ index 0fbe7f78c6..0f66f36d23 100644
char *install_drive = NULL;
diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c
index 47a241a391..5db7a9a7d9 100644
index 47a241a391b..5db7a9a7d97 100644
--- a/util/grub-mkrelpath.c
+++ b/util/grub-mkrelpath.c
@@ -40,9 +40,12 @@ struct arguments
@ -163,7 +162,7 @@ index 47a241a391..5db7a9a7d9 100644
if (state->arg_num == 0)
arguments->pathname = xstrdup (arg);
diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h
index 875d5896ce..c9a7e5f4ad 100644
index 875d5896ce1..c9a7e5f4ade 100644
--- a/include/grub/emu/config.h
+++ b/include/grub/emu/config.h
@@ -37,6 +37,7 @@ struct grub_util_config

View file

@ -13,10 +13,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 005f093809..535c0f0249 100644
index 28e92515795..884e4d363ca 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -252,7 +252,8 @@ export GRUB_DEFAULT \
@@ -256,7 +256,8 @@ export GRUB_DEFAULT \
GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
@ -27,7 +27,7 @@ index 005f093809..535c0f0249 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 0f6505bf3b..5e96f6cc5d 100644
index 33e1750aebb..0ba0e0e1c65 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -49,7 +49,11 @@ grub_warn ()
@ -43,7 +43,7 @@ index 0f6505bf3b..5e96f6cc5d 100644
is_path_readable_by_grub ()
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 858b526c92..de727e6ee6 100644
index c2d8b093762..3e1b77265db 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
@ -90,10 +90,10 @@ index 858b526c92..de727e6ee6 100644
+EOF
+fi
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 292e333324..7bb3a211a7 100644
index e8ab4082f87..48ff32c1da4 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -66,10 +66,14 @@ fi
@@ -68,10 +68,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)
@ -109,10 +109,10 @@ index 292e333324..7bb3a211a7 100644
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index ada20775a1..e9e73b815f 100644
index 98ee5bc58dc..efcded0fbb4 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -73,10 +73,14 @@ fi
@@ -75,10 +75,14 @@ fi
case x"$GRUB_FS" in
xbtrfs)

View file

@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 392 insertions(+), 5 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 113c1f746c..d323746ecf 100644
index d47f9ab0352..d44a1c73b8a 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -41,6 +41,7 @@
@ -37,7 +37,7 @@ index 113c1f746c..d323746ecf 100644
static grub_err_t
read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb)
@@ -1223,9 +1230,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1302,9 +1309,26 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
grub_err_t err;
grub_uint64_t tree = 0;
grub_uint8_t type;
@ -64,10 +64,10 @@ index 113c1f746c..d323746ecf 100644
if (err)
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path);
@@ -2199,11 +2223,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
int r = 0;
@@ -2316,11 +2340,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
grub_uint64_t tree;
grub_uint8_t type;
grub_size_t est_size = 0;
+ char *new_path = NULL;
if (!data)
@ -86,7 +86,7 @@ index 113c1f746c..d323746ecf 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -2305,11 +2338,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
@@ -2447,11 +2480,21 @@ grub_btrfs_open (struct grub_file *file, const char *name)
struct grub_btrfs_inode inode;
grub_uint8_t type;
struct grub_btrfs_key key_in;
@ -109,7 +109,7 @@ index 113c1f746c..d323746ecf 100644
if (err)
{
grub_btrfs_unmount (data);
@@ -2480,6 +2523,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
@@ -2686,6 +2729,150 @@ grub_cmd_btrfs_info (grub_command_t cmd __attribute__ ((unused)), int argc,
return 0;
}
@ -260,7 +260,7 @@ index 113c1f746c..d323746ecf 100644
static grub_err_t
get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree,
grub_uint64_t objectid, grub_uint64_t offset,
@@ -2686,6 +2873,7 @@ static struct grub_fs grub_btrfs_fs = {
@@ -2892,6 +3079,7 @@ static struct grub_fs grub_btrfs_fs = {
};
static grub_command_t cmd_info;
@ -268,7 +268,7 @@ index 113c1f746c..d323746ecf 100644
static grub_extcmd_t cmd_list_subvols;
static char *
@@ -2749,6 +2937,9 @@ GRUB_MOD_INIT (btrfs)
@@ -2955,6 +3143,9 @@ GRUB_MOD_INIT (btrfs)
cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
"DEVICE",
"Print BtrFS info about DEVICE.");
@ -279,10 +279,10 @@ index 113c1f746c..d323746ecf 100644
grub_cmd_btrfs_list_subvols, 0,
"[-p|-n] [-o var] DEVICE",
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index caf9b1ccd3..28790307e0 100644
index 7c29b3523b4..74a48c03026 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -107,6 +107,14 @@ struct btrfs_ioctl_search_key
@@ -103,6 +103,14 @@ struct btrfs_ioctl_search_key
grub_uint32_t unused[9];
};
@ -297,7 +297,7 @@ index caf9b1ccd3..28790307e0 100644
struct btrfs_ioctl_search_args {
struct btrfs_ioctl_search_key key;
grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_key))
@@ -378,6 +386,109 @@ get_btrfs_fs_prefix (const char *mount_path)
@@ -375,6 +383,109 @@ get_btrfs_fs_prefix (const char *mount_path)
int use_relative_path_on_btrfs = 0;
@ -407,7 +407,7 @@ index caf9b1ccd3..28790307e0 100644
char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot)
{
@@ -519,12 +630,15 @@ again:
@@ -516,12 +627,15 @@ again:
else if (grub_strcmp (entries[i].fstype, "btrfs") == 0)
{
ret = grub_find_root_devices_from_btrfs (dir);
@ -426,7 +426,7 @@ index caf9b1ccd3..28790307e0 100644
}
}
else if (!retry && grub_strcmp (entries[i].fstype, "autofs") == 0)
@@ -1150,6 +1264,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
@@ -1147,6 +1261,34 @@ grub_util_get_grub_dev_os (const char *os_dev)
return grub_dev;
}
@ -462,10 +462,10 @@ index caf9b1ccd3..28790307e0 100644
grub_make_system_path_relative_to_its_root_os (const char *path)
{
diff --git a/util/grub-install.c b/util/grub-install.c
index 0f66f36d23..84ed6e88ec 100644
index ec3ed49674b..d3ec2570d1d 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1569,6 +1569,55 @@ main (int argc, char *argv[])
@@ -1615,6 +1615,55 @@ main (int argc, char *argv[])
prefix_drive = xasprintf ("(%s)", grub_drives[0]);
}
@ -522,7 +522,7 @@ index 0f66f36d23..84ed6e88ec 100644
const char *core_name = NULL;
diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h
index 73fa2d34ab..9c642ae3fe 100644
index 73fa2d34abb..9c642ae3fe3 100644
--- a/include/grub/emu/getroot.h
+++ b/include/grub/emu/getroot.h
@@ -53,6 +53,11 @@ char **

View file

@ -10,10 +10,10 @@ Ref: bsc#953538
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index d323746ecf..673ded0352 100644
index d44a1c73b8a..dba86d19b1a 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -1260,11 +1260,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
@@ -1339,11 +1339,41 @@ lookup_root_by_name(struct grub_btrfs_data *data, const char *path)
return GRUB_ERR_NONE;
}

View file

@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 238 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 673ded0352..2b21cbaa67 100644
index dba86d19b1a..87e4dd1a07a 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -2887,6 +2887,238 @@ out:
@@ -3093,6 +3093,238 @@ out:
return 0;
}
@ -252,7 +252,7 @@ index 673ded0352..2b21cbaa67 100644
static struct grub_fs grub_btrfs_fs = {
.name = "btrfs",
.fs_dir = grub_btrfs_dir,
@@ -2905,6 +3137,7 @@ static struct grub_fs grub_btrfs_fs = {
@@ -3111,6 +3343,7 @@ static struct grub_fs grub_btrfs_fs = {
static grub_command_t cmd_info;
static grub_command_t cmd_mount_subvol;
static grub_extcmd_t cmd_list_subvols;
@ -260,7 +260,7 @@ index 673ded0352..2b21cbaa67 100644
static char *
subvolid_set_env (struct grub_env_var *var __attribute__ ((unused)),
@@ -2975,6 +3208,11 @@ GRUB_MOD_INIT (btrfs)
@@ -3181,6 +3414,11 @@ GRUB_MOD_INIT (btrfs)
"[-p|-n] [-o var] DEVICE",
"Print list of BtrFS subvolumes on "
"DEVICE.", options);

View file

@ -10,21 +10,21 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 585fa6662b..03f9a9d011 100644
index a5cd99e5afa..8d98203a784 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -24,6 +24,10 @@
#include <grub/dl.h>
#include <grub/efi/api.h>
@@ -36,6 +36,10 @@ struct linux_arch_kernel_header {
struct grub_pe_image_header pe_image_header;
};
+/* Variables. */
+extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
+extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
+
/* Functions. */
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol,
void *registration);
@@ -60,6 +64,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
@@ -71,6 +75,33 @@ EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
void grub_efi_memory_fini (void);
@ -39,7 +39,7 @@ index 585fa6662b..03f9a9d011 100644
+ grub_efi_status_t status;
+
+ b = grub_efi_system_table->boot_services;
+ status = efi_call_3 (b->allocate_pool, pool_type, buffer_size, buffer);
+ status = b->allocate_pool(pool_type, buffer_size, buffer);
+ return status;
+}
+
@ -51,14 +51,14 @@ index 585fa6662b..03f9a9d011 100644
+ grub_efi_status_t status;
+
+ b = grub_efi_system_table->boot_services;
+ status = efi_call_1 (b->free_pool, buffer);
+ status = b->free_pool(buffer);
+ return status;
+}
+
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
@@ -115,10 +146,7 @@ void grub_efi_init (void);
@@ -140,10 +171,7 @@ void grub_efi_init (void);
void grub_efi_fini (void);
void grub_efi_set_prefix (void);

View file

@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:06:38 -0400
Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable.
This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and
grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we
get more reasonable type checking.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 1de98f78313..2036924504b 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -95,7 +95,7 @@ grub_chainloader_boot (void *context)
}
if (exit_data)
- b->free_pool (exit_data);
+ grub_efi_free_pool (exit_data);
grub_loader_unset ();
@@ -419,7 +419,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
grub_free (file_path);
if (address)
- b->free_pages (address, pages);
+ grub_efi_free_pages (address, pages);
if (image_handle != NULL)
b->unload_image (image_handle);

View file

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:07:50 -0400
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
This avoids syntax checkers getting confused about if it's llx or lx.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
include/grub/efi/api.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index c1b869db520..daa9268fdaa 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -577,7 +577,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
typedef grub_uint8_t grub_efi_char8_t;
typedef grub_uint16_t grub_efi_char16_t;
+
typedef grub_efi_uintn_t grub_efi_status_t;
+/* Make grub_efi_status_t reasonably printable. */
+#if GRUB_CPU_SIZEOF_VOID_P == 8
+#define PRIxGRUB_EFI_STATUS "lx"
+#define PRIdGRUB_EFI_STATUS "ld"
+#else
+#define PRIxGRUB_EFI_STATUS "llx"
+#define PRIdGRUB_EFI_STATUS "lld"
+#endif
/*
* On x86, the EFI calling convention may deviate from the local one, so

View file

@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index 05d8237a9b..ae9885edb8 100644
index 885d7c6420e..2bb8a0e7a38 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -167,7 +167,7 @@ grub_reboot (void)
@@ -177,7 +177,7 @@ grub_reboot (void)
void
grub_exit (int retval)
{

View file

@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes.
1 file changed, 2 insertions(+)
diff --git a/include/grub/dl.h b/include/grub/dl.h
index b3753c9ca2..91933b85f2 100644
index cd1f46c8bad..f2bf50eb98d 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -54,6 +54,7 @@ grub_mod_fini (void)

View file

@ -16,10 +16,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index 84ed6e88ec..a2bec7446c 100644
index d3ec2570d1d..66ef9494d9d 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -1190,18 +1190,8 @@ main (int argc, char *argv[])
@@ -1234,18 +1234,8 @@ main (int argc, char *argv[])
char *d;
is_guess = 1;

View file

@ -1,106 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:06:38 -0400
Subject: [PATCH] Use grub_efi_...() memory helpers where reasonable.
This uses grub_efi_allocate_pool(), grub_efi_free_pool(), and
grub_efi_free_pages() instead of open-coded efi_call_N() calls, so we
get more reasonable type checking.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 07c4937898..89ac84cc66 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -65,7 +65,7 @@ grub_chainloader_unload (void)
b = grub_efi_system_table->boot_services;
efi_call_1 (b->unload_image, image_handle);
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
grub_free (file_path);
grub_free (cmdline);
@@ -108,7 +108,7 @@ grub_chainloader_boot (void)
}
if (exit_data)
- efi_call_1 (b->free_pool, exit_data);
+ grub_efi_free_pool (exit_data);
grub_loader_unset ();
@@ -527,10 +527,9 @@ grub_efi_get_media_file_path (grub_efi_device_path_t *dp)
static grub_efi_boolean_t
handle_image (void *data, grub_efi_uint32_t datasize)
{
- grub_efi_boot_services_t *b;
grub_efi_loaded_image_t *li, li_bak;
grub_efi_status_t efi_status;
- char *buffer = NULL;
+ void *buffer = NULL;
char *buffer_aligned = NULL;
grub_efi_uint32_t i;
struct grub_pe32_section_table *section;
@@ -541,8 +540,6 @@ handle_image (void *data, grub_efi_uint32_t datasize)
int found_entry_point = 0;
int rc;
- b = grub_efi_system_table->boot_services;
-
rc = read_header (data, datasize, &context);
if (rc < 0)
{
@@ -582,8 +579,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
grub_dprintf ("chain", "image size is %08"PRIxGRUB_UINT64_T", datasize is %08x\n",
context.image_size, datasize);
- efi_status = efi_call_3 (b->allocate_pool, GRUB_EFI_LOADER_DATA,
- buffer_size, &buffer);
+ efi_status = grub_efi_allocate_pool (GRUB_EFI_LOADER_DATA, buffer_size,
+ &buffer);
if (efi_status != GRUB_EFI_SUCCESS)
{
@@ -815,14 +812,14 @@ handle_image (void *data, grub_efi_uint32_t datasize)
grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
- efi_status = efi_call_1 (b->free_pool, buffer);
+ efi_status = grub_efi_free_pool (buffer);
return 1;
error_exit:
grub_dprintf ("chain", "error_exit: grub_errno: %d\n", grub_errno);
if (buffer)
- efi_call_1 (b->free_pool, buffer);
+ grub_efi_free_pool (buffer);
return 0;
}
@@ -830,10 +827,7 @@ error_exit:
static grub_err_t
grub_secureboot_chainloader_unload (void)
{
- grub_efi_boot_services_t *b;
-
- b = grub_efi_system_table->boot_services;
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
grub_free (file_path);
grub_free (cmdline);
cmdline = 0;
@@ -1100,7 +1094,7 @@ fail:
grub_free (file_path);
if (address)
- efi_call_2 (b->free_pages, address, pages);
+ grub_efi_free_pages (address, pages);
if (cmdline)
grub_free (cmdline);

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 5 insertions(+)
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index e9e73b815f..c23b064be6 100644
index efcded0fbb4..4ecf5deea17 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -153,6 +153,7 @@ linux_entry_xsm ()
@@ -156,6 +156,7 @@ linux_entry_xsm ()
else
xen_rm_opts="no-real-mode edd=off"
fi
@ -20,15 +20,15 @@ index e9e73b815f..c23b064be6 100644
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
@@ -166,6 +167,7 @@ EOF
done
sed "s/^/$submenu_indentation/" << EOF
@@ -168,6 +169,7 @@ EOF
initrd_path="${rel_dirname}/${i}"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
+ insmod ${xen_module}
${module_loader} --nounzip $(echo $initrd_path)
EOF
fi
@@ -253,13 +255,16 @@ while [ "x${xen_list}" != "x" ] ; do
done
@@ -269,13 +271,16 @@ for current_xen in ${reverse_sorted_xen_list}; do
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
fi
if ($grub_file --is-arm64-efi $current_xen); then

View file

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 1 Jun 2017 10:07:50 -0400
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
This avoids syntax checkers getting confused about if it's llx or lx.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/loader/efi/chainloader.c | 3 ++-
include/grub/efi/api.h | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
index 89ac84cc66..ac8dfd40c6 100644
--- a/grub-core/loader/efi/chainloader.c
+++ b/grub-core/loader/efi/chainloader.c
@@ -810,7 +810,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
grub_efi_system_table);
- grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
+ grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n",
+ efi_status);
grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
efi_status = grub_efi_free_pool (buffer);
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 117469450d..9962880147 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
typedef grub_uint8_t grub_efi_char8_t;
typedef grub_uint16_t grub_efi_char16_t;
+
typedef grub_efi_uintn_t grub_efi_status_t;
+/* Make grub_efi_status_t reasonably printable. */
+#if GRUB_CPU_SIZEOF_VOID_P == 8
+#define PRIxGRUB_EFI_STATUS "lx"
+#define PRIdGRUB_EFI_STATUS "ld"
+#else
+#define PRIxGRUB_EFI_STATUS "llx"
+#define PRIdGRUB_EFI_STATUS "lld"
+#endif
#define GRUB_EFI_ERROR_CODE(value) \
((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value))

View file

@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better...
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
index 36d2dedf47..9d93ba88ba 100644
index 2ff42984545..6363fd522e1 100644
--- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h
@@ -33,5 +33,5 @@ struct efi_variable
@ -20,10 +20,10 @@ index 36d2dedf47..9d93ba88ba 100644
+} GRUB_PACKED GRUB_ALIGNED(8);
#endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */
diff --git a/include/grub/types.h b/include/grub/types.h
index 0a3ff15913..ba446d9904 100644
index 064066e2e18..59e030268c2 100644
--- a/include/grub/types.h
+++ b/include/grub/types.h
@@ -29,6 +29,7 @@
@@ -30,6 +30,7 @@
#else
#define GRUB_PACKED __attribute__ ((packed))
#endif

View file

@ -33,7 +33,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
3 files changed, 243 insertions(+), 6 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 535c0f0249..f55339a3f6 100644
index 884e4d363ca..bec52e052fc 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
@ -63,7 +63,7 @@ index 535c0f0249..f55339a3f6 100644
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
@@ -253,7 +259,8 @@ export GRUB_DEFAULT \
@@ -257,7 +263,8 @@ export GRUB_DEFAULT \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
GRUB_DEFAULT_DTB \
@ -74,7 +74,7 @@ index 535c0f0249..f55339a3f6 100644
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 5e96f6cc5d..301d8a8a1e 100644
index 0ba0e0e1c65..c2e107b41ab 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -30,6 +30,9 @@ fi
@ -131,10 +131,10 @@ index 5e96f6cc5d..301d8a8a1e 100644
fi
IFS="$old_ifs"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 7bb3a211a7..2851952659 100644
index 48ff32c1da4..cd9aea0cc01 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -82,6 +82,218 @@ case x"$GRUB_FS" in
@@ -84,6 +84,218 @@ case x"$GRUB_FS" in
;;
esac
@ -353,7 +353,7 @@ index 7bb3a211a7..2851952659 100644
mktitle ()
{
local title_type
@@ -121,6 +333,7 @@ linux_entry ()
@@ -123,6 +335,7 @@ linux_entry ()
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
@ -361,15 +361,15 @@ index 7bb3a211a7..2851952659 100644
if [ x$type != xsimple ] ; then
title=$(mktitle "$type" "$version")
if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
@@ -231,6 +444,7 @@ is_top_level=true
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
@@ -243,6 +456,7 @@ fi
is_top_level=true
for linux in ${reverse_sorted_list}; do
gettext_printf "Found linux image: %s\n" "$linux" >&2
+
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
@@ -269,7 +483,9 @@ while [ "x$list" != "x" ] ; do
@@ -283,7 +497,9 @@ for linux in ${reverse_sorted_list}; do
for i in ${initrd}; do
initrd_display="${initrd_display} ${dirname}/${i}"
done

View file

@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index a3e215155b..c60601b699 100644
index 465a8e74ea7..b1d399d37d7 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1201,7 +1201,7 @@ static void __attribute__ ((noreturn))
@@ -1303,7 +1303,7 @@ void __attribute__ ((noreturn))
grub_abort (void)
{
#ifndef GRUB_UTIL

View file

@ -20,10 +20,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 util/grub-switch-to-blscfg.in
diff --git a/Makefile.util.def b/Makefile.util.def
index 18a9242776..88f55e35c4 100644
index 84a17ef5cfa..acbcc8c208c 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -1348,6 +1348,13 @@ program = {
@@ -1387,6 +1387,13 @@ program = {
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -39,14 +39,14 @@ index 18a9242776..88f55e35c4 100644
mansection = 1;
diff --git a/docs/man/grub-switch-to-blscfg.h2m b/docs/man/grub-switch-to-blscfg.h2m
new file mode 100644
index 0000000000..fa341426a5
index 00000000000..fa341426a50
--- /dev/null
+++ b/docs/man/grub-switch-to-blscfg.h2m
@@ -0,0 +1,2 @@
+[NAME]
+grub-switch-to-blscfg \- switch to using BLS config files
diff --git a/util/grub-set-password.in b/util/grub-set-password.in
index 5ebf50576d..c0b5ebbfdc 100644
index 5ebf50576d6..c0b5ebbfdc5 100644
--- a/util/grub-set-password.in
+++ b/util/grub-set-password.in
@@ -1,6 +1,6 @@
@ -59,7 +59,7 @@ index 5ebf50576d..c0b5ebbfdc 100644
else
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
new file mode 100644
index 0000000000..a851424beb
index 00000000000..a851424beb2
--- /dev/null
+++ b/util/grub-switch-to-blscfg.in
@@ -0,0 +1,317 @@
@ -381,10 +381,10 @@ index 0000000000..a851424beb
+# Bye.
+exit 0
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 2851952659..e490e1a43a 100644
index cd9aea0cc01..b8bc37e92aa 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -138,7 +138,7 @@ blsdir="/boot/loader/entries"
@@ -140,7 +140,7 @@ blsdir="/boot/loader/entries"
get_sorted_bls()
{

View file

@ -1,211 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 7 Nov 2017 17:12:17 -0500
Subject: [PATCH] Make pmtimer tsc calibration not take 51 seconds to fail.
On my laptop running at 2.4GHz, if I run a VM where tsc calibration
using pmtimer will fail presuming a broken pmtimer, it takes ~51 seconds
to do so (as measured with the stopwatch on my phone), with a tsc delta
of 0x1cd1c85300, or around 125 billion cycles.
If instead of trying to wait for 5-200ms to show up on the pmtimer, we try
to wait for 5-200us, it decides it's broken in ~0x2626aa0 TSCs, aka ~2.4
million cycles, or more or less instantly.
Additionally, this reading the pmtimer was returning 0xffffffff anyway,
and that's obviously an invalid return. I've added a check for that and
0 so we don't bother waiting for the test if what we're seeing is dead
pins with no response at all.
If "debug" is includes "pmtimer", you will see one of the following
three outcomes. If pmtimer gives all 0 or all 1 bits, you will see:
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 1
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 2
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 3
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 4
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 5
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 6
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 7
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 8
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 9
kern/i386/tsc_pmtimer.c:77: pmtimer: 0xffffff bad_reads: 10
kern/i386/tsc_pmtimer.c:78: timer is broken; giving up.
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware and
these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
If pmtimer gives any other bit patterns but is not actually marching
forward fast enough to use for clock calibration, you will see:
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
This outcome was tested using grub compiled with GRUB_PMTIMER_IGNORE_BAD_READS
defined (so as not to trip the bad read test) using qemu+kvm with UEFI
(OVMF) firmware, and these options: -machine pc-q35-2.10 -cpu Broadwell-noTSX
If pmtimer actually works, you'll see something like:
kern/i386/tsc_pmtimer.c:121: pmtimer delta is 0x0 (1904 iterations)
kern/i386/tsc_pmtimer.c:124: tsc delta is implausible: 0x2626aa0
This outcome was tested using qemu+kvm with UEFI (OVMF) firmware, and
these options: -machine pc-i440fx-2.4 -cpu Broadwell-noTSX
I've also tested this outcome on a real Intel Xeon E3-1275v3 on an Intel
Server Board S1200V3RPS using the SDV.RP.B8 "Release" build here:
https://firmware.intel.com/sites/default/files/UEFIDevKit_S1200RP_vB8.zip
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/i386/tsc_pmtimer.c | 109 +++++++++++++++++++++++++++++++-------
1 file changed, 89 insertions(+), 20 deletions(-)
diff --git a/grub-core/kern/i386/tsc_pmtimer.c b/grub-core/kern/i386/tsc_pmtimer.c
index c9c3616997..ca15c3aacd 100644
--- a/grub-core/kern/i386/tsc_pmtimer.c
+++ b/grub-core/kern/i386/tsc_pmtimer.c
@@ -28,40 +28,101 @@
#include <grub/acpi.h>
#include <grub/cpu/io.h>
+/*
+ * Define GRUB_PMTIMER_IGNORE_BAD_READS if you're trying to test a timer that's
+ * present but doesn't keep time well.
+ */
+// #define GRUB_PMTIMER_IGNORE_BAD_READS
+
grub_uint64_t
grub_pmtimer_wait_count_tsc (grub_port_t pmtimer,
grub_uint16_t num_pm_ticks)
{
grub_uint32_t start;
- grub_uint32_t last;
- grub_uint32_t cur, end;
+ grub_uint64_t cur, end;
grub_uint64_t start_tsc;
grub_uint64_t end_tsc;
- int num_iter = 0;
+ unsigned int num_iter = 0;
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
+ int bad_reads = 0;
+#endif
- start = grub_inl (pmtimer) & 0xffffff;
- last = start;
+ /*
+ * Some timers are 24-bit and some are 32-bit, but it doesn't make much
+ * difference to us. Caring which one we have isn't really worth it since
+ * the low-order digits will give us enough data to calibrate TSC. So just
+ * mask the top-order byte off.
+ */
+ cur = start = grub_inl (pmtimer) & 0xffffffUL;
end = start + num_pm_ticks;
start_tsc = grub_get_tsc ();
while (1)
{
- cur = grub_inl (pmtimer) & 0xffffff;
- if (cur < last)
- cur |= 0x1000000;
- num_iter++;
+ cur &= 0xffffffffff000000ULL;
+ cur |= grub_inl (pmtimer) & 0xffffffUL;
+
+ end_tsc = grub_get_tsc();
+
+#ifndef GRUB_PMTIMER_IGNORE_BAD_READS
+ /*
+ * If we get 10 reads in a row that are obviously dead pins, there's no
+ * reason to do this thousands of times.
+ */
+ if (cur == 0xffffffUL || cur == 0)
+ {
+ bad_reads++;
+ grub_dprintf ("pmtimer",
+ "pmtimer: 0x%"PRIxGRUB_UINT64_T" bad_reads: %d\n",
+ cur, bad_reads);
+ grub_dprintf ("pmtimer", "timer is broken; giving up.\n");
+
+ if (bad_reads == 10)
+ return 0;
+ }
+#endif
+
+ if (cur < start)
+ cur += 0x1000000;
+
if (cur >= end)
{
- end_tsc = grub_get_tsc ();
+ grub_dprintf ("pmtimer", "pmtimer delta is 0x%"PRIxGRUB_UINT64_T"\n",
+ cur - start);
+ grub_dprintf ("pmtimer", "tsc delta is 0x%"PRIxGRUB_UINT64_T"\n",
+ end_tsc - start_tsc);
return end_tsc - start_tsc;
}
- /* Check for broken PM timer.
- 50000000 TSCs is between 5 ms (10GHz) and 200 ms (250 MHz)
- if after this time we still don't have 1 ms on pmtimer, then
- pmtimer is broken.
+
+ /*
+ * Check for broken PM timer. 1ms at 10GHz should be 1E+7 TSCs; at
+ * 250MHz it should be 2.5E6. So if after 4E+7 TSCs on a 10GHz machine,
+ * we should have seen pmtimer show 4ms of change (i.e. cur =~
+ * start+14320); on a 250MHz machine that should be 16ms (start+57280).
+ * If after this a time we still don't have 1ms on pmtimer, then pmtimer
+ * is broken.
+ *
+ * Likewise, if our code is perfectly efficient and introduces no delays
+ * whatsoever, on a 10GHz system we should see a TSC delta of 3580 in
+ * ~3580 iterations. On a 250MHz machine that should be ~900 iterations.
+ *
+ * With those factors in mind, there are two limits here. There's a hard
+ * limit here at 8x our desired pm timer delta, picked as an arbitrarily
+ * large value that's still not a lot of time to humans, because if we
+ * get that far this is either an implausibly fast machine or the pmtimer
+ * is not running. And there's another limit on 4x our 10GHz tsc delta
+ * without seeing cur converge on our target value.
*/
- if ((num_iter & 0xffffff) == 0 && grub_get_tsc () - start_tsc > 5000000) {
- return 0;
- }
+ if ((++num_iter > (grub_uint32_t)num_pm_ticks << 3UL) ||
+ end_tsc - start_tsc > 40000000)
+ {
+ grub_dprintf ("pmtimer",
+ "pmtimer delta is 0x%"PRIxGRUB_UINT64_T" (%u iterations)\n",
+ cur - start, num_iter);
+ grub_dprintf ("pmtimer",
+ "tsc delta is implausible: 0x%"PRIxGRUB_UINT64_T"\n",
+ end_tsc - start_tsc);
+ return 0;
+ }
}
}
@@ -74,12 +135,20 @@ grub_tsc_calibrate_from_pmtimer (void)
fadt = grub_acpi_find_fadt ();
if (!fadt)
- return 0;
+ {
+ grub_dprintf ("pmtimer", "No FADT found; not using pmtimer.\n");
+ return 0;
+ }
pmtimer = fadt->pmtimer;
if (!pmtimer)
- return 0;
+ {
+ grub_dprintf ("pmtimer", "FADT does not specify pmtimer; skipping.\n");
+ return 0;
+ }
- /* It's 3.579545 MHz clock. Wait 1 ms. */
+ /*
+ * It's 3.579545 MHz clock. Wait 1 ms.
+ */
tsc_diff = grub_pmtimer_wait_count_tsc (pmtimer, 3580);
if (tsc_diff == 0)
return 0;

View file

@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set
1 file changed, 3 insertions(+)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 55558cc0b9..af9792c963 100644
index 3463f444f74..b5fa6156549 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -430,6 +430,9 @@ grub_normal_reader_init (int nested)
@ -20,4 +20,4 @@ index 55558cc0b9..af9792c963 100644
+
msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere "
"else TAB lists possible device or file completions. %s"),
"else TAB lists possible device or file completions. To enable "

View file

@ -17,7 +17,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h
new file mode 100644
index 0000000000..1592f6f76b
index 00000000000..1592f6f76b5
--- /dev/null
+++ b/include/grub/arm/efi/console.h
@@ -0,0 +1,24 @@
@ -47,7 +47,7 @@ index 0000000000..1592f6f76b
+#endif /* ! GRUB_ARM_EFI_CONSOLE_H */
diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h
new file mode 100644
index 0000000000..9568933938
index 00000000000..95689339384
--- /dev/null
+++ b/include/grub/arm64/efi/console.h
@@ -0,0 +1,24 @@
@ -77,7 +77,7 @@ index 0000000000..9568933938
+#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */
diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h
new file mode 100644
index 0000000000..9231375cb0
index 00000000000..9231375cb07
--- /dev/null
+++ b/include/grub/i386/efi/console.h
@@ -0,0 +1,24 @@
@ -107,7 +107,7 @@ index 0000000000..9231375cb0
+#endif /* ! GRUB_I386_EFI_CONSOLE_H */
diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/efi/console.h
new file mode 100644
index 0000000000..dba9d8678d
index 00000000000..dba9d8678d0
--- /dev/null
+++ b/include/grub/x86_64/efi/console.h
@@ -0,0 +1,24 @@

View file

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 27 insertions(+)
diff --git a/configure.ac b/configure.ac
index 0d0e6782a1..302300711f 100644
index 3602b4ab62b..fcfbcbb664d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1442,7 +1442,15 @@ grub_PROG_TARGET_CC
@@ -1540,7 +1540,15 @@ grub_PROG_TARGET_CC
if test "x$TARGET_APPLE_LINKER" != x1 ; then
grub_PROG_OBJCOPY_ABSOLUTE
fi
@ -30,7 +30,7 @@ index 0d0e6782a1..302300711f 100644
if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
diff --git a/acinclude.m4 b/acinclude.m4
index 6e14bb553c..21238fcfd0 100644
index fa7840f09af..0231e64e337 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -136,6 +136,25 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then

View file

@ -15,7 +15,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++
grub-core/kern/i386/pc/init.c | 4 +-
grub-core/kern/ieee1275/init.c | 1 -
grub-core/kern/misc.c | 13 ++--
grub-core/kern/misc.c | 11 +--
grub-core/kern/mm.c | 6 +-
grub-core/lib/arm64/backtrace.c | 62 ----------------
grub-core/lib/i386/backtrace.c | 78 --------------------
@ -29,7 +29,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/ia64/efi/startup.S | 3 +-
grub-core/kern/sparc64/ieee1275/crt0.S | 3 +-
grub-core/Makefile.am | 1 +
24 files changed, 414 insertions(+), 167 deletions(-)
24 files changed, 413 insertions(+), 166 deletions(-)
rename grub-core/{lib => commands}/backtrace.c (98%)
create mode 100644 grub-core/kern/arm64/backtrace.c
create mode 100644 grub-core/kern/backtrace.c
@ -38,7 +38,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
delete mode 100644 grub-core/lib/i386/backtrace.c
diff --git a/Makefile.util.def b/Makefile.util.def
index 88f55e35c4..bda9fd1211 100644
index acbcc8c208c..1079add5bbe 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -51,6 +51,12 @@ library = {
@ -55,10 +55,10 @@ index 88f55e35c4..bda9fd1211 100644
library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 058c88ac3a..52ec0fafcd 100644
index 63f053b3add..6645fbae34f 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -142,6 +142,12 @@ kernel = {
@@ -153,6 +153,12 @@ kernel = {
common = kern/rescue_reader.c;
common = kern/term.c;
common = kern/verifiers.c;
@ -71,7 +71,7 @@ index 058c88ac3a..52ec0fafcd 100644
noemu = kern/compiler-rt.c;
noemu = kern/mm.c;
@@ -188,9 +194,6 @@ kernel = {
@@ -199,9 +205,6 @@ kernel = {
softdiv = lib/division.c;
@ -81,7 +81,7 @@ index 058c88ac3a..52ec0fafcd 100644
i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c;
@@ -2399,15 +2402,12 @@ module = {
@@ -2455,15 +2458,12 @@ module = {
module = {
name = backtrace;
@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c
similarity index 98%
rename from grub-core/lib/backtrace.c
rename to grub-core/commands/backtrace.c
index c0ad6ab8be..8b5ec3913b 100644
index c0ad6ab8be1..8b5ec3913b5 100644
--- a/grub-core/lib/backtrace.c
+++ b/grub-core/commands/backtrace.c
@@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)),
@ -116,7 +116,7 @@ index c0ad6ab8be..8b5ec3913b 100644
}
diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c
index b64acd70fe..99281472d3 100644
index b64acd70fee..99281472d36 100644
--- a/grub-core/gdb/cstub.c
+++ b/grub-core/gdb/cstub.c
@@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no)
@ -129,7 +129,7 @@ index b64acd70fe..99281472d3 100644
diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c
new file mode 100644
index 0000000000..019c6fdfef
index 00000000000..019c6fdfef2
--- /dev/null
+++ b/grub-core/kern/arm64/backtrace.c
@@ -0,0 +1,94 @@
@ -229,7 +229,7 @@ index 0000000000..019c6fdfef
+}
diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c
new file mode 100644
index 0000000000..4a82e865cc
index 00000000000..4a82e865cc6
--- /dev/null
+++ b/grub-core/kern/backtrace.c
@@ -0,0 +1,97 @@
@ -331,10 +331,10 @@ index 0000000000..4a82e865cc
+ grub_backtrace (skip + 1);
+}
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 7afb9e6f72..88d2077709 100644
index 0bf40caa61a..931f6e41442 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -124,6 +124,50 @@ grub_dl_resolve_symbol (const char *name)
@@ -115,6 +115,50 @@ grub_dl_resolve_symbol (const char *name)
return 0;
}
@ -385,7 +385,7 @@ index 7afb9e6f72..88d2077709 100644
/* Register a symbol with the name NAME and the address ADDR. */
grub_err_t
grub_dl_register_symbol (const char *name, void *addr, int isfunc,
@@ -336,6 +380,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
@@ -330,6 +374,7 @@ grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e)
const char *str;
Elf_Word size, entsize;
@ -395,7 +395,7 @@ index 7afb9e6f72..88d2077709 100644
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c
new file mode 100644
index 0000000000..2413f9a57d
index 00000000000..2413f9a57db
--- /dev/null
+++ b/grub-core/kern/i386/backtrace.c
@@ -0,0 +1,125 @@
@ -525,7 +525,7 @@ index 0000000000..2413f9a57d
+#endif
+}
diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c
index 27bc68b8a5..b51d0abfa6 100644
index 326d491c586..fe7ad14d45c 100644
--- a/grub-core/kern/i386/pc/init.c
+++ b/grub-core/kern/i386/pc/init.c
@@ -153,7 +153,7 @@ compact_mem_regions (void)
@ -537,7 +537,7 @@ index 27bc68b8a5..b51d0abfa6 100644
/* Helper for grub_machine_init. */
static int
@@ -217,7 +217,7 @@ grub_machine_init (void)
@@ -226,7 +226,7 @@ grub_machine_init (void)
/* This has to happen before any BIOS calls. */
grub_via_workaround_init ();
@ -547,27 +547,23 @@ index 27bc68b8a5..b51d0abfa6 100644
/* Initialize the console as early as possible. */
grub_console_init ();
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 0cd2a62723..937c1bc44c 100644
index 51c1e1c9d9f..c4d6962197b 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -63,7 +63,6 @@
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
#endif
@@ -70,7 +70,6 @@
*/
#define RUNTIME_MIN_SPACE (128UL * 1024 * 1024)
-extern char _start[];
extern char _end[];
#ifdef __sparc__
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index c60601b699..a432a6be54 100644
index b1d399d37d7..779586658cb 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -1197,15 +1197,15 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
/* Abort GRUB. This function does not return. */
-static void __attribute__ ((noreturn))
+static inline void __attribute__ ((noreturn))
@@ -1302,12 +1302,12 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
void __attribute__ ((noreturn))
grub_abort (void)
{
-#ifndef GRUB_UTIL
@ -584,7 +580,7 @@ index c60601b699..a432a6be54 100644
#ifndef GRUB_UTIL
if (grub_term_inputs)
@@ -1232,6 +1232,7 @@ grub_fatal (const char *fmt, ...)
@@ -1334,6 +1334,7 @@ grub_fatal (const char *fmt, ...)
{
va_list ap;
@ -593,10 +589,10 @@ index c60601b699..a432a6be54 100644
grub_vprintf (_(fmt), ap);
va_end (ap);
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
index c070afc621..d8c8377578 100644
index 027a25cd1f0..1aeeba9e27e 100644
--- a/grub-core/kern/mm.c
+++ b/grub-core/kern/mm.c
@@ -97,13 +97,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
@@ -144,13 +144,13 @@ get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r)
break;
if (! *r)
@ -615,7 +611,7 @@ index c070afc621..d8c8377578 100644
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
deleted file mode 100644
index 1079b5380e..0000000000
index 1079b5380e1..00000000000
--- a/grub-core/lib/arm64/backtrace.c
+++ /dev/null
@@ -1,62 +0,0 @@
@ -683,7 +679,7 @@ index 1079b5380e..0000000000
-
diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c
deleted file mode 100644
index c67273db3a..0000000000
index c67273db3ae..00000000000
--- a/grub-core/lib/i386/backtrace.c
+++ /dev/null
@@ -1,78 +0,0 @@
@ -766,7 +762,7 @@ index c67273db3a..0000000000
-}
-
diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h
index 395519762f..275cf85e2d 100644
index 395519762f0..275cf85e2d3 100644
--- a/include/grub/backtrace.h
+++ b/include/grub/backtrace.h
@@ -19,8 +19,14 @@
@ -787,10 +783,10 @@ index 395519762f..275cf85e2d 100644
#endif
diff --git a/include/grub/dl.h b/include/grub/dl.h
index 91933b85f2..2f76e6b043 100644
index f2bf50eb98d..8a3d188d1d1 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -259,6 +259,8 @@ grub_dl_is_persistent (grub_dl_t mod)
@@ -258,6 +258,8 @@ grub_dl_is_persistent (grub_dl_t mod)
#endif
@ -800,7 +796,7 @@ index 91933b85f2..2f76e6b043 100644
int isfunc, grub_dl_t mod);
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index abbca5ea33..300a9766cd 100644
index abbca5ea335..300a9766cda 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void);
@ -814,7 +810,7 @@ index abbca5ea33..300a9766cd 100644
void grub_main (void) __attribute__ ((noreturn));
diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S
index 9f8265315a..f3bc41f9d0 100644
index 9f8265315a9..f3bc41f9d0f 100644
--- a/grub-core/kern/arm/efi/startup.S
+++ b/grub-core/kern/arm/efi/startup.S
@@ -23,6 +23,8 @@
@ -827,7 +823,7 @@ index 9f8265315a..f3bc41f9d0 100644
/*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0.
diff --git a/grub-core/kern/arm/startup.S b/grub-core/kern/arm/startup.S
index 3946fe8e18..5679a1d00a 100644
index 3946fe8e183..5679a1d00ad 100644
--- a/grub-core/kern/arm/startup.S
+++ b/grub-core/kern/arm/startup.S
@@ -48,6 +48,8 @@
@ -840,7 +836,7 @@ index 3946fe8e18..5679a1d00a 100644
b codestart
diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S
index 666a7ee3c9..41676bdb2b 100644
index 666a7ee3c92..41676bdb2b8 100644
--- a/grub-core/kern/arm64/efi/startup.S
+++ b/grub-core/kern/arm64/efi/startup.S
@@ -19,7 +19,9 @@
@ -854,7 +850,7 @@ index 666a7ee3c9..41676bdb2b 100644
/*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0.
diff --git a/grub-core/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S
index 0d89858d9b..939f182fc7 100644
index 0d89858d9b3..939f182fc74 100644
--- a/grub-core/kern/i386/qemu/startup.S
+++ b/grub-core/kern/i386/qemu/startup.S
@@ -24,7 +24,8 @@
@ -868,7 +864,7 @@ index 0d89858d9b..939f182fc7 100644
jmp codestart
diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S
index d75c6d7cc7..8f2a593e52 100644
index d75c6d7cc74..8f2a593e529 100644
--- a/grub-core/kern/ia64/efi/startup.S
+++ b/grub-core/kern/ia64/efi/startup.S
@@ -24,8 +24,9 @@
@ -883,7 +879,7 @@ index d75c6d7cc7..8f2a593e52 100644
alloc loc0=ar.pfs,2,4,0,0
mov loc1=rp
diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S
index 03b916f053..701bf63abc 100644
index 03b916f0534..701bf63abcf 100644
--- a/grub-core/kern/sparc64/ieee1275/crt0.S
+++ b/grub-core/kern/sparc64/ieee1275/crt0.S
@@ -22,7 +22,8 @@
@ -897,7 +893,7 @@ index 03b916f053..701bf63abc 100644
ba codestart
mov %o4, %o0
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index ee88e44e97..bfd29a3bf0 100644
index f18550c1c98..b7192a3da82 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h

View file

@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2018 13:40:19 -0400
Subject: [PATCH] Fixup for newer compiler
---
grub-core/fs/btrfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 87e4dd1a07a..ad35e75750b 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -218,7 +218,7 @@ struct grub_btrfs_inode
grub_uint64_t size;
grub_uint8_t dummy2[0x70];
struct grub_btrfs_time mtime;
-} GRUB_PACKED;
+} GRUB_PACKED __attribute__ ((aligned(8)));
struct grub_btrfs_extent_data
{

View file

@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 2 insertions(+)
diff --git a/include/grub/kernel.h b/include/grub/kernel.h
index 300a9766cd..55849777ea 100644
index 300a9766cda..55849777eaa 100644
--- a/include/grub/kernel.h
+++ b/include/grub/kernel.h
@@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void);

View file

@ -8,15 +8,15 @@ Subject: [PATCH] Fixup for newer compiler
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 191b1a70c6..5f0ef96985 100644
index ece9ed8a1bf..6262f21a772 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -38,7 +38,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
@@ -41,7 +41,7 @@ CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
-STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
+STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
if !COND_emu
if COND_HAVE_ASM_USCORE
LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free

View file

@ -23,22 +23,22 @@ Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
[msalter: Fix max string calculation in grub_net_hwaddr_to_str]
Signed-off-by: Mark Salter <msalter@redhat.com>
---
grub-core/net/arp.c | 155 ++++++++++++++++++++++-----------
grub-core/net/arp.c | 156 ++++++++++++++++++++++-----------
grub-core/net/bootp.c | 15 ++--
grub-core/net/drivers/efi/efinet.c | 8 +-
grub-core/net/drivers/emu/emunet.c | 1 +
grub-core/net/drivers/i386/pc/pxe.c | 13 +--
grub-core/net/drivers/ieee1275/ofnet.c | 2 +
grub-core/net/drivers/uboot/ubootnet.c | 1 +
grub-core/net/ethernet.c | 88 +++++++++----------
grub-core/net/ethernet.c | 89 +++++++++----------
grub-core/net/icmp6.c | 15 ++--
grub-core/net/ip.c | 4 +-
grub-core/net/net.c | 50 ++++++-----
include/grub/net.h | 19 ++--
12 files changed, 219 insertions(+), 152 deletions(-)
12 files changed, 220 insertions(+), 153 deletions(-)
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 54306e3b16..67b409a8ac 100644
index 1d367436cfc..8bf0a06e193 100644
--- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c
@@ -31,22 +31,12 @@ enum
@ -137,7 +137,7 @@ index 54306e3b16..67b409a8ac 100644
nbd = nb.data;
send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP);
@@ -114,28 +124,53 @@ grub_err_t
@@ -114,30 +124,56 @@ grub_err_t
grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_uint16_t *vlantag)
{
@ -177,33 +177,36 @@ index 54306e3b16..67b409a8ac 100644
+
+ /* The source protocol address. */
sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
+ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln);
+ tmp_ptr += pln;
+
+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
+
+ /* The target hardware address. */
+ tmp_ptr += hln;
+
+ /* The target protocol address. */
target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
- target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
- sender_addr.ipv4 = arp_packet->sender_ip;
- target_addr.ipv4 = arp_packet->recv_ip;
sender_addr.option = 0;
target_addr.option = 0;
- if (arp_packet->sender_ip == pending_req)
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+
+ if (sender_addr.ipv4 == pending_req)
have_pending = 1;
- have_pending = 1;
- sender_mac_addr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
- grub_memcpy (sender_mac_addr.mac, arp_packet->sender_mac,
- sizeof (sender_mac_addr.mac));
- grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
-
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+ tmp_ptr += pln;
+
grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
+ /* The target hardware address. */
+ tmp_ptr += hln;
+
+ /* The target protocol address. */
+ target_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+
+ if (sender_addr.ipv4 == pending_req)
+ have_pending = 1;
+
FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
{
/* Verify vlantag id */
@@ -148,11 +183,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
@@ -150,11 +186,11 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
/* Am I the protocol address target? */
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0
@ -217,7 +220,7 @@ index 54306e3b16..67b409a8ac 100644
grub_uint8_t arp_data[128];
grub_err_t err;
@@ -161,25 +196,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
@@ -163,25 +199,39 @@ grub_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_netbuff_clear (&nb_reply);
grub_netbuff_reserve (&nb_reply, 128);
@ -271,10 +274,10 @@ index 54306e3b16..67b409a8ac 100644
/* Change operation to REPLY and send packet */
send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP);
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index e28fb6a09f..08b6b2b5d6 100644
index e0aec25233d..76e4c11a46f 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -233,7 +233,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -325,7 +325,6 @@ grub_net_configure_by_dhcp_ack (const char *name,
int is_def, char **device, char **path)
{
grub_net_network_level_address_t addr;
@ -282,7 +285,7 @@ index e28fb6a09f..08b6b2b5d6 100644
struct grub_net_network_level_interface *inter;
int mask = -1;
char server_ip[sizeof ("xxx.xxx.xxx.xxx")];
@@ -250,12 +249,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -343,12 +342,8 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (path)
*path = 0;
@ -297,7 +300,7 @@ index e28fb6a09f..08b6b2b5d6 100644
if (!inter)
return 0;
@@ -567,7 +562,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
@@ -660,7 +655,9 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
grub_memset (pack, 0, sizeof (*pack));
pack->opcode = 1;
pack->hw_type = 1;
@ -308,20 +311,20 @@ index e28fb6a09f..08b6b2b5d6 100644
err = grub_get_datetime (&date);
if (err || !grub_datetime2unixtime (&date, &t))
{
@@ -580,7 +577,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
@@ -673,7 +670,7 @@ send_dhcp_packet (struct grub_net_network_level_interface *iface)
else
pack->ident = iface->xid;
- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6);
+ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len);
grub_netbuff_push (nb, sizeof (*udph));
err = grub_netbuff_push (nb, sizeof (*udph));
if (err)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 173fb63153..a673bea807 100644
index 3e2432fb61c..7deb0a32efd 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -279,6 +279,9 @@ grub_efinet_findcards (void)
@@ -288,6 +288,9 @@ grub_efinet_findcards (void)
/* This should not happen... Why? */
continue;
@ -329,12 +332,12 @@ index 173fb63153..a673bea807 100644
+ continue;
+
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
&& efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
&& net->start (net) != GRUB_EFI_SUCCESS)
continue;
@@ -315,10 +318,11 @@ grub_efinet_findcards (void)
card->name = grub_xasprintf ("efinet%d", i++);
card->driver = &efidriver;
card->flags = 0;
@@ -332,10 +335,11 @@ grub_efinet_findcards (void)
* such as LoadFile2 for initrd loading.
*/
card->flags = GRUB_NET_CARD_NO_CLOSE_ON_FINI_HW;
- card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ card->default_address.type = net->mode->if_type;
+ card->default_address.len = net->mode->hwaddr_size;
@ -346,7 +349,7 @@ index 173fb63153..a673bea807 100644
card->efi_handle = *handle;
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c
index b194920861..5b6c5e16a6 100644
index 5f311d40f49..7461d13bbc2 100644
--- a/grub-core/net/drivers/emu/emunet.c
+++ b/grub-core/net/drivers/emu/emunet.c
@@ -46,6 +46,7 @@ static struct grub_net_card emucard =
@ -358,7 +361,7 @@ index b194920861..5b6c5e16a6 100644
},
.flags = 0
diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c
index 3f4152d036..9f8fb4b6d2 100644
index db17186ee7d..816d1d0eeda 100644
--- a/grub-core/net/drivers/i386/pc/pxe.c
+++ b/grub-core/net/drivers/i386/pc/pxe.c
@@ -386,20 +386,21 @@ GRUB_MOD_INIT(pxe)
@ -390,7 +393,7 @@ index 3f4152d036..9f8fb4b6d2 100644
grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
diff --git a/grub-core/net/drivers/ieee1275/ofnet.c b/grub-core/net/drivers/ieee1275/ofnet.c
index 3860b6f78d..bcb3f9ea02 100644
index 78f03df8e21..c56461ff1ae 100644
--- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/grub-core/net/drivers/ieee1275/ofnet.c
@@ -160,6 +160,7 @@ grub_ieee1275_parse_bootpath (const char *devpath, char *bootpath,
@ -401,7 +404,7 @@ index 3860b6f78d..bcb3f9ea02 100644
args = bootpath + grub_strlen (devpath) + 1;
do
@@ -503,6 +504,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
@@ -491,6 +492,7 @@ search_net_devices (struct grub_ieee1275_devalias *alias)
grub_memcpy (&lla.mac, pprop, 6);
lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
@ -410,7 +413,7 @@ index 3860b6f78d..bcb3f9ea02 100644
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
diff --git a/grub-core/net/drivers/uboot/ubootnet.c b/grub-core/net/drivers/uboot/ubootnet.c
index 056052e40d..22ebcbf211 100644
index b9d5a0cd494..9f3354a1b74 100644
--- a/grub-core/net/drivers/uboot/ubootnet.c
+++ b/grub-core/net/drivers/uboot/ubootnet.c
@@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet)
@ -422,7 +425,7 @@ index 056052e40d..22ebcbf211 100644
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
card->txbuf = grub_zalloc (card->txbufsize);
diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c
index 4d7ceed6f9..9aae83a5eb 100644
index 707bbb12cb2..1441a1bacff 100644
--- a/grub-core/net/ethernet.c
+++ b/grub-core/net/ethernet.c
@@ -29,13 +29,6 @@
@ -447,7 +450,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
+ grub_uint8_t *eth;
grub_err_t err;
- grub_uint8_t etherhdr_size;
- grub_uint16_t vlantag_id = VLANTAG_IDENTIFIER;
- grub_uint16_t vlantag_id = grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER);
+ grub_uint32_t vlantag = 0;
+ grub_uint8_t hw_addr_len = inf->card->default_address.len;
+ grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2;
@ -487,7 +490,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
if (!inf->card->opened)
{
err = GRUB_ERR_NONE;
@@ -85,18 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
@@ -85,19 +91,6 @@ send_ethernet_packet (struct grub_net_network_level_interface *inf,
inf->card->opened = 1;
}
@ -499,14 +502,15 @@ index 4d7ceed6f9..9aae83a5eb 100644
- (char *) nb->data + etherhdr_size - 6, 2);
-
- /* Add the tag in the middle */
- grub_uint16_t vlan = grub_cpu_to_be16 (inf->vlantag);
- grub_memcpy ((char *) nb->data + etherhdr_size - 6, &vlantag_id, 2);
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, (char *) &(inf->vlantag), 2);
- grub_memcpy ((char *) nb->data + etherhdr_size - 4, &vlan, 2);
- }
-
return inf->card->driver->send (inf->card, nb);
}
@@ -104,31 +98,40 @@ grub_err_t
@@ -105,31 +98,40 @@ grub_err_t
grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
struct grub_net_card *card)
{
@ -528,7 +532,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
- /* Check if a vlan-tag is present. If so, the ethernet header is 4 bytes */
- /* longer than the original one. The vlantag id is extracted and the header */
- /* is reseted to the original size. */
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == VLANTAG_IDENTIFIER)
- if (grub_get_unaligned16 (nb->data + etherhdr_size - 2) == grub_cpu_to_be16_compile_time (VLANTAG_IDENTIFIER))
+ hwaddress.type = card->default_address.type;
+ hwaddress.len = hw_addr_len;
+ grub_memcpy (hwaddress.mac, eth, hw_addr_len);
@ -542,7 +546,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
+ type = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
+ if (type == VLANTAG_IDENTIFIER)
{
- vlantag = grub_get_unaligned16 (nb->data + etherhdr_size);
- vlantag = grub_be_to_cpu16 (grub_get_unaligned16 (nb->data + etherhdr_size));
+ /* Skip vlan tag */
+ eth += 2;
+ vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
@ -559,7 +563,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
err = grub_netbuff_pull (nb, etherhdr_size);
if (err)
return err;
@@ -148,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
@@ -149,11 +151,6 @@ grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
}
}
@ -572,7 +576,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
{
/* ARP packet. */
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
index 2cbd95dce2..56a3ec5c8e 100644
index 9a8c4511285..5924fd53aca 100644
--- a/grub-core/net/icmp6.c
+++ b/grub-core/net/icmp6.c
@@ -231,8 +231,9 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb,
@ -612,10 +616,10 @@ index 2cbd95dce2..56a3ec5c8e 100644
}
if (ohdr->type == OPTION_PREFIX && ohdr->len == 4)
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
index ea5edf8f1f..a5896f6dc2 100644
index f967618e53f..3c475762cc0 100644
--- a/grub-core/net/ip.c
+++ b/grub-core/net/ip.c
@@ -276,8 +276,8 @@ handle_dgram (struct grub_net_buff *nb,
@@ -316,8 +316,8 @@ handle_dgram (struct grub_net_buff *nb,
if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
@ -627,7 +631,7 @@ index ea5edf8f1f..a5896f6dc2 100644
grub_net_process_dhcp (nb, inf);
grub_netbuff_free (nb);
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 22f2689aae..a46f82362e 100644
index 20c55257647..fa6b6537142 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -133,8 +133,9 @@ grub_net_link_layer_resolve (struct grub_net_network_level_interface *inf,
@ -650,7 +654,7 @@ index 22f2689aae..a46f82362e 100644
hw_addr->mac[0] = 0x33;
hw_addr->mac[1] = 0x33;
hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff);
@@ -762,23 +764,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
@@ -772,23 +774,23 @@ grub_net_addr_to_str (const grub_net_network_level_address_t *target, char *buf)
void
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str)
{
@ -688,8 +692,8 @@ index 22f2689aae..a46f82362e 100644
- grub_printf (_("Unsupported hw address type %d\n"), addr->type);
}
int
@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
void
@@ -813,13 +815,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
return -1;
if (a->type > b->type)
return +1;
@ -713,7 +717,7 @@ index 22f2689aae..a46f82362e 100644
int
diff --git a/include/grub/net.h b/include/grub/net.h
index 8a05ec4fe7..af0404db7e 100644
index ff901b96e22..1d76fd9a1f5 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -29,7 +29,8 @@
@ -728,7 +732,7 @@ index 8a05ec4fe7..af0404db7e 100644
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
@@ -42,15 +43,17 @@ enum
typedef enum grub_link_level_protocol_id
typedef enum grub_link_level_protocol_id
{
- GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
+ /* IANA ARP constant to define hardware type. */
@ -746,7 +750,7 @@ index 8a05ec4fe7..af0404db7e 100644
};
} grub_net_link_level_address_t;
@@ -566,11 +569,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
@@ -588,11 +591,13 @@ grub_net_addr_cmp (const grub_net_network_level_address_t *a,
#define GRUB_NET_MAX_STR_ADDR_LEN sizeof ("XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX")
/*
@ -762,5 +766,5 @@ index 8a05ec4fe7..af0404db7e 100644
+ "XX:XX:XX:XX:XX:XX:XX:XX:"\
+ "XX:XX:XX:XX:XX:XX:XX:XX"))
void
grub_net_addr_to_str (const grub_net_network_level_address_t *target,
/* Max VLAN id = 4094 */
#define GRUB_NET_MAX_STR_VLAN_LEN (sizeof ("vlanXXXX"))

View file

@ -15,12 +15,12 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 8e25680db0..014e5bf980 100644
index 7deb0a32efd..92bb7444782 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -430,6 +430,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_print_error ();
if (device && path)
if (inter && device && path)
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ if (grub_errno)
+ grub_print_error ();
@ -28,10 +28,10 @@ index 8e25680db0..014e5bf980 100644
else
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 7614b58dca..91ab528e4d 100644
index daa9268fdaa..53f5c781ac3 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -1524,31 +1524,6 @@ typedef union
@@ -1571,31 +1571,6 @@ typedef union
grub_efi_pxe_dhcpv6_packet_t dhcpv6;
} grub_efi_pxe_packet_t;
@ -63,7 +63,7 @@ index 7614b58dca..91ab528e4d 100644
typedef struct grub_efi_pxe_icmp_error
{
grub_efi_uint8_t type;
@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error
@@ -1621,6 +1596,48 @@ typedef struct grub_efi_pxe_tftp_error
grub_efi_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t;
@ -112,7 +112,7 @@ index 7614b58dca..91ab528e4d 100644
typedef struct grub_efi_pxe_mode
{
grub_efi_boolean_t started;
@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode
@@ -1652,9 +1669,9 @@ typedef struct grub_efi_pxe_mode
grub_efi_pxe_packet_t pxe_bis_reply;
grub_efi_pxe_ip_filter_t ip_filter;
grub_efi_uint32_t arp_cache_entries;

View file

@ -12,10 +12,10 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
1 file changed, 17 insertions(+)
diff --git a/docs/grub.texi b/docs/grub.texi
index 0615d0ed97..04ed6ac1f0 100644
index c30701b4e1f..44c4e665a0d 100644
--- a/docs/grub.texi
+++ b/docs/grub.texi
@@ -5487,6 +5487,7 @@ This command is only available on AArch64 systems.
@@ -5955,6 +5955,7 @@ Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
* net_add_dns:: Add a DNS server
* net_add_route:: Add routing entry
* net_bootp:: Perform a bootp/DHCP autoconfiguration
@ -23,7 +23,7 @@ index 0615d0ed97..04ed6ac1f0 100644
* net_del_addr:: Remove IP address from interface
* net_del_dns:: Remove a DNS server
* net_del_route:: Remove a route entry
@@ -5611,6 +5612,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
@@ -6080,6 +6081,22 @@ Sets environment variable @samp{net_}@var{<card>}@samp{_boot_file}
@end deffn

View file

@ -1,178 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 25 Jun 2015 15:11:36 -0400
Subject: [PATCH] Make a "gdb" dprintf that tells us load addresses.
This makes a grub_dprintf() call during platform init and during module
loading that tells us the virtual addresses of the .text and .data
sections of grub-core/kernel.exec and any modules it loads.
Specifically, it displays them in the gdb "add-symbol-file" syntax, with
the presumption that there's a variable $grubdir that reflects the path
to any such binaries.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/dl.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++
grub-core/kern/efi/efi.c | 4 ++--
grub-core/kern/efi/init.c | 26 +++++++++++++++++++++++-
include/grub/efi/efi.h | 2 +-
4 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 88d2077709..9557254035 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -501,6 +501,23 @@ grub_dl_find_section (Elf_Ehdr *e, const char *name)
return s;
return NULL;
}
+static long
+grub_dl_find_section_index (Elf_Ehdr *e, const char *name)
+{
+ Elf_Shdr *s;
+ const char *str;
+ unsigned i;
+
+ s = (Elf_Shdr *) ((char *) e + e->e_shoff + e->e_shstrndx * e->e_shentsize);
+ str = (char *) e + s->sh_offset;
+
+ for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff);
+ i < e->e_shnum;
+ i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize))
+ if (grub_strcmp (str + s->sh_name, name) == 0)
+ return (long)i;
+ return -1;
+}
/* Me, Vladimir Serbinenko, hereby I add this module check as per new
GNU module policy. Note that this license check is informative only.
@@ -653,6 +670,37 @@ grub_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
return GRUB_ERR_NONE;
}
+static void
+grub_dl_print_gdb_info (grub_dl_t mod, Elf_Ehdr *e)
+{
+ void *text, *data = NULL;
+ long idx;
+
+ idx = grub_dl_find_section_index (e, ".text");
+ if (idx < 0)
+ return;
+
+ text = grub_dl_get_section_addr (mod, idx);
+ if (!text)
+ return;
+
+ idx = grub_dl_find_section_index (e, ".data");
+ if (idx >= 0)
+ data = grub_dl_get_section_addr (mod, idx);
+
+ if (data)
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
+ "\\\n %p -s .data %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
+ mod->name, text, data);
+ else
+ grub_qdprintf ("gdb", "add-symbol-file \\\n"
+ "/usr/lib/debug/usr/lib/grub/%s-%s/%s.debug "
+ "\\\n%p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM,
+ mod->name, text);
+}
/* Load a module from core memory. */
grub_dl_t
@@ -712,6 +760,8 @@ grub_dl_load_core_noinit (void *addr, grub_size_t size)
grub_dprintf ("modules", "module name: %s\n", mod->name);
grub_dprintf ("modules", "init function: %p\n", mod->init);
+ grub_dl_print_gdb_info (mod, e);
+
if (grub_dl_add (mod))
{
grub_dl_unload (mod);
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index ae9885edb8..d6a2fb5778 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -296,7 +296,7 @@ grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
/* Search the mods section from the PE32/PE32+ image. This code uses
a PE32 header, but should work with PE32+ as well. */
grub_addr_t
-grub_efi_modules_addr (void)
+grub_efi_section_addr (const char *section_name)
{
grub_efi_loaded_image_t *image;
struct grub_pe32_header *header;
@@ -321,7 +321,7 @@ grub_efi_modules_addr (void)
i < coff_header->num_sections;
i++, section++)
{
- if (grub_strcmp (section->name, "mods") == 0)
+ if (grub_strcmp (section->name, section_name) == 0)
break;
}
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
index 6d39bd3ad2..2d12e6188f 100644
--- a/grub-core/kern/efi/init.c
+++ b/grub-core/kern/efi/init.c
@@ -115,10 +115,33 @@ grub_efi_env_init (void)
grub_free (envblk_s.buf);
}
+static void
+grub_efi_print_gdb_info (void)
+{
+ grub_addr_t text;
+ grub_addr_t data;
+
+ text = grub_efi_section_addr (".text");
+ if (!text)
+ return;
+
+ data = grub_efi_section_addr (".data");
+ if (data)
+ grub_qdprintf ("gdb",
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
+ "kernel.exec %p -s .data %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text, (void *)data);
+ else
+ grub_qdprintf ("gdb",
+ "add-symbol-file /usr/lib/debug/usr/lib/grub/%s-%s/"
+ "kernel.exec %p\n",
+ GRUB_TARGET_CPU, GRUB_PLATFORM, (void *)text);
+}
+
void
grub_efi_init (void)
{
- grub_modbase = grub_efi_modules_addr ();
+ grub_modbase = grub_efi_section_addr ("mods");
/* First of all, initialize the console so that GRUB can display
messages. */
grub_console_init ();
@@ -142,6 +165,7 @@ grub_efi_init (void)
0, 0, 0, NULL);
grub_efi_env_init ();
+ grub_efi_print_gdb_info ();
grub_efidisk_init ();
}
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
index 03f9a9d011..2e0691454b 100644
--- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h
@@ -138,7 +138,7 @@ grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, char *args);
#endif
-grub_addr_t grub_efi_modules_addr (void);
+grub_addr_t grub_efi_section_addr (const char *section);
void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);

View file

@ -22,7 +22,7 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 56 insertions(+)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index fe93b80f1c..8fb8918ae7 100644
index 76e4c11a46f..f56b293ac72 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -20,6 +20,7 @@
@ -33,7 +33,7 @@ index fe93b80f1c..8fb8918ae7 100644
#include <grub/net/ip.h>
#include <grub/net/netbuff.h>
#include <grub/net/udp.h>
@@ -500,6 +501,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -501,6 +502,60 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (opt && opt_len)
grub_env_set_net_property (name, "rootpath", (const char *) opt, opt_len);
@ -95,10 +95,10 @@ index fe93b80f1c..8fb8918ae7 100644
if (opt && opt_len)
grub_env_set_net_property (name, "extensionspath", (const char *) opt, opt_len);
diff --git a/include/grub/net.h b/include/grub/net.h
index 543251f727..42af7de250 100644
index 1d76fd9a1f5..868c9a2ef29 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -531,6 +531,7 @@ enum
@@ -533,6 +533,7 @@ enum
GRUB_NET_DHCP_MESSAGE_TYPE = 53,
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,

View file

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index 8fb8918ae7..7baf3540c8 100644
index f56b293ac72..9cbdc2264c9 100644
--- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c
@@ -329,7 +329,7 @@ grub_net_configure_by_dhcp_ack (const char *name,
@ -26,7 +26,7 @@ index 8fb8918ae7..7baf3540c8 100644
grub_uint8_t opt_len, overload = 0;
const char *boot_file = 0, *server_name = 0;
grub_size_t boot_file_len, server_name_len;
@@ -505,7 +505,7 @@ grub_net_configure_by_dhcp_ack (const char *name,
@@ -506,7 +506,7 @@ grub_net_configure_by_dhcp_ack (const char *name,
if (opt && opt_len)
{
grub_env_set_net_property (name, "vendor_class_identifier", (const char *) opt, opt_len);

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 10 May 2018 13:40:19 -0400
Subject: [PATCH] Fixup for newer compiler
---
grub-core/fs/btrfs.c | 2 +-
include/grub/gpt_partition.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c
index 2b21cbaa67..4cc86e9b79 100644
--- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c
@@ -218,7 +218,7 @@ struct grub_btrfs_inode
grub_uint64_t size;
grub_uint8_t dummy2[0x70];
struct grub_btrfs_time mtime;
-} GRUB_PACKED;
+} GRUB_PACKED __attribute__ ((aligned(8)));
struct grub_btrfs_extent_data
{
diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
index 7a93f43291..8212697bf6 100644
--- a/include/grub/gpt_partition.h
+++ b/include/grub/gpt_partition.h
@@ -76,7 +76,7 @@ struct grub_gpt_partentry
grub_uint64_t end;
grub_uint64_t attrib;
char name[72];
-} GRUB_PACKED;
+} GRUB_PACKED __attribute__ ((aligned(8)));
grub_err_t
grub_gpt_partition_map_iterate (grub_disk_t disk,

View file

@ -27,12 +27,12 @@ the same way it used to be.
Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/drivers/efi/efinet.c | 284 +++++++++++++++++++++++++++++++++++--
grub-core/net/drivers/efi/efinet.c | 286 ++++++++++++++++++++++++++++++++++---
include/grub/efi/api.h | 11 ++
2 files changed, 280 insertions(+), 15 deletions(-)
2 files changed, 281 insertions(+), 16 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 014e5bf980..8171ecaa5e 100644
index 92bb7444782..eb68de22023 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -26,6 +26,7 @@
@ -43,7 +43,7 @@ index 014e5bf980..8171ecaa5e 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -331,6 +332,227 @@ grub_efinet_findcards (void)
@@ -348,6 +349,227 @@ grub_efinet_findcards (void)
grub_free (handles);
}
@ -271,7 +271,7 @@ index 014e5bf980..8171ecaa5e 100644
static void
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path)
@@ -346,7 +568,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -367,7 +589,11 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
{
grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe;
@ -284,7 +284,7 @@ index 014e5bf980..8171ecaa5e 100644
if (card->driver != &efidriver)
continue;
@@ -370,11 +596,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -391,11 +617,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
*/
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
@ -307,7 +307,7 @@ index 014e5bf980..8171ecaa5e 100644
dup_ldp = grub_efi_find_last_device_path (dup_dp);
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
@@ -387,23 +623,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -408,23 +644,37 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
@ -347,38 +347,45 @@ index 014e5bf980..8171ecaa5e 100644
+ pxe_mode->dhcp_ack_received ? "yes" : "no",
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue");
grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
(struct grub_net_dhcp6_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
+ packet_buf,
+ packet_bufsz,
1, device, path);
inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
(struct grub_net_dhcp6_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
+ packet_buf,
+ packet_bufsz,
1, device, path);
if (grub_errno)
grub_print_error ();
@@ -417,11 +667,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -438,8 +688,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_dprintf ("efinet", "using ipv4 and dhcp\n");
grub_net_configure_by_dhcp_ack (card->name, card, 0,
(struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
+ packet_buf,
+ packet_bufsz,
1, device, path);
inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
(struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack),
+ packet_buf,
+ packet_bufsz,
1, device, path);
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
@@ -465,8 +715,12 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
vlan_dp = (grub_efi_device_path_t *) ((grub_efi_uint8_t *) vlan_dp + vlan_dp_len);
}
}
- return;
}
+
+ if (nb)
+ grub_netbuff_free (nb);
+
return;
+ return;
}
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 91ab528e4d..4a51667adb 100644
index 53f5c781ac3..fa528e73a27 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -864,6 +864,8 @@ struct grub_efi_ipv4_device_path
@@ -891,6 +891,8 @@ struct grub_efi_ipv4_device_path
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
@ -387,9 +394,9 @@ index 91ab528e4d..4a51667adb 100644
} GRUB_PACKED;
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t;
@@ -918,6 +920,15 @@ struct grub_efi_sata_device_path
@@ -954,6 +956,15 @@ struct grub_efi_vlan_device_path
} GRUB_PACKED;
typedef struct grub_efi_sata_device_path grub_efi_sata_device_path_t;
typedef struct grub_efi_vlan_device_path grub_efi_vlan_device_path_t;
+#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24
+

View file

@ -29,34 +29,34 @@ Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com>
---
grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++
include/grub/efi/api.h | 75 +++++++++++++++++
2 files changed, 238 insertions(+)
include/grub/efi/api.h | 76 +++++++++++++++++
2 files changed, 239 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 8171ecaa5e..715a6168d7 100644
index eb68de22023..a91df09ee6d 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
/* GUID. */
static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
static grub_err_t
send_card_buffer (struct grub_net_card *dev,
@@ -332,6 +334,125 @@ grub_efinet_findcards (void)
@@ -349,6 +351,125 @@ grub_efinet_findcards (void)
grub_free (handles);
}
+static grub_efi_handle_t
+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
+ grub_efi_device_path_t **r_device_path)
+{
+ grub_efi_handle_t handle;
+ grub_efi_status_t status;
+
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
+ status = grub_efi_system_table->boot_services->locate_device_path(
+ protocol, &device_path, &handle);
+
+ if (status != GRUB_EFI_SUCCESS)
@ -92,9 +92,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs)
+ return 0;
+
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ {
@ -103,9 +103,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs)
+ return 0;
+
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -142,9 +142,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs)
+ return 0;
+
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ {
@ -153,9 +153,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs)
+ return 0;
+
+ status = efi_call_4 (conf->get_data, conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -171,7 +171,7 @@ index 8171ecaa5e..715a6168d7 100644
static struct grub_net_buff *
grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6)
{
@@ -390,6 +511,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -407,6 +528,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp;
struct grub_net_bootp_packet *bp;
grub_uint8_t *ptr;
@ -180,7 +180,7 @@ index 8171ecaa5e..715a6168d7 100644
bp = (struct grub_net_bootp_packet *) nb->tail;
err = grub_netbuff_put (nb, sizeof (*bp) + 4);
@@ -451,6 +574,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -468,6 +591,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
*ptr++ = sizeof ("HTTPClient") - 1;
grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1);
@ -206,7 +206,7 @@ index 8171ecaa5e..715a6168d7 100644
ptr = nb->tail;
err = grub_netbuff_put (nb, 1);
if (err)
@@ -483,6 +625,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -500,6 +642,8 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
struct grub_net_dhcp6_option *opt;
struct grub_net_dhcp6_option_iana *iana;
struct grub_net_dhcp6_option_iaaddr *iaaddr;
@ -215,7 +215,7 @@ index 8171ecaa5e..715a6168d7 100644
d6p = (struct grub_net_dhcp6_packet *)nb->tail;
err = grub_netbuff_put (nb, sizeof(*d6p));
@@ -546,6 +690,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -563,6 +707,25 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
opt->len = grub_cpu_to_be16 (uri_len);
grub_memcpy (opt->data, uri_dp->uri, uri_len);
@ -242,14 +242,13 @@ index 8171ecaa5e..715a6168d7 100644
}
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 4a51667adb..0b490195ad 100644
index fa528e73a27..248d6a28ff9 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -352,6 +352,15 @@
#define GRUB_EFI_RNG_PROTOCOL_GUID \
{ 0x3152bca5, 0xeade, 0x433d, \
@@ -369,6 +369,16 @@
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
+
}
+#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \
+ { 0x5b446ed1, 0xe30b, 0x4faa, \
+ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
@ -258,12 +257,14 @@ index 4a51667adb..0b490195ad 100644
+#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \
+ { 0x937fe521, 0x95ae, 0x4d1a, \
+ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
}
struct grub_efi_sal_system_table
@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol
+ }
+
#define LINUX_EFI_INITRD_MEDIA_GUID \
{ 0x5568e427, 0x68fc, 0x4f3d, \
{ 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68 } \
@@ -1963,6 +1973,72 @@ struct grub_efi_load_file2
};
typedef struct grub_efi_rng_protocol grub_efi_rng_protocol_t;
typedef struct grub_efi_load_file2 grub_efi_load_file2_t;
+enum grub_efi_ip4_config2_data_type {
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
@ -331,6 +332,6 @@ index 4a51667adb..0b490195ad 100644
+};
+typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
+
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)
struct initrd_media_device_path {
grub_efi_vendor_media_device_path_t vendor;
grub_efi_device_path_t end;

View file

@ -33,18 +33,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/net/drivers/efi/efinet.c | 27 +
grub-core/net/efi/dhcp.c | 397 ++++++++++
grub-core/net/efi/efi_netfs.c | 57 ++
grub-core/net/efi/http.c | 419 +++++++++++
grub-core/net/efi/http.c | 410 +++++++++++
grub-core/net/efi/ip4_config.c | 398 ++++++++++
grub-core/net/efi/ip6_config.c | 422 +++++++++++
grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++
grub-core/net/efi/pxe.c | 424 +++++++++++
grub-core/net/net.c | 74 ++
util/grub-mknetdir.c | 23 +-
include/grub/efi/api.h | 180 ++++-
include/grub/efi/api.h | 195 ++++-
include/grub/efi/dhcp.h | 343 +++++++++
include/grub/efi/http.h | 215 ++++++
include/grub/net/efi.h | 144 ++++
17 files changed, 4620 insertions(+), 41 deletions(-)
17 files changed, 4618 insertions(+), 49 deletions(-)
create mode 100644 grub-core/net/efi/dhcp.c
create mode 100644 grub-core/net/efi/efi_netfs.c
create mode 100644 grub-core/net/efi/http.c
@ -57,10 +57,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
create mode 100644 include/grub/net/efi.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 52ec0fafcd..12797336c9 100644
index 6645fbae34f..56eb6a828e8 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2300,6 +2300,12 @@ module = {
@@ -2356,6 +2356,12 @@ module = {
common = hook/datehook.c;
};
@ -73,7 +73,7 @@ index 52ec0fafcd..12797336c9 100644
module = {
name = net;
common = net/net.c;
@@ -2313,6 +2319,12 @@ module = {
@@ -2369,6 +2375,12 @@ module = {
common = net/ethernet.c;
common = net/arp.c;
common = net/netbuff.c;
@ -87,7 +87,7 @@ index 52ec0fafcd..12797336c9 100644
module = {
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c
index a458c3aca7..1637731535 100644
index a458c3aca78..1637731535e 100644
--- a/grub-core/io/bufio.c
+++ b/grub-core/io/bufio.c
@@ -139,7 +139,7 @@ grub_bufio_read (grub_file_t file, char *buf, grub_size_t len)
@ -100,10 +100,10 @@ index a458c3aca7..1637731535 100644
if (file->offset + res < next_buf)
{
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
index d6a2fb5778..2a446f5031 100644
index 2bb8a0e7a38..bf16c4307bc 100644
--- a/grub-core/kern/efi/efi.c
+++ b/grub-core/kern/efi/efi.c
@@ -755,7 +755,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -775,7 +775,7 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
{
grub_efi_ipv4_device_path_t *ipv4
= (grub_efi_ipv4_device_path_t *) dp;
@ -112,7 +112,7 @@ index d6a2fb5778..2a446f5031 100644
(unsigned) ipv4->local_ip_address[0],
(unsigned) ipv4->local_ip_address[1],
(unsigned) ipv4->local_ip_address[2],
@@ -768,33 +768,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -788,33 +788,60 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
(unsigned) ipv4->remote_port,
(unsigned) ipv4->protocol,
(unsigned) ipv4->static_ip_address);
@ -190,7 +190,7 @@ index d6a2fb5778..2a446f5031 100644
}
break;
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE:
@@ -834,6 +861,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
@@ -861,6 +888,39 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
break;
@ -231,7 +231,7 @@ index d6a2fb5778..2a446f5031 100644
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
break;
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 715a6168d7..e11d759f19 100644
index a91df09ee6d..225dc896da0 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -27,6 +27,7 @@
@ -242,7 +242,7 @@ index 715a6168d7..e11d759f19 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -491,6 +492,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
@@ -508,6 +509,17 @@ grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *u
ldp = grub_efi_find_last_device_path (ddp);
@ -260,7 +260,7 @@ index 715a6168d7..e11d759f19 100644
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
@@ -760,6 +772,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -781,6 +793,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE
@ -268,7 +268,7 @@ index 715a6168d7..e11d759f19 100644
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
continue;
dup_dp = grub_efi_duplicate_device_path (dp);
@@ -774,6 +787,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -795,6 +808,15 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
dup_ldp->length = sizeof (*dup_ldp);
}
@ -284,7 +284,7 @@ index 715a6168d7..e11d759f19 100644
dup_ldp = grub_efi_find_last_device_path (dup_dp);
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
@@ -845,6 +867,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -889,6 +911,9 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
GRUB_MOD_INIT(efinet)
{
@ -294,8 +294,8 @@ index 715a6168d7..e11d759f19 100644
grub_efinet_findcards ();
grub_efi_net_config = grub_efi_net_config_real;
}
@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet)
FOR_NET_CARDS_SAFE (card, next)
@@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet)
FOR_NET_CARDS_SAFE (card, next)
if (card->driver == &efidriver)
grub_net_card_unregister (card);
+
@ -304,7 +304,7 @@ index 715a6168d7..e11d759f19 100644
diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c
new file mode 100644
index 0000000000..dbef63d8c0
index 00000000000..ca19902441b
--- /dev/null
+++ b/grub-core/net/efi/dhcp.c
@@ -0,0 +1,397 @@
@ -385,7 +385,7 @@ index 0000000000..dbef63d8c0
+ grub_efi_uint32_t option_count = 0;
+ grub_efi_uint32_t i;
+
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, NULL);
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, NULL);
+
+ if (status != GRUB_EFI_BUFFER_TOO_SMALL)
+ return NULL;
@ -394,7 +394,7 @@ index 0000000000..dbef63d8c0
+ if (!option_list)
+ return NULL;
+
+ status = efi_call_4 (dhcp4->parse, dhcp4, reply_packet, &option_count, option_list);
+ status = dhcp4->parse(dhcp4, reply_packet, &option_count, option_list);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_free (option_list);
@ -443,13 +443,13 @@ index 0000000000..dbef63d8c0
+
+ if (!mode->started)
+ {
+ status = efi_call_2 (pxe->start, pxe, 0);
+ status = pxe->start(pxe, 0);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n");
+ }
+
+ status = efi_call_2 (pxe->dhcp, pxe, 0);
+ status = pxe->dhcp(pxe, 0);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp4 configure failed, %d\n", (int)status);
@ -500,7 +500,7 @@ index 0000000000..dbef63d8c0
+ config.option_list = &options;
+
+ /* FIXME: What if the dhcp has bounded */
+ status = efi_call_2 (netdev->dhcp4->configure, netdev->dhcp4, &config);
+ status = netdev->dhcp4->configure(netdev->dhcp4, &config);
+ grub_free (options);
+ if (status != GRUB_EFI_SUCCESS)
+ {
@ -508,14 +508,14 @@ index 0000000000..dbef63d8c0
+ continue;
+ }
+
+ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL);
+ status = netdev->dhcp4->start(netdev->dhcp4, NULL);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp4 start failed, %d\n", (int)status);
+ continue;
+ }
+
+ status = efi_call_2 (netdev->dhcp4->get_mode_data, netdev->dhcp4, &mode);
+ status = netdev->dhcp4->get_mode_data(netdev->dhcp4, &mode);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
@ -616,21 +616,21 @@ index 0000000000..dbef63d8c0
+ config.rapid_commit = 0;
+ config.solicit_retransmission = &retrans;
+
+ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config);
+ status = dev->dhcp6->configure(dev->dhcp6, &config);
+ grub_free (opt);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp6 configure failed, %d\n", (int)status);
+ continue;
+ }
+ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6);
+ status = dev->dhcp6->start(dev->dhcp6);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp6 start failed, %d\n", (int)status);
+ continue;
+ }
+
+ status = efi_call_3 (dev->dhcp6->get_mode_data, dev->dhcp6, &mode, NULL);
+ status = dev->dhcp6->get_mode_data(dev->dhcp6, &mode, NULL);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
@ -666,12 +666,12 @@ index 0000000000..dbef63d8c0
+ grub_efi_dhcp6_packet_option_t **options = NULL;
+ grub_efi_uint32_t i;
+
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, NULL);
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, NULL);
+
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL && count)
+ {
+ options = grub_malloc (count * sizeof(*options));
+ status = efi_call_4 (dev->dhcp6->parse, dev->dhcp6, mode.ia->reply_packet, &count, options);
+ status = dev->dhcp6->parse(dev->dhcp6, mode.ia->reply_packet, &count, options);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -696,8 +696,8 @@ index 0000000000..dbef63d8c0
+ grub_free (options);
+ }
+
+ efi_call_1 (b->free_pool, mode.client_id);
+ efi_call_1 (b->free_pool, mode.ia);
+ b->free_pool(mode.client_id);
+ b->free_pool(mode.ia);
+ }
+
+ return GRUB_ERR_NONE;
@ -707,7 +707,7 @@ index 0000000000..dbef63d8c0
+grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6;
diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c
new file mode 100644
index 0000000000..ef371d885e
index 00000000000..ef371d885ea
--- /dev/null
+++ b/grub-core/net/efi/efi_netfs.c
@@ -0,0 +1,57 @@
@ -770,10 +770,10 @@ index 0000000000..ef371d885e
+}
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
new file mode 100644
index 0000000000..3f61fd2fa5
index 00000000000..de28badccb0
--- /dev/null
+++ b/grub-core/net/efi/http.c
@@ -0,0 +1,419 @@
@@ -0,0 +1,410 @@
+
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
@ -802,9 +802,9 @@ index 0000000000..3f61fd2fa5
+
+ http_config.local_address_is_ipv6 = 1;
+ sz = sizeof (manual_address);
+ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, &manual_address);
+ status = dev->ip6_config->get_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, &manual_address);
+
+ if (status == GRUB_EFI_NOT_FOUND)
+ {
@ -834,19 +834,19 @@ index 0000000000..3f61fd2fa5
+ http_config.access_point.ipv4_node = &httpv4_node;
+ }
+
+ status = efi_call_2 (http->configure, http, &http_config);
+ status = http->configure(http, &http_config);
+
+ if (status == GRUB_EFI_ALREADY_STARTED)
+ {
+ /* XXX: This hangs HTTPS boot */
+#if 0
+ if (efi_call_2 (http->configure, http, NULL) != GRUB_EFI_SUCCESS)
+ if (http->configure(http, NULL) != GRUB_EFI_SUCCESS)
+ {
+ grub_error (GRUB_ERR_IO, N_("couldn't reset http instance"));
+ grub_print_error ();
+ return;
+ }
+ status = efi_call_2 (http->configure, http, &http_config);
+ status = http->configure(http, &http_config);
+#endif
+ return;
+ }
@ -945,12 +945,9 @@ index 0000000000..3f61fd2fa5
+ request_token.message = &request_message;
+
+ request_callback_done = 0;
+ status = efi_call_5 (b->create_event,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
+ GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_request_callback,
+ NULL,
+ &request_token.event);
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_request_callback, NULL,
+ &request_token.event);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
@ -958,17 +955,17 @@ index 0000000000..3f61fd2fa5
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
+ }
+
+ status = efi_call_2 (http->request, http, &request_token);
+ status = http->request(http, &request_token);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ efi_call_1 (b->close_event, request_token.event);
+ b->close_event(request_token.event);
+ grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status);
+ }
+ /* TODO: Add Timeout */
+ while (!request_callback_done)
+ efi_call_1(http->poll, http);
+ http->poll(http);
+
+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS;
+ response_message.data.response = &response_data;
@ -981,16 +978,13 @@ index 0000000000..3f61fd2fa5
+ response_message.body = NULL;
+ response_token.event = NULL;
+
+ status = efi_call_5 (b->create_event,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
+ GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback,
+ NULL,
+ &response_token.event);
+ status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback, NULL,
+ &response_token.event);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ efi_call_1 (b->close_event, request_token.event);
+ b->close_event(request_token.event);
+ grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status);
+ }
@ -1000,28 +994,28 @@ index 0000000000..3f61fd2fa5
+
+ /* wait for HTTP response */
+ response_callback_done = 0;
+ status = efi_call_2 (http->response, http, &response_token);
+ status = http->response(http, &response_token);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ efi_call_1 (b->close_event, response_token.event);
+ efi_call_1 (b->close_event, request_token.event);
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status);
+ }
+
+ /* TODO: Add Timeout */
+ while (!response_callback_done)
+ efi_call_1 (http->poll, http);
+ http->poll(http);
+
+ if (response_message.data.response->status_code != GRUB_EFI_HTTP_STATUS_200_OK)
+ {
+ grub_efi_http_status_code_t status_code = response_message.data.response->status_code;
+
+ if (response_message.headers)
+ efi_call_1 (b->free_pool, response_message.headers);
+ efi_call_1 (b->close_event, response_token.event);
+ efi_call_1 (b->close_event, request_token.event);
+ b->free_pool(response_message.headers);
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ grub_free (request_data.url);
+ if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND)
+ {
@ -1049,9 +1043,9 @@ index 0000000000..3f61fd2fa5
+ }
+
+ if (response_message.headers)
+ efi_call_1 (b->free_pool, response_message.headers);
+ efi_call_1 (b->close_event, response_token.event);
+ efi_call_1 (b->close_event, request_token.event);
+ b->free_pool(response_message.headers);
+ b->close_event(response_token.event);
+ b->close_event(request_token.event);
+ grub_free (request_data.url);
+
+ return GRUB_ERR_NONE;
@ -1076,12 +1070,9 @@ index 0000000000..3f61fd2fa5
+ return -1;
+ }
+
+ efi_call_5 (b->create_event,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL,
+ GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback,
+ NULL,
+ &response_token.event);
+ b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ grub_efi_http_response_callback, NULL,
+ &response_token.event);
+
+ while (len)
+ {
@ -1096,23 +1087,23 @@ index 0000000000..3f61fd2fa5
+
+ response_callback_done = 0;
+
+ status = efi_call_2 (http->response, http, &response_token);
+ status = http->response(http, &response_token);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ efi_call_1 (b->close_event, response_token.event);
+ b->close_event(response_token.event);
+ grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status);
+ return -1;
+ }
+
+ while (!response_callback_done)
+ efi_call_1(http->poll, http);
+ http->poll(http);
+
+ sum += response_message.body_length;
+ buf += response_message.body_length;
+ len -= response_message.body_length;
+ }
+
+ efi_call_1 (b->close_event, response_token.event);
+ b->close_event(response_token.event);
+
+ return sum;
+}
@ -1195,7 +1186,7 @@ index 0000000000..3f61fd2fa5
+ };
diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
new file mode 100644
index 0000000000..b711a5d945
index 00000000000..1deba25e79e
--- /dev/null
+++ b/grub-core/net/efi/ip4_config.c
@@ -0,0 +1,398 @@
@ -1305,17 +1296,17 @@ index 0000000000..b711a5d945
+ if (!interface_info)
+ return NULL;
+
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ {
+ grub_free (interface_info);
+ interface_info = grub_malloc (sz);
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ }
+
+ if (status != GRUB_EFI_SUCCESS)
@ -1339,9 +1330,9 @@ index 0000000000..b711a5d945
+ if (!manual_address)
+ return NULL;
+
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
+ if (status != GRUB_EFI_SUCCESS)
+ {
@ -1546,7 +1537,7 @@ index 0000000000..b711a5d945
+ }
+ }
+
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address);
+
@ -1562,9 +1553,9 @@ index 0000000000..b711a5d945
+{
+ grub_efi_status_t status;
+
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
+ sizeof (address->ip4), &address->ip4);
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
+ sizeof (address->ip4), &address->ip4);
+
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
@ -1578,9 +1569,9 @@ index 0000000000..b711a5d945
+{
+ grub_efi_status_t status;
+
+ status = efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip4), &address->ip4);
+ status = dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip4), &address->ip4);
+
+ if (status != GRUB_EFI_SUCCESS)
+ return 0;
@ -1599,7 +1590,7 @@ index 0000000000..b711a5d945
+ };
diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
new file mode 100644
index 0000000000..017c4d05bc
index 00000000000..29a03973265
--- /dev/null
+++ b/grub-core/net/efi/ip6_config.c
@@ -0,0 +1,422 @@
@ -1729,7 +1720,7 @@ index 0000000000..017c4d05bc
+ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table);
+ interface_info = grub_malloc (sz);
+
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ status = ip6_config->get_data(ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+
@ -1737,7 +1728,7 @@ index 0000000000..017c4d05bc
+ {
+ grub_free (interface_info);
+ interface_info = grub_malloc (sz);
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ status = ip6_config->get_data(ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info);
+ }
@ -1763,7 +1754,7 @@ index 0000000000..017c4d05bc
+ if (!manual_address)
+ return NULL;
+
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ status = ip6_config->get_data(ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -1974,7 +1965,7 @@ index 0000000000..017c4d05bc
+ }
+ }
+
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address);
+
@ -1990,7 +1981,7 @@ index 0000000000..017c4d05bc
+{
+ grub_efi_status_t status;
+
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
+ sizeof (address->ip6), &address->ip6);
+
@ -2006,7 +1997,7 @@ index 0000000000..017c4d05bc
+
+ grub_efi_status_t status;
+
+ status = efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ status = dev->ip6_config->set_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip6), &address->ip6);
+
@ -2027,7 +2018,7 @@ index 0000000000..017c4d05bc
+ };
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
new file mode 100644
index 0000000000..86bce6535d
index 00000000000..1a19ee27144
--- /dev/null
+++ b/grub-core/net/efi/net.c
@@ -0,0 +1,1428 @@
@ -2050,15 +2041,15 @@ index 0000000000..86bce6535d
+
+#define GRUB_EFI_IP6_PREFIX_LENGTH 64
+
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_efi_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
+static grub_efi_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_efi_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
+static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_efi_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_efi_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
+static grub_efi_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_efi_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
+static grub_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID;
+static grub_guid_t ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
+static grub_guid_t http_service_binding_guid = GRUB_EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
+static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
+static grub_guid_t dhcp4_service_binding_guid = GRUB_EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t dhcp4_guid = GRUB_EFI_DHCP4_PROTOCOL_GUID;
+static grub_guid_t dhcp6_service_binding_guid = GRUB_EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID;
+static grub_guid_t dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
+
+struct grub_efi_net_device *net_devices;
+
@ -2073,13 +2064,13 @@ index 0000000000..86bce6535d
+#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__)
+
+static grub_efi_handle_t
+grub_efi_locate_device_path (grub_efi_guid_t *protocol, grub_efi_device_path_t *device_path,
+grub_efi_locate_device_path (grub_guid_t *protocol, grub_efi_device_path_t *device_path,
+ grub_efi_device_path_t **r_device_path)
+{
+ grub_efi_handle_t handle;
+ grub_efi_status_t status;
+
+ status = efi_call_3 (grub_efi_system_table->boot_services->locate_device_path,
+ status = grub_efi_system_table->boot_services->locate_device_path(
+ protocol, &device_path, &handle);
+
+ if (status != GRUB_EFI_SUCCESS)
@ -2721,7 +2712,7 @@ index 0000000000..86bce6535d
+}
+
+static grub_efi_handle_t
+grub_efi_service_binding (grub_efi_handle_t dev, grub_efi_guid_t *service_binding_guid)
+grub_efi_service_binding (grub_efi_handle_t dev, grub_guid_t *service_binding_guid)
+{
+ grub_efi_service_binding_t *service;
+ grub_efi_status_t status;
@ -2734,7 +2725,7 @@ index 0000000000..86bce6535d
+ return NULL;
+ }
+
+ status = efi_call_2 (service->create_child, service, &child_dev);
+ status = service->create_child(service, &child_dev);
+ if (status != GRUB_EFI_SUCCESS)
+ {
+ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status);
@ -2944,7 +2935,7 @@ index 0000000000..86bce6535d
+ {
+ grub_efi_ip4_config2_policy_t ip4_policy = GRUB_EFI_IP4_CONFIG2_POLICY_STATIC;
+
+ if (efi_call_4 (dev->ip4_config->set_data, dev->ip4_config,
+ if (dev->ip4_config->set_data(dev->ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
+ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS)
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP4_CONFIG2_POLICY_STATIC on dev `%s'", dev->card_name);
@ -2953,7 +2944,7 @@ index 0000000000..86bce6535d
+ {
+ grub_efi_ip6_config_policy_t ip6_policy = GRUB_EFI_IP6_CONFIG_POLICY_MANUAL;
+
+ if (efi_call_4 (dev->ip6_config->set_data, dev->ip6_config,
+ if (dev->ip6_config->set_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY,
+ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS)
+ grub_dprintf ("efinetfs", "could not set GRUB_EFI_IP6_CONFIG_POLICY_MANUAL on dev `%s'", dev->card_name);
@ -3461,7 +3452,7 @@ index 0000000000..86bce6535d
+}
diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
new file mode 100644
index 0000000000..531949cba5
index 00000000000..b84f86ea470
--- /dev/null
+++ b/grub-core/net/efi/pxe.c
@@ -0,0 +1,424 @@
@ -3484,7 +3475,7 @@ index 0000000000..531949cba5
+ if (!manual_address)
+ return NULL;
+
+ status = efi_call_4 (ip6_config->get_data, ip6_config,
+ status = ip6_config->get_data(ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -3509,7 +3500,7 @@ index 0000000000..531949cba5
+ if (!manual_address)
+ return NULL;
+
+ status = efi_call_4 (ip4_config->get_data, ip4_config,
+ status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address);
+
@ -3532,7 +3523,7 @@ index 0000000000..531949cba5
+ if (!mode->started)
+ {
+ grub_efi_status_t status;
+ status = efi_call_2 (pxe->start, pxe, prefer_ip6);
+ status = pxe->start(pxe, prefer_ip6);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n");
@ -3555,7 +3546,7 @@ index 0000000000..531949cba5
+ grub_efi_pxe_ip_address_t station_ip;
+
+ grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr));
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, NULL);
+ status = pxe->set_station_ip(pxe, &station_ip, NULL);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't set station ip\n");
@ -3578,7 +3569,7 @@ index 0000000000..531949cba5
+ grub_memcpy (station_ip.v4.addr, manual_address->address, sizeof (station_ip.v4.addr));
+ grub_memcpy (subnet_mask.v4.addr, manual_address->subnet_mask, sizeof (subnet_mask.v4.addr));
+
+ status = efi_call_3 (pxe->set_station_ip, pxe, &station_ip, &subnet_mask);
+ status = pxe->set_station_ip(pxe, &station_ip, &subnet_mask);
+
+ if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't set station ip\n");
@ -3731,7 +3722,7 @@ index 0000000000..531949cba5
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ }
+
+ status = efi_call_10 (pxe->mtftp,
+ status = pxe->mtftp(
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
+ NULL,
@ -3816,7 +3807,7 @@ index 0000000000..531949cba5
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ }
+
+ status = efi_call_10 (pxe->mtftp,
+ status = pxe->mtftp(
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf,
@ -3847,7 +3838,7 @@ index 0000000000..531949cba5
+ return 0;
+ }
+
+ status = efi_call_10 (pxe->mtftp,
+ status = pxe->mtftp(
+ pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf2,
@ -3890,7 +3881,7 @@ index 0000000000..531949cba5
+ };
+
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 0ce5e675ed..55aed92722 100644
index fa6b6537142..fdec64d55ee 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -32,6 +32,9 @@
@ -3903,8 +3894,8 @@ index 0ce5e675ed..55aed92722 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
static grub_command_t cmd_lsroutes, cmd_lscards;
@@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards;
static grub_command_t cmd_lsaddr, cmd_slaac;
+#ifdef GRUB_MACHINE_EFI
@ -3953,7 +3944,7 @@ index 0ce5e675ed..55aed92722 100644
grub_register_variable_hook ("net_default_server", defserver_get_env,
defserver_set_env);
grub_env_export ("net_default_server");
@@ -2082,10 +2126,37 @@ GRUB_MOD_INIT(net)
@@ -2144,10 +2188,37 @@ GRUB_MOD_INIT(net)
grub_net_restore_hw,
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
@ -3991,16 +3982,16 @@ index 0ce5e675ed..55aed92722 100644
grub_register_variable_hook ("net_default_server", 0, 0);
grub_register_variable_hook ("pxe_default_server", 0, 0);
@@ -2104,4 +2175,7 @@ GRUB_MOD_FINI(net)
@@ -2166,4 +2237,7 @@ GRUB_MOD_FINI(net)
grub_net_fini_hw (0);
grub_loader_unregister_preboot_hook (fini_hnd);
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real;
grub_net_poll_cards_idle = NULL;
+#ifdef GRUB_MACHINE_EFI
+ init_mode = INIT_MODE_NONE;
+#endif
}
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c
index a2461cda1c..77958dd9dd 100644
index 46f304c2b47..11c9db11775 100644
--- a/util/grub-mknetdir.c
+++ b/util/grub-mknetdir.c
@@ -32,13 +32,15 @@
@ -4055,7 +4046,7 @@ index a2461cda1c..77958dd9dd 100644
{
const char *mkimage_target;
const char *netmodule;
@@ -156,6 +161,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
@@ -157,6 +162,7 @@ process_input_dir (const char *input_dir, enum grub_install_plat platform)
grub_install_push_module (targets[platform].netmodule);
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext);
@ -4063,7 +4054,7 @@ index a2461cda1c..77958dd9dd 100644
grub_install_make_image_wrap (input_dir, prefix, output,
0, load_cfg,
targets[platform].mkimage_target, 0);
@@ -195,7 +201,16 @@ main (int argc, char *argv[])
@@ -196,7 +202,16 @@ main (int argc, char *argv[])
grub_install_mkdir_p (base);
@ -4082,10 +4073,10 @@ index a2461cda1c..77958dd9dd 100644
if (!grub_install_source_directory)
{
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 0b490195ad..f431f49973 100644
index 248d6a28ff9..805a9d7adf9 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -622,6 +622,23 @@ typedef union
@@ -668,6 +668,23 @@ typedef union
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@ -4107,9 +4098,9 @@ index 0b490195ad..f431f49973 100644
+ grub_efi_pxe_ipv6_address_t v6;
+} grub_efi_pxe_ip_address_t;
struct grub_efi_guid
{
@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path
/* XXX although the spec does not specify the padding, this actually
must have the padding! */
@@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path
grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address;
@ -4118,7 +4109,7 @@ index 0b490195ad..f431f49973 100644
} GRUB_PACKED;
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t;
@@ -938,6 +957,15 @@ struct grub_efi_uri_device_path
@@ -975,6 +994,15 @@ struct grub_efi_uri_device_path
} GRUB_PACKED;
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t;
@ -4134,7 +4125,7 @@ index 0b490195ad..f431f49973 100644
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
/* Media Device Path. */
@@ -1020,6 +1048,23 @@ struct grub_efi_bios_device_path
@@ -1057,6 +1085,23 @@ struct grub_efi_bios_device_path
} GRUB_PACKED;
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t;
@ -4158,7 +4149,7 @@ index 0b490195ad..f431f49973 100644
struct grub_efi_open_protocol_information_entry
{
grub_efi_handle_t agent_handle;
@@ -1569,23 +1614,27 @@ typedef struct grub_efi_pxe_tftp_error
@@ -1617,23 +1662,27 @@ typedef struct grub_efi_pxe_tftp_error
grub_efi_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t;
@ -4200,18 +4191,27 @@ index 0b490195ad..f431f49973 100644
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
typedef struct grub_efi_pxe_ip_filter
@@ -1652,17 +1701,31 @@ typedef struct grub_efi_pxe_mode
@@ -1700,18 +1749,31 @@ typedef struct grub_efi_pxe_mode
typedef struct grub_efi_pxe
{
grub_uint64_t rev;
- void (*start) (void);
- void *start;
- void *stop;
- void *dhcp;
- void *discover;
- void *mftp;
- void *udpwrite;
- void *udpread;
- void *setipfilter;
- void *arp;
- void *setparams;
- void *setstationip;
- void *setpackets;
+ grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6);
void (*stop) (void);
- void (*dhcp) (void);
+ void (*stop) (void);
+ grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this,
+ grub_efi_boolean_t sort_offers);
void (*discover) (void);
- void (*mftp) (void);
+ void (*discover) (void);
+ grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this,
+ grub_efi_pxe_base_code_tftp_opcode_t operation,
+ void *buffer_ptr,
@ -4223,20 +4223,19 @@ index 0b490195ad..f431f49973 100644
+ grub_efi_char8_t *filename,
+ grub_efi_pxe_base_code_mtftp_info_t *info,
+ grub_efi_boolean_t dont_use_buffer);
void (*udpwrite) (void);
void (*udpread) (void);
void (*setipfilter) (void);
void (*arp) (void);
void (*setparams) (void);
- void (*setstationip) (void);
+ void (*udpwrite) (void);
+ void (*udpread) (void);
+ void (*setipfilter) (void);
+ void (*arp) (void);
+ void (*setparams) (void);
+ grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this,
+ grub_efi_pxe_ip_address_t *new_station_ip,
+ grub_efi_pxe_ip_address_t *new_subnet_mask);
+ //void (*setstationip) (void);
void (*setpackets) (void);
+ void (*setpackets) (void);
struct grub_efi_pxe_mode *mode;
} grub_efi_pxe_t;
@@ -1924,6 +1987,44 @@ struct grub_efi_ip4_config2_protocol
@@ -2005,6 +2067,44 @@ struct grub_efi_ip4_config2_protocol
};
typedef struct grub_efi_ip4_config2_protocol grub_efi_ip4_config2_protocol_t;
@ -4281,7 +4280,7 @@ index 0b490195ad..f431f49973 100644
enum grub_efi_ip6_config_data_type {
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID,
@@ -1958,6 +2059,49 @@ struct grub_efi_ip6_config_protocol
@@ -2039,6 +2139,49 @@ struct grub_efi_ip6_config_protocol
};
typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
@ -4328,12 +4327,12 @@ index 0b490195ad..f431f49973 100644
+};
+typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
+
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \
|| defined(__riscv)
struct initrd_media_device_path {
grub_efi_vendor_media_device_path_t vendor;
grub_efi_device_path_t end;
diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h
new file mode 100644
index 0000000000..fdb88eb810
index 00000000000..fdb88eb810e
--- /dev/null
+++ b/include/grub/efi/dhcp.h
@@ -0,0 +1,343 @@
@ -4682,7 +4681,7 @@ index 0000000000..fdb88eb810
+#endif /* ! GRUB_EFI_DHCP_HEADER */
diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h
new file mode 100644
index 0000000000..c5e9a89f50
index 00000000000..c5e9a89f505
--- /dev/null
+++ b/include/grub/efi/http.h
@@ -0,0 +1,215 @@
@ -4903,7 +4902,7 @@ index 0000000000..c5e9a89f50
+#endif /* !GRUB_EFI_HTTP_HEADER */
diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h
new file mode 100644
index 0000000000..de90d223e8
index 00000000000..de90d223e8e
--- /dev/null
+++ b/include/grub/net/efi.h
@@ -0,0 +1,144 @@

View file

@ -18,11 +18,11 @@ signed code is allowed to be executed.
Signed-off-by: Michael Chang <mchang@suse.com>
---
grub-core/net/efi/net.c | 4 +++-
grub-core/net/http.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
grub-core/net/http.c | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
index 86bce6535d..4bb308026c 100644
index 1a19ee27144..ed04f05ad21 100644
--- a/grub-core/net/efi/net.c
+++ b/grub-core/net/efi/net.c
@@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf,
@ -38,20 +38,23 @@ index 86bce6535d..4bb308026c 100644
if (buf)
{
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index 12a2632ea5..b52b558d63 100644
index f389bf03d96..af486198399 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
@@ -29,7 +29,11 @@
enum
{
- HTTP_PORT = 80
GRUB_MOD_LICENSE ("GPLv3+");
-#define HTTP_PORT ((grub_uint16_t) 80)
+enum
+ {
+ HTTP_PORT = 80,
+ HTTP_MAX_CHUNK_SIZE = 0x80000000
};
+ };
@@ -78,6 +79,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
typedef struct http_data
{
@@ -82,6 +86,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
if (data->in_chunk_len == 2)
{
data->chunk_rem = grub_strtoul (ptr, 0, 16);

View file

@ -1,270 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aaron Miller <aaronmiller@fb.com>
Date: Fri, 29 Jul 2016 17:41:38 +0800
Subject: [PATCH] net: read bracketed ipv6 addrs and port numbers
Allow specifying port numbers for http and tftp paths, and allow ipv6 addresses
to be recognized with brackets around them, which is required to specify a port
number
Signed-off-by: Aaron Miller <aaronmiller@fb.com>
[pjones: various bug fixes]
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/http.c | 25 ++++++++++++---
grub-core/net/net.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++---
grub-core/net/tftp.c | 8 +++--
include/grub/net.h | 1 +
4 files changed, 109 insertions(+), 12 deletions(-)
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index b616cf40b1..12a2632ea5 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -289,7 +289,9 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
nb2 = grub_netbuff_alloc (data->chunk_rem);
if (!nb2)
return grub_errno;
- grub_netbuff_put (nb2, data->chunk_rem);
+ err = grub_netbuff_put (nb2, data->chunk_rem);
+ if (err)
+ return grub_errno;
grub_memcpy (nb2->data, nb->data, data->chunk_rem);
if (file->device->net->packs.count >= 20)
{
@@ -312,12 +314,14 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
int i;
struct grub_net_buff *nb;
grub_err_t err;
+ char* server = file->device->net->server;
+ int port = file->device->net->port;
nb = grub_netbuff_alloc (GRUB_NET_TCP_RESERVE_SIZE
+ sizeof ("GET ") - 1
+ grub_strlen (data->filename)
+ sizeof (" HTTP/1.1\r\nHost: ") - 1
- + grub_strlen (file->device->net->server)
+ + grub_strlen (server) + sizeof (":XXXXXXXXXX")
+ sizeof ("\r\nUser-Agent: " PACKAGE_STRING
"\r\n") - 1
+ sizeof ("Range: bytes=XXXXXXXXXXXXXXXXXXXX"
@@ -356,7 +360,7 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
sizeof (" HTTP/1.1\r\nHost: ") - 1);
ptr = nb->tail;
- err = grub_netbuff_put (nb, grub_strlen (file->device->net->server));
+ err = grub_netbuff_put (nb, grub_strlen (server));
if (err)
{
grub_netbuff_free (nb);
@@ -365,6 +369,15 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
grub_memcpy (ptr, file->device->net->server,
grub_strlen (file->device->net->server));
+ if (port)
+ {
+ ptr = nb->tail;
+ grub_snprintf ((char *) ptr,
+ sizeof (":XXXXXXXXXX"),
+ ":%d",
+ port);
+ }
+
ptr = nb->tail;
err = grub_netbuff_put (nb,
sizeof ("\r\nUser-Agent: " PACKAGE_STRING "\r\n")
@@ -390,8 +403,10 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
grub_netbuff_put (nb, 2);
grub_memcpy (ptr, "\r\n", 2);
- data->sock = grub_net_tcp_open (file->device->net->server,
- HTTP_PORT, http_receive,
+ grub_dprintf ("http", "opening path %s on host %s TCP port %d\n",
+ data->filename, server, port ? port : HTTP_PORT);
+ data->sock = grub_net_tcp_open (server,
+ port ? port : HTTP_PORT, http_receive,
http_err, NULL,
file);
if (!data->sock)
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index a46f82362e..0ce5e675ed 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -444,6 +444,13 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
grub_uint16_t newip[8];
const char *ptr = val;
int word, quaddot = -1;
+ int bracketed = 0;
+
+ if (ptr[0] == '[')
+ {
+ bracketed = 1;
+ ptr++;
+ }
if (ptr[0] == ':' && ptr[1] != ':')
return 0;
@@ -482,6 +489,8 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
grub_memset (&newip[quaddot], 0, (7 - word) * sizeof (newip[0]));
}
grub_memcpy (ip, newip, 16);
+ if (bracketed && *ptr == ']')
+ ptr++;
if (rest)
*rest = ptr;
return 1;
@@ -1343,8 +1352,10 @@ grub_net_open_real (const char *name)
{
grub_net_app_level_t proto;
const char *protname, *server;
+ char *host;
grub_size_t protnamelen;
int try;
+ int port = 0;
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
{
@@ -1382,6 +1393,72 @@ grub_net_open_real (const char *name)
return NULL;
}
+ char* port_start;
+ /* ipv6 or port specified? */
+ if ((port_start = grub_strchr (server, ':')))
+ {
+ char* ipv6_begin;
+ if((ipv6_begin = grub_strchr (server, '[')))
+ {
+ char* ipv6_end = grub_strchr (server, ']');
+ if(!ipv6_end)
+ {
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
+ N_("mismatched [ in address"));
+ return NULL;
+ }
+ /* port number after bracketed ipv6 addr */
+ if(ipv6_end[1] == ':')
+ {
+ port = grub_strtoul (ipv6_end + 2, NULL, 10);
+ if(port > 65535)
+ {
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
+ N_("bad port number"));
+ return NULL;
+ }
+ }
+ host = grub_strndup (ipv6_begin, (ipv6_end - ipv6_begin) + 1);
+ }
+ else
+ {
+ if (grub_strchr (port_start + 1, ':'))
+ {
+ int iplen = grub_strlen (server);
+ /* bracket bare ipv6 addrs */
+ host = grub_malloc (iplen + 3);
+ if(!host)
+ {
+ return NULL;
+ }
+ host[0] = '[';
+ grub_memcpy (host + 1, server, iplen);
+ host[iplen + 1] = ']';
+ host[iplen + 2] = '\0';
+ }
+ else
+ {
+ /* hostname:port or ipv4:port */
+ port = grub_strtol (port_start + 1, NULL, 10);
+ if(port > 65535)
+ {
+ grub_error (GRUB_ERR_NET_BAD_ADDRESS,
+ N_("bad port number"));
+ return NULL;
+ }
+ host = grub_strndup (server, port_start - server);
+ }
+ }
+ }
+ else
+ {
+ host = grub_strdup (server);
+ }
+ if (!host)
+ {
+ return NULL;
+ }
+
for (try = 0; try < 2; try++)
{
FOR_NET_APP_LEVEL (proto)
@@ -1391,14 +1468,13 @@ grub_net_open_real (const char *name)
{
grub_net_t ret = grub_zalloc (sizeof (*ret));
if (!ret)
- return NULL;
- ret->protocol = proto;
- ret->server = grub_strdup (server);
- if (!ret->server)
{
- grub_free (ret);
+ grub_free (host);
return NULL;
}
+ ret->protocol = proto;
+ ret->port = port;
+ ret->server = host;
ret->fs = &grub_net_fs;
return ret;
}
@@ -1473,6 +1549,7 @@ grub_net_open_real (const char *name)
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"),
name);
+ grub_free (host);
return NULL;
}
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 4ab2f5c735..d54b13f09f 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename)
grub_err_t err;
grub_uint8_t *nbd;
grub_net_network_level_address_t addr;
+ int port = file->device->net->port;
data = grub_zalloc (sizeof (*data));
if (!data)
@@ -362,14 +363,17 @@ tftp_open (struct grub_file *file, const char *filename)
err = grub_net_resolve_address (file->device->net->server, &addr);
if (err)
{
- grub_dprintf("tftp", "Address resolution failed: %d\n", err);
+ grub_dprintf ("tftp", "Address resolution failed: %d\n", err);
+ grub_dprintf ("tftp", "file_size is %llu, block_size is %llu\n",
+ (unsigned long long)data->file_size,
+ (unsigned long long)data->block_size);
grub_free (data);
return err;
}
grub_dprintf("tftp", "opening connection\n");
data->sock = grub_net_udp_open (addr,
- TFTP_SERVER_PORT, tftp_receive,
+ port ? port : TFTP_SERVER_PORT, tftp_receive,
file);
if (!data->sock)
{
diff --git a/include/grub/net.h b/include/grub/net.h
index af0404db7e..d55d505a03 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -273,6 +273,7 @@ typedef struct grub_net
{
char *server;
char *name;
+ int port;
grub_net_app_level_t protocol;
grub_net_packets_t packs;
grub_off_t offset;

View file

@ -17,7 +17,7 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 file changed, 50 insertions(+)
diff --git a/util/grub-editenv.c b/util/grub-editenv.c
index db6f187cc6..948eec8a11 100644
index db6f187cc63..948eec8a114 100644
--- a/util/grub-editenv.c
+++ b/util/grub-editenv.c
@@ -53,6 +53,9 @@ static struct argp_option options[] = {

View file

@ -43,10 +43,10 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
create mode 100644 util/grub.d/01_menu_auto_hide.in
diff --git a/Makefile.util.def b/Makefile.util.def
index bda9fd1211..cb8e3c3270 100644
index 1079add5bbe..5b9f85d4869 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -458,6 +458,12 @@ script = {
@@ -461,6 +461,12 @@ script = {
installdir = grubconf;
};
@ -61,7 +61,7 @@ index bda9fd1211..cb8e3c3270 100644
common = util/grub.d/01_users.in;
diff --git a/util/grub.d/01_menu_auto_hide.in b/util/grub.d/01_menu_auto_hide.in
new file mode 100644
index 0000000000..ad175870a5
index 00000000000..ad175870a54
--- /dev/null
+++ b/util/grub.d/01_menu_auto_hide.in
@@ -0,0 +1,48 @@
@ -114,7 +114,7 @@ index 0000000000..ad175870a5
+fi
+EOF
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 4b27bd2015..3c9431cfcf 100644
index d7d423b2eaf..18fe02cefd8 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -42,6 +42,7 @@ if [ -z "${OSPROBED}" ] ; then
@ -125,7 +125,7 @@ index 4b27bd2015..3c9431cfcf 100644
# TRANSLATORS: it refers on the OS residing on device %s
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
hints=""
@@ -102,6 +103,7 @@ for OS in ${OSPROBED} ; do
@@ -106,6 +107,7 @@ for OS in ${OSPROBED} ; do
case ${BOOT} in
chain)
@ -133,7 +133,7 @@ index 4b27bd2015..3c9431cfcf 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
@@ -132,6 +134,7 @@ EOF
@@ -136,6 +138,7 @@ EOF
EOF
;;
efi)
@ -141,7 +141,7 @@ index 4b27bd2015..3c9431cfcf 100644
EFIPATH=${DEVICE#*@}
DEVICE=${DEVICE%@*}
@@ -176,6 +179,7 @@ EOF
@@ -180,6 +183,7 @@ EOF
LINITRD="${LINITRD#/boot}"
fi
@ -149,7 +149,7 @@ index 4b27bd2015..3c9431cfcf 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
recovery_params="$(echo "${LPARAMS}" | grep single)" || true
counter=1
@@ -257,6 +261,7 @@ EOF
@@ -261,6 +265,7 @@ EOF
done
;;
hurd)
@ -157,7 +157,7 @@ index 4b27bd2015..3c9431cfcf 100644
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
@@ -283,6 +288,7 @@ EOF
@@ -287,6 +292,7 @@ EOF
EOF
;;
minix)
@ -165,7 +165,7 @@ index 4b27bd2015..3c9431cfcf 100644
cat << EOF
menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" {
EOF
@@ -299,3 +305,15 @@ EOF
@@ -303,3 +309,15 @@ EOF
;;
esac
done

View file

@ -49,10 +49,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 docs/man/grub-set-bootflag.h2m
diff --git a/Makefile.util.def b/Makefile.util.def
index cb8e3c3270..d066652e9b 100644
index 5b9f85d4869..01096ded815 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -1429,3 +1429,10 @@ program = {
@@ -1468,3 +1468,10 @@ program = {
ldadd = grub-core/lib/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
@ -65,7 +65,7 @@ index cb8e3c3270..d066652e9b 100644
+};
diff --git a/util/grub-set-bootflag.c b/util/grub-set-bootflag.c
new file mode 100644
index 0000000000..d506f7e75b
index 00000000000..d506f7e75bc
--- /dev/null
+++ b/util/grub-set-bootflag.c
@@ -0,0 +1,172 @@
@ -242,7 +242,7 @@ index 0000000000..d506f7e75b
+ return 0;
+}
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
index 8f1485d52a..ad235de7fc 100644
index 5e7126f9878..26ac8765e30 100644
--- a/conf/Makefile.extra-dist
+++ b/conf/Makefile.extra-dist
@@ -15,6 +15,9 @@ EXTRA_DIST += docs/man
@ -257,7 +257,7 @@ index 8f1485d52a..ad235de7fc 100644
diff --git a/docs/grub-boot-success.service b/docs/grub-boot-success.service
new file mode 100644
index 0000000000..80e79584c9
index 00000000000..80e79584c91
--- /dev/null
+++ b/docs/grub-boot-success.service
@@ -0,0 +1,6 @@
@ -269,7 +269,7 @@ index 0000000000..80e79584c9
+ExecStart=/usr/sbin/grub2-set-bootflag boot_success
diff --git a/docs/grub-boot-success.timer b/docs/grub-boot-success.timer
new file mode 100644
index 0000000000..406f172005
index 00000000000..406f1720056
--- /dev/null
+++ b/docs/grub-boot-success.timer
@@ -0,0 +1,7 @@
@ -282,7 +282,7 @@ index 0000000000..406f172005
+OnActiveSec=2min
diff --git a/docs/man/grub-set-bootflag.h2m b/docs/man/grub-set-bootflag.h2m
new file mode 100644
index 0000000000..94ec0b92ed
index 00000000000..94ec0b92ede
--- /dev/null
+++ b/docs/man/grub-set-bootflag.h2m
@@ -0,0 +1,2 @@

View file

@ -16,7 +16,7 @@ Signed-off-by: Hans de Goede <hdegoede@redhat.com>
diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service
new file mode 100644
index 0000000000..6c8dcb186b
index 00000000000..6c8dcb186b6
--- /dev/null
+++ b/docs/grub-boot-indeterminate.service
@@ -0,0 +1,11 @@

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/gentpl.py b/gentpl.py
index c86550d4f9..f3c5f84f85 100644
index bfab2113a1d..6cad9b8231f 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -592,11 +592,21 @@ def platform_conditional(platform, closure):
@@ -594,11 +594,21 @@ def platform_conditional(platform, closure):
# };
#
def foreach_enabled_platform(defn, closure):
@ -35,7 +35,7 @@ index c86550d4f9..f3c5f84f85 100644
for platform in GRUB_PLATFORMS:
platform_conditional(platform, closure)
@@ -655,6 +665,8 @@ def first_time(defn, snippet):
@@ -657,6 +667,8 @@ def first_time(defn, snippet):
def is_platform_independent(defn):
if 'enable' in defn:
return False

View file

@ -9,14 +9,14 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+)
diff --git a/gentpl.py b/gentpl.py
index f3c5f84f85..f09b336869 100644
index 6cad9b8231f..597129a2bc4 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -51,6 +51,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
GROUPS["riscv64"] = [ "riscv64_efi" ]
@@ -52,6 +52,7 @@ GROUPS["riscv32"] = [ "riscv32_efi" ]
GROUPS["riscv64"] = [ "riscv64_efi" ]
# Groups based on firmware
+GROUPS["pc"] = [ "i386_pc" ]
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi", "arm_efi", "arm64_efi",
"riscv32_efi", "riscv64_efi" ]
"loongarch64_efi", "riscv32_efi", "riscv64_efi" ]
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]

View file

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
index 4bb308026c..6603cd83ed 100644
index ed04f05ad21..1f7e1b63557 100644
--- a/grub-core/net/efi/net.c
+++ b/grub-core/net/efi/net.c
@@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void)

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 19 insertions(+)
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
index 3f61fd2fa5..243acbaa35 100644
index de28badccb0..b94dbc68eef 100644
--- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c
@@ -4,6 +4,7 @@
@ -23,7 +23,7 @@ index 3f61fd2fa5..243acbaa35 100644
static void
http_configure (struct grub_efi_net_device *dev, int prefer_ip6)
@@ -351,6 +352,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
@@ -342,6 +343,24 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
grub_err_t err;
grub_off_t size;
char *buf;

View file

@ -17,11 +17,11 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac
index 302300711f..008f6c273b 100644
index fcfbcbb664d..c17e83acf87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -849,11 +849,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
@@ -914,11 +914,23 @@ if test "x$target_cpu" = xloongarch64; then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs"
fi
+# Should grub utils get the host CFLAGS, or the target CFLAGS?
@ -45,7 +45,7 @@ index 302300711f..008f6c273b 100644
AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
grub_cv_target_cc_soft_float=no
if test "x$target_cpu" = xarm64; then
@@ -1954,6 +1966,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
@@ -2111,6 +2123,41 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
@ -88,19 +88,19 @@ index 302300711f..008f6c273b 100644
GRUB_PLATFORM="${platform}"
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 5f0ef96985..2ff9b39357 100644
index 6262f21a772..54f0f7f7664 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .eh_frame -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx -R .note.gnu.property -R .gnu.build.attributes
@@ -50,24 +50,25 @@ else
endif
endif
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
-LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r
-CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
+LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r
+CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
@ -129,10 +129,10 @@ index 5f0ef96985..2ff9b39357 100644
# Other variables
diff --git a/gentpl.py b/gentpl.py
index f09b336869..0e62e14666 100644
index 597129a2bc4..5826a6b14e8 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -697,10 +697,10 @@ def module(defn, platform):
@@ -699,10 +699,10 @@ def module(defn, platform):
var_set(cname(defn) + "_SOURCES", platform_sources(defn, platform) + " ## platform sources")
var_set("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))

View file

@ -17,18 +17,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
grub-core/Makefile.core.def | 5 ++---
grub-core/Makefile.core.def | 4 ++--
grub-core/lib/fdt.c | 2 --
grub-core/loader/efi/fdt.c | 2 ++
include/grub/fdt.h | 6 ++++++
grub-core/Makefile.am | 1 +
5 files changed, 11 insertions(+), 5 deletions(-)
5 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 12797336c9..4e7d90da76 100644
index 56eb6a828e8..4629c179e40 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -177,7 +177,6 @@ kernel = {
@@ -188,7 +188,6 @@ kernel = {
arm_coreboot = kern/arm/coreboot/init.c;
arm_coreboot = kern/arm/coreboot/timer.c;
arm_coreboot = kern/arm/coreboot/coreboot.S;
@ -36,7 +36,7 @@ index 12797336c9..4e7d90da76 100644
arm_coreboot = bus/fdt.c;
arm_coreboot = term/ps2.c;
arm_coreboot = term/arm/pl050.c;
@@ -351,6 +350,8 @@ kernel = {
@@ -370,6 +369,8 @@ kernel = {
riscv64 = kern/riscv/cache_flush.S;
riscv64 = kern/riscv/dl.c;
@ -45,15 +45,7 @@ index 12797336c9..4e7d90da76 100644
emu = disk/host.c;
emu = kern/emu/cache_s.S;
emu = kern/emu/hostdisk.c;
@@ -1825,7 +1826,6 @@ module = {
riscv32 = loader/riscv/linux.c;
riscv64 = loader/riscv/linux.c;
emu = loader/emu/linux.c;
- fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
@@ -1837,7 +1837,6 @@ module = {
@@ -1882,7 +1883,6 @@ module = {
module = {
name = fdt;
efi = loader/efi/fdt.c;
@ -62,7 +54,7 @@ index 12797336c9..4e7d90da76 100644
};
diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
index 0d371c5633..37e04bd69e 100644
index 73cfa94a2df..fbf749e1d61 100644
--- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c
@@ -21,8 +21,6 @@
@ -75,7 +67,7 @@ index 0d371c5633..37e04bd69e 100644
#define FDT_BEGIN_NODE 0x00000001
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
index c86f283d75..c572415d38 100644
index 439964b9ca6..e08d8738afc 100644
--- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c
@@ -27,6 +27,8 @@
@ -88,7 +80,7 @@ index c86f283d75..c572415d38 100644
static void *fdt;
diff --git a/include/grub/fdt.h b/include/grub/fdt.h
index e609c7e411..3514aa4a5b 100644
index e609c7e4111..3514aa4a5b6 100644
--- a/include/grub/fdt.h
+++ b/include/grub/fdt.h
@@ -19,6 +19,9 @@
@ -110,7 +102,7 @@ index e609c7e411..3514aa4a5b 100644
+
#endif /* ! GRUB_FDT_HEADER */
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index bfd29a3bf0..c2e8a82bce 100644
index b7192a3da82..7953ba95399 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h

View file

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index 008f6c273b..54462e0892 100644
index c17e83acf87..3f3a170ab17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1260,6 +1260,26 @@ if test "x$target_cpu" = xarm; then
@@ -1346,6 +1346,26 @@ if test "x$target_cpu" = xarm; then
done
])

View file

@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
index d1de9fa687..1c540fc8c2 100644
index 463dafdba02..7347a8de676 100644
--- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c
@@ -131,11 +131,19 @@ grub_set_prefix_and_root (void)
@ -41,7 +41,7 @@ index d1de9fa687..1c540fc8c2 100644
}
}
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
index 243acbaa35..de351b2cd0 100644
index b94dbc68eef..5e97f5d5e70 100644
--- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c
@@ -9,10 +9,52 @@
@ -97,7 +97,7 @@ index 243acbaa35..de351b2cd0 100644
grub_efi_http_t *http = dev->http;
@@ -352,32 +394,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
@@ -343,32 +385,32 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
grub_err_t err;
grub_off_t size;
char *buf;

View file

@ -10,7 +10,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
index 53c734de70..aebfe0cf83 100644
index 53c734de70e..aebfe0cf839 100644
--- a/grub-core/kern/err.c
+++ b/grub-core/kern/err.c
@@ -33,15 +33,24 @@ static struct grub_error_saved grub_error_stack_items[GRUB_ERROR_STACK_SIZE];
@ -41,10 +41,10 @@ index 53c734de70..aebfe0cf83 100644
return n;
diff --git a/include/grub/err.h b/include/grub/err.h
index b08d5d0de4..c0f90ef07c 100644
index 1c07034cd60..3c587b9b822 100644
--- a/include/grub/err.h
+++ b/include/grub/err.h
@@ -85,8 +85,12 @@ struct grub_error_saved
@@ -86,8 +86,12 @@ struct grub_error_saved
extern grub_err_t EXPORT_VAR(grub_errno);
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/grub-core/commands/reboot.c b/grub-core/commands/reboot.c
index 46d364c99a..f5cc228363 100644
index 46d364c99a9..f5cc2283636 100644
--- a/grub-core/commands/reboot.c
+++ b/grub-core/commands/reboot.c
@@ -32,15 +32,18 @@ grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),

View file

@ -19,10 +19,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
create mode 100644 grub-core/commands/version.c
diff --git a/configure.ac b/configure.ac
index 54462e0892..7b4e1854d3 100644
index 3f3a170ab17..2175aa56997 100644
--- a/configure.ac
+++ b/configure.ac
@@ -284,6 +284,19 @@ AC_SUBST(target_cpu)
@@ -289,6 +289,19 @@ AC_SUBST(target_cpu)
AC_SUBST(platform)
# Define default variables
@ -43,10 +43,10 @@ index 54462e0892..7b4e1854d3 100644
have_with_bootdir=n
AC_ARG_WITH([bootdir],
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 4e7d90da76..4f203533f5 100644
index 4629c179e40..f26c689723c 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -579,6 +579,11 @@ image = {
@@ -598,6 +598,11 @@ image = {
enable = mips_loongson;
};
@ -60,7 +60,7 @@ index 4e7d90da76..4f203533f5 100644
common = lib/disk.c;
diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c
new file mode 100644
index 0000000000..de0acb07ba
index 00000000000..de0acb07ba2
--- /dev/null
+++ b/grub-core/commands/version.c
@@ -0,0 +1,56 @@
@ -121,14 +121,14 @@ index 0000000000..de0acb07ba
+ grub_unregister_command (cmd);
+}
diff --git a/config.h.in b/config.h.in
index 9e8f9911b1..c7e316f0f1 100644
index 9b1d3997185..d294d2c653f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -59,6 +59,7 @@
@@ -63,6 +63,7 @@
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
+#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@"
# define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
# define GRUB_PLATFORM "@GRUB_PLATFORM@"
+# define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@"
#define RE_ENABLE_I18N 1
# define GRUB_STACK_PROTECTOR_INIT @GRUB_STACK_PROTECTOR_INIT@

View file

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
4 files changed, 10 insertions(+)
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
index 0320115662..7cdffe3ebd 100644
index 21e2395111a..c35ce8915b2 100644
--- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c
@@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter)
@ -24,7 +24,7 @@ index 0320115662..7cdffe3ebd 100644
if (!accept_diskfilter && is_valid_diskfilter_name (name))
return 0;
@@ -1212,6 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
@@ -1247,6 +1249,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
the same. */
if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
return GRUB_ERR_NONE;
@ -33,10 +33,10 @@ index 0320115662..7cdffe3ebd 100644
if (!pv->disk)
return grub_errno;
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index f077b5f553..fe8ba6e6c9 100644
index 3b5ed569133..822005456eb 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
@@ -865,6 +865,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
return 0;
}
@ -45,7 +45,7 @@ index f077b5f553..fe8ba6e6c9 100644
grub_free (dup_dp);
diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c
index 73b8ecc0c0..f58b58c89d 100644
index 670e213cf3c..d019637470d 100644
--- a/grub-core/kern/device.c
+++ b/grub-core/kern/device.c
@@ -34,6 +34,7 @@ grub_device_open (const char *name)
@ -57,7 +57,7 @@ index 73b8ecc0c0..f58b58c89d 100644
{
name = grub_env_get ("root");
diff --git a/grub-core/script/script.c b/grub-core/script/script.c
index ec4d4337c6..844e8343ca 100644
index ec4d4337c66..844e8343ca7 100644
--- a/grub-core/script/script.c
+++ b/grub-core/script/script.c
@@ -22,6 +22,11 @@

View file

@ -9,19 +9,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/lib/reed_solomon.c | 4 ++--
grub-core/osdep/linux/blocklist.c | 2 +-
grub-core/osdep/linux/getroot.c | 2 +-
grub-core/osdep/linux/hostdisk.c | 2 +-
util/grub-fstest.c | 2 +-
util/grub-menulst2cfg.c | 2 +-
util/grub-mkfont.c | 13 +++++++------
util/grub-probe.c | 2 +-
util/setup.c | 2 +-
10 files changed, 17 insertions(+), 16 deletions(-)
9 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
index 0ff13bcaf8..d278c2921f 100644
index 16c79bc9488..d145e5796b3 100644
--- a/grub-core/kern/emu/misc.c
+++ b/grub-core/kern/emu/misc.c
@@ -185,7 +185,7 @@ grub_util_get_image_size (const char *path)
@@ -189,7 +189,7 @@ grub_util_get_image_size (const char *path)
sz = ftello (f);
if (sz < 0)
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
@ -31,10 +30,10 @@ index 0ff13bcaf8..d278c2921f 100644
ret = (size_t) sz;
diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c
index 467305b46a..79037c093f 100644
index 562bd2e3e3f..5fee7f2a1a4 100644
--- a/grub-core/lib/reed_solomon.c
+++ b/grub-core/lib/reed_solomon.c
@@ -157,7 +157,7 @@ static void
@@ -162,7 +162,7 @@ static void
rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs)
{
gf_single_t *rs_polynomial;
@ -43,7 +42,7 @@ index 467305b46a..79037c093f 100644
gf_single_t *m;
m = xcalloc (s + rs, sizeof (gf_single_t));
grub_memcpy (m, data, s * sizeof (gf_single_t));
@@ -324,7 +324,7 @@ static void
@@ -333,7 +333,7 @@ static void
encode_block (gf_single_t *ptr, grub_size_t s,
gf_single_t *rptr, grub_size_t rs)
{
@ -53,7 +52,7 @@ index 467305b46a..79037c093f 100644
{
grub_size_t ds = (s + SECTOR_SIZE - 1 - i) / SECTOR_SIZE;
diff --git a/grub-core/osdep/linux/blocklist.c b/grub-core/osdep/linux/blocklist.c
index c77d6085cc..42a315031f 100644
index 2efee2c2aee..902cfee53ae 100644
--- a/grub-core/osdep/linux/blocklist.c
+++ b/grub-core/osdep/linux/blocklist.c
@@ -109,7 +109,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
@ -66,10 +65,10 @@ index c77d6085cc..42a315031f 100644
+ fie1.fm_mapped_extents
* sizeof (fie1.fm_extents[1]));
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 28790307e0..9f730b3518 100644
index 74a48c03026..477fb420992 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -236,7 +236,7 @@ grub_find_root_devices_from_btrfs (const char *dir)
@@ -233,7 +233,7 @@ grub_find_root_devices_from_btrfs (const char *dir)
{
int fd;
struct btrfs_ioctl_fs_info_args fsi;
@ -78,24 +77,11 @@ index 28790307e0..9f730b3518 100644
char **ret;
fd = open (dir, 0);
diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c
index da62f924e3..7bc99ac1c1 100644
--- a/grub-core/osdep/linux/hostdisk.c
+++ b/grub-core/osdep/linux/hostdisk.c
@@ -83,7 +83,7 @@ grub_util_get_fd_size_os (grub_util_fd_t fd, const char *name, unsigned *log_sec
if (sector_size & (sector_size - 1) || !sector_size)
return -1;
for (log_sector_size = 0;
- (1 << log_sector_size) < sector_size;
+ (1U << log_sector_size) < sector_size;
log_sector_size++);
if (log_secsize)
diff --git a/util/grub-fstest.c b/util/grub-fstest.c
index 8386564200..bfcef852d8 100644
index 25ae52ab6f4..982ce9ed7d8 100644
--- a/util/grub-fstest.c
+++ b/util/grub-fstest.c
@@ -323,7 +323,7 @@ cmd_cmp (char *src, char *dest)
@@ -329,7 +329,7 @@ cmd_cmp (char *src, char *dest)
read_file (src, cmp_hook, ff);
{
@ -105,7 +91,7 @@ index 8386564200..bfcef852d8 100644
fseek (ff, 0, SEEK_END);
if (pre != ftell (ff))
diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c
index a39f869394..358d604210 100644
index b80e15cc36e..1ea2a86e129 100644
--- a/util/grub-menulst2cfg.c
+++ b/util/grub-menulst2cfg.c
@@ -34,7 +34,7 @@ main (int argc, char **argv)
@ -118,10 +104,10 @@ index a39f869394..358d604210 100644
grub_util_host_init (&argc, &argv);
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c
index 0fe45a6103..3e09240b99 100644
index 7624d7808b7..e8a914021b2 100644
--- a/util/grub-mkfont.c
+++ b/util/grub-mkfont.c
@@ -138,7 +138,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
@@ -143,7 +143,8 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
int width, height;
int cuttop, cutbottom, cutleft, cutright;
grub_uint8_t *data;
@ -131,7 +117,7 @@ index 0fe45a6103..3e09240b99 100644
FT_GlyphSlot glyph;
int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME;
FT_Error err;
@@ -183,7 +184,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
@@ -188,7 +189,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
cuttop = cutbottom = cutleft = cutright = 0;
else
{
@ -140,7 +126,7 @@ index 0fe45a6103..3e09240b99 100644
{
for (j = 0; j < glyph->bitmap.width; j++)
if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch]
@@ -203,10 +204,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
@@ -208,10 +209,10 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
break;
}
cutbottom = glyph->bitmap.rows - 1 - cutbottom;
@ -153,7 +139,7 @@ index 0fe45a6103..3e09240b99 100644
{
for (j = 0; j < glyph->bitmap.rows; j++)
if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch]
@@ -225,7 +226,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
@@ -230,7 +231,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
break;
}
cutright = glyph->bitmap.width - 1 - cutright;
@ -162,7 +148,7 @@ index 0fe45a6103..3e09240b99 100644
cutright = 0;
}
@@ -262,7 +263,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
@@ -267,7 +268,7 @@ add_glyph (struct grub_font_info *font_info, FT_UInt glyph_idx, FT_Face face,
mask = 0;
data = &glyph_info->bitmap[0] - 1;
@ -172,10 +158,10 @@ index 0fe45a6103..3e09240b99 100644
add_pixel (&data, &mask,
glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] &
diff --git a/util/grub-probe.c b/util/grub-probe.c
index c08e46bbb4..c6fac732b4 100644
index 65c1ca3f8b6..08ae915e8d7 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -798,7 +798,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
@@ -799,7 +799,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
case 't':
{
@ -185,7 +171,7 @@ index c08e46bbb4..c6fac732b4 100644
for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++)
if (strcmp (arg, targets[i]) == 0)
diff --git a/util/setup.c b/util/setup.c
index da5f2c07f5..8b22bb8cca 100644
index 87a889ff7e3..7aab468b0eb 100644
--- a/util/setup.c
+++ b/util/setup.c
@@ -406,7 +406,7 @@ SETUP (const char *dir,

View file

@ -4,33 +4,21 @@ Date: Thu, 11 Jul 2019 18:20:37 +0200
Subject: [PATCH] Don't use -Wno-sign-compare -Wno-conversion -Wno-error, do
use -Wextra.
Updated for grub-2.12 which introduced new sign comparison problems:
we're using -Wno-error=sign-compare
Signed-off-by: Peter Jones <pjones@redhat.com>
---
configure.ac | 14 +++++++++++---
conf/Makefile.common | 2 +-
2 files changed, 12 insertions(+), 4 deletions(-)
configure.ac | 8 ++++++++
conf/Makefile.common | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 7b4e1854d3..490353713a 100644
index 2175aa56997..81240397384 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1452,11 +1452,11 @@ fi
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test x"$platform" = xemu ; then
-CFLAGS="$TARGET_CFLAGS -Wno-error"
+CFLAGS="$TARGET_CFLAGS"
elif test "x$TARGET_APPLE_LINKER" = x1 ; then
-CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
+CFLAGS="$TARGET_CFLAGS -nostdlib -static"
else
-CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
+CFLAGS="$TARGET_CFLAGS -nostdlib"
fi
CPPFLAGS="$TARGET_CPPFLAGS"
@@ -1990,6 +1990,14 @@ if test x"$enable_werror" != xno ; then
HOST_CFLAGS="$HOST_CFLAGS -Werror"
@@ -2147,6 +2147,14 @@ if test x"$enable_werror" != xno ; then
fi
fi
+AC_ARG_ENABLE([wextra],
@ -45,15 +33,15 @@ index 7b4e1854d3..490353713a 100644
TARGET_CCAS=$TARGET_CC
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 2ff9b39357..35e14ff017 100644
index 54f0f7f7664..e53ff352407 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d
@@ -76,7 +76,7 @@ grubconfdir = $(sysconfdir)/grub.d
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
starfielddir = $(pkgdatadir)/themes/starfield
-CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion
+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code
-CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=attributes
+CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib
CFLAGS_POSIX = -fno-builtin

View file

@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 1 Aug 2018 10:24:52 -0400
Subject: [PATCH] module-verifier: make it possible to run checkers on
grub-module-verifierxx.c
This makes it so you can treat grub-module-verifierxx.c as a file you can
build directly, so syntax checkers like vim's "syntastic" plugin, which uses
"gcc -x c -fsyntax-only" to build it, will work.
One still has to do whatever setup is required to make it pick the right
include dirs, which -W options we use, etc., but this makes it so you can do
the checking on the file you're editing, rather than on a different file.
v2: fix the typo in the #else clause in util/grub-module-verifierXX.c
Signed-off-by: Peter Jones <pjones@redhat.com>
---
util/grub-module-verifier32.c | 2 ++
util/grub-module-verifier64.c | 2 ++
util/grub-module-verifierXX.c | 9 +++++++++
3 files changed, 13 insertions(+)
diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c
index 257229f8f0..ba7d41aafe 100644
--- a/util/grub-module-verifier32.c
+++ b/util/grub-module-verifier32.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF32 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c
index 4db6b4bedd..fc23ef800b 100644
--- a/util/grub-module-verifier64.c
+++ b/util/grub-module-verifier64.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF64 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index ceb24309ae..a98e2f9b1a 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -1,3 +1,12 @@
+#define GRUB_MODULE_VERIFIERXX
+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64)
+#if __SIZEOF_POINTER__ == 8
+#include "grub-module-verifier64.c"
+#else
+#include "grub-module-verifier32.c"
+#endif
+#endif
+
#include <string.h>
#include <grub/elf.h>

View file

@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 9f730b3518..f0c503f43d 100644
index 477fb420992..b32582eb302 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -1264,22 +1264,20 @@ grub_util_get_grub_dev_os (const char *os_dev)
@@ -1261,22 +1261,20 @@ grub_util_get_grub_dev_os (const char *os_dev)
return grub_dev;
}

View file

@ -10,10 +10,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 490353713a..a02d40a05b 100644
index 81240397384..ae7683d0693 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1998,6 +1998,9 @@ if test x"$enable_wextra" != xno ; then
@@ -2155,6 +2155,9 @@ if test x"$enable_wextra" != xno ; then
HOST_CFLAGS="$HOST_CFLAGS -Wextra"
fi
@ -24,15 +24,15 @@ index 490353713a..a02d40a05b 100644
TARGET_CCAS=$TARGET_CC
diff --git a/conf/Makefile.common b/conf/Makefile.common
index 35e14ff017..0647c53b91 100644
index e53ff352407..91ff6c905fb 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -66,7 +66,7 @@ grubconfdir = $(sysconfdir)/grub.d
@@ -76,7 +76,7 @@ grubconfdir = $(sysconfdir)/grub.d
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
starfielddir = $(pkgdatadir)/themes/starfield
-CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code
+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Werror=trampolines -fno-trampolines
-CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes
+CFLAGS_GNULIB = -Wno-undef -Wno-error=sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-error=attributes -Werror=trampolines -fno-trampolines
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib
CFLAGS_POSIX = -fno-builtin

View file

@ -23,10 +23,10 @@ Signed-off-by: Christian Glombek <lorbus@fedoraproject.org>
create mode 100644 util/grub.d/01_fallback_counting.in
diff --git a/Makefile.util.def b/Makefile.util.def
index d066652e9b..e10fe766d1 100644
index 01096ded815..0bb47c6d40a 100644
--- a/Makefile.util.def
+++ b/Makefile.util.def
@@ -458,6 +458,12 @@ script = {
@@ -461,6 +461,12 @@ script = {
installdir = grubconf;
};
@ -40,10 +40,10 @@ index d066652e9b..e10fe766d1 100644
name = '01_menu_auto_hide';
common = util/grub.d/01_menu_auto_hide.in;
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 4f203533f5..ea4d59f51b 100644
index f26c689723c..08c0c67bcf2 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -398,6 +398,11 @@ kernel = {
@@ -417,6 +417,11 @@ kernel = {
extra_dist = kern/mips/cache_flush.S;
};
@ -57,7 +57,7 @@ index 4f203533f5..ea4d59f51b 100644
mansection = 1;
diff --git a/grub-core/commands/increment.c b/grub-core/commands/increment.c
new file mode 100644
index 0000000000..79cf137656
index 00000000000..79cf137656c
--- /dev/null
+++ b/grub-core/commands/increment.c
@@ -0,0 +1,105 @@
@ -168,7 +168,7 @@ index 0000000000..79cf137656
+}
diff --git a/util/grub.d/01_fallback_counting.in b/util/grub.d/01_fallback_counting.in
new file mode 100644
index 0000000000..be0e770ea8
index 00000000000..be0e770ea82
--- /dev/null
+++ b/util/grub.d/01_fallback_counting.in
@@ -0,0 +1,22 @@

Some files were not shown because too many files have changed in this diff Show more