import grub2-2.12-1.el10

i10cs changed/i10cs/grub2-2.12-1.el10
MSVSphere Packaging Team 1 month ago
parent d4ef6a9d9a
commit 7e77ff6dd0
Signed by: sys_gitsync
GPG Key ID: B2B0B9F29E528FE8

2
.gitignore vendored

@ -1,4 +1,4 @@
SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz
SOURCES/grub-2.06.tar.xz SOURCES/grub-2.12.tar.xz
SOURCES/theme.tar.bz2 SOURCES/theme.tar.bz2
SOURCES/unifont-13.0.06.pcf.gz SOURCES/unifont-13.0.06.pcf.gz

@ -1,4 +1,4 @@
d08376d97163f99ce0d61fce160d6f7667c5c944 SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz d08376d97163f99ce0d61fce160d6f7667c5c944 SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz
c9f93f1e195ec7a5a21d36a13b469788c0b29f0f SOURCES/grub-2.06.tar.xz 9a5cd9860a02d479ff65461b710a4d85ea46b9f4 SOURCES/grub-2.12.tar.xz
cf0b7763c528902da7e8b05cfa248f20c8825ce5 SOURCES/theme.tar.bz2 cf0b7763c528902da7e8b05cfa248f20c8825ce5 SOURCES/theme.tar.bz2
3b39cb0830367171760ec536cab805abdbe08bc5 SOURCES/unifont-13.0.06.pcf.gz 3b39cb0830367171760ec536cab805abdbe08bc5 SOURCES/unifont-13.0.06.pcf.gz

@ -10,7 +10,7 @@ This reverts commit 722737630889607c3b5761f1f5a48f1674cd2821.
1 file changed, 1 insertion(+), 1 deletion(-) 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 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 --- a/util/grub.d/30_os-prober.in
+++ b/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 @@ -36,7 +36,7 @@ if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/n

@ -10,7 +10,7 @@ This reverts commit 54e0a1bbf1e9106901a557195bb35e5e20fb3925.
2 files changed, 5 insertions(+), 8 deletions(-) 2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in 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 --- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in
@@ -140,9 +140,6 @@ GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2 @@ -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_FS \
GRUB_FONT \ GRUB_FONT \
GRUB_PRELOAD_MODULES \ GRUB_PRELOAD_MODULES \
@@ -246,6 +242,7 @@ export GRUB_DEFAULT \ @@ -250,6 +246,7 @@ export GRUB_DEFAULT \
GRUB_BACKGROUND \ GRUB_BACKGROUND \
GRUB_THEME \ GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \ GRUB_GFXPAYLOAD_LINUX \
@ -40,7 +40,7 @@ index f8cbb8d7a2..d3e879b8e5 100644
GRUB_SAVEDEFAULT \ GRUB_SAVEDEFAULT \
GRUB_ENABLE_CRYPTODISK \ GRUB_ENABLE_CRYPTODISK \
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in 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 --- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@" @@ -26,8 +26,8 @@ export TEXTDOMAINDIR="@localedir@"

@ -10,10 +10,10 @@ This reverts commit e346414725a70e5c74ee87ca14e580c66f517666.
2 files changed, 9 insertions(+), 14 deletions(-) 2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/docs/grub.texi b/docs/grub.texi diff --git a/docs/grub.texi b/docs/grub.texi
index f8b4b3b21a..69f08d289f 100644 index a225f9a88d2..974bc0ddb07 100644
--- a/docs/grub.texi --- a/docs/grub.texi
+++ b/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. GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER @item GRUB_DISABLE_OS_PROBER
@ -31,7 +31,7 @@ index f8b4b3b21a..69f08d289f 100644
@item GRUB_OS_PROBER_SKIP_LIST @item GRUB_OS_PROBER_SKIP_LIST
List of space-separated FS UUIDs of filesystems to be ignored from os-prober 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 @section Multi-boot manual config
Currently autogenerating config files for multi-boot environments depends on 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 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, 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 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 --- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in
@@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@" @@ -26,8 +26,7 @@ export TEXTDOMAINDIR="@localedir@"

@ -13,10 +13,10 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 23 insertions(+), 12 deletions(-) 1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c 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 --- a/grub-core/loader/i386/linux.c
+++ b/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; grub_file_t file = 0;
struct linux_i386_kernel_header lh; struct linux_i386_kernel_header lh;
@ -33,7 +33,7 @@ index 9f74a96b19..dccf3bb300 100644
grub_dl_ref (my_mod); 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) if (! file)
goto fail; goto fail;
@ -50,7 +50,7 @@ index 9f74a96b19..dccf3bb300 100644
{ {
if (!grub_errno) if (!grub_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), 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; goto fail;
} }
@ -60,7 +60,7 @@ index 9f74a96b19..dccf3bb300 100644
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
{ {
grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); 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. */ /* We've already read lh so there is no need to read it second time. */
len -= sizeof(lh); 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; 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. */ /* 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", grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
(unsigned) real_size, (unsigned) prot_size); (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; len = prot_file_size;
@ -98,7 +98,7 @@ index 9f74a96b19..dccf3bb300 100644
if (grub_errno == GRUB_ERR_NONE) 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: fail:

@ -13,7 +13,7 @@ Signed-off-by: Matthew Garrett <mjg59@coreos.com>
1 file changed, 21 insertions(+), 12 deletions(-) 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 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 --- a/grub-core/loader/i386/pc/linux.c
+++ b/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)), @@ -124,13 +124,14 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

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

@ -29,7 +29,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 91 insertions(+) 4 files changed, 91 insertions(+)
diff --git a/grub-core/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c 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 --- a/grub-core/kern/ieee1275/openfw.c
+++ b/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c
@@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void) @@ -591,3 +591,66 @@ grub_ieee1275_get_boot_dev (void)
@ -100,7 +100,7 @@ index 4d493ab766..3a6689abb1 100644
+ return 0; + return 0;
+} +}
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -34,6 +34,9 @@ @@ -34,6 +34,9 @@
@ -137,7 +137,7 @@ index c4ebe9e22a..70614de156 100644
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
} }
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c 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 --- a/grub-core/script/execute.c
+++ b/grub-core/script/execute.c +++ b/grub-core/script/execute.c
@@ -28,6 +28,9 @@ @@ -28,6 +28,9 @@
@ -162,10 +162,10 @@ index 25158407dd..ad80399246 100644
{ {
char *line; char *line;
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h 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 --- a/include/grub/ieee1275/ieee1275.h
+++ b/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_peer) (struct grub_ieee1275_devalias *alias);
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath, void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias); struct grub_ieee1275_devalias *alias);

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c 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 --- a/grub-core/term/terminfo.c
+++ b/grub-core/term/terminfo.c +++ b/grub-core/term/terminfo.c
@@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term, @@ -151,7 +151,7 @@ grub_terminfo_set_current (struct grub_term_output *term,

@ -15,10 +15,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
3 files changed, 12 insertions(+), 4 deletions(-) 3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c 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 --- a/grub-core/kern/ieee1275/cmain.c
+++ b/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) 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. /* Old Macs have no key repeat, newer ones have fully working one.
The ones inbetween when repeated key generates an escaoe sequence The ones inbetween when repeated key generates an escaoe sequence
diff --git a/grub-core/video/ieee1275.c b/grub-core/video/ieee1275.c 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 --- a/grub-core/video/ieee1275.c
+++ b/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) GRUB_MOD_INIT(ieee1275_fb)
{ {
@ -51,14 +51,14 @@ index 17a3dbbb57..b8e4b3feb3 100644
GRUB_MOD_FINI(ieee1275_fb) GRUB_MOD_FINI(ieee1275_fb)
diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h 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 --- a/include/grub/ieee1275/ieee1275.h
+++ b/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h
@@ -148,6 +148,8 @@ enum grub_ieee1275_flag @@ -145,6 +145,8 @@ enum grub_ieee1275_flag
GRUB_IEEE1275_FLAG_CURSORONOFF_ANSI_BROKEN, GRUB_IEEE1275_FLAG_POWER_VM,
GRUB_IEEE1275_FLAG_RAW_DEVNAMES, GRUB_IEEE1275_FLAG_POWER_KVM,
+ +
+ GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT + GRUB_IEEE1275_FLAG_DISABLE_VIDEO_SUPPORT
}; };

@ -10,10 +10,10 @@ Apparently these go in a new place now.
2 files changed, 11 insertions(+), 1 deletion(-) 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 7517fc49d9..8331f95b64 100644 index cd667a2eb75..ae3a49321ad 100644
--- a/configure.ac --- a/configure.ac
+++ b/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", AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
[Default grub directory name]) [Default grub directory name])
@ -28,7 +28,7 @@ index 7517fc49d9..8331f95b64 100644
# #
# Checks for build programs. # 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. # 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 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
tmp_ac_tool_prefix="$ac_tool_prefix" tmp_ac_tool_prefix="$ac_tool_prefix"
diff --git a/util/bash-completion.d/Makefile.am b/util/bash-completion.d/Makefile.am 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 --- a/util/bash-completion.d/Makefile.am
+++ b/util/bash-completion.d/Makefile.am +++ b/util/bash-completion.d/Makefile.am
@@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source) @@ -6,7 +6,6 @@ EXTRA_DIST = $(bash_completion_source)

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 58 insertions(+), 27 deletions(-) 1 file changed, 58 insertions(+), 27 deletions(-)
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c 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 --- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c
@@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout) @@ -163,15 +163,40 @@ grub_menu_set_timeout (int timeout)

@ -13,7 +13,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/commands/minicmd.c | 20 ++++++++++++++++---- grub-core/commands/minicmd.c | 20 ++++++++++++++++----
grub-core/kern/efi/efi.c | 9 +++++++-- grub-core/kern/efi/efi.c | 9 +++++++--
grub-core/kern/emu/main.c | 2 +- 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/coreboot/init.c | 2 +-
grub-core/kern/i386/qemu/init.c | 2 +- grub-core/kern/i386/qemu/init.c | 2 +-
grub-core/kern/ieee1275/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/uboot/init.c | 6 +++---
grub-core/kern/xen/init.c | 2 +- grub-core/kern/xen/init.c | 2 +-
include/grub/misc.h | 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 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 --- a/grub-core/commands/minicmd.c
+++ b/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)), @@ -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 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 --- a/grub-core/kern/efi/efi.c
+++ b/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 void
@ -76,14 +76,14 @@ index 8cff7be028..05d8237a9b 100644
+ rc = GRUB_EFI_SUCCESS; + rc = GRUB_EFI_SUCCESS;
+ +
grub_machine_fini (GRUB_LOADER_FLAG_NORETURN); grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
efi_call_4 (grub_efi_system_table->boot_services->exit, grub_efi_system_table->boot_services->exit (grub_efi_image_handle,
- grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0); - GRUB_EFI_SUCCESS, 0, 0);
+ grub_efi_image_handle, rc, 0, 0); + rc, 0, 0);
for (;;) ; for (;;) ;
} }
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c 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 --- a/grub-core/kern/emu/main.c
+++ b/grub-core/kern/emu/main.c +++ b/grub-core/kern/emu/main.c
@@ -67,7 +67,7 @@ grub_reboot (void) @@ -67,7 +67,7 @@ grub_reboot (void)
@ -96,10 +96,19 @@ index 425bb96034..55ea5a11cc 100644
grub_reboot (); grub_reboot ();
} }
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c 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 --- a/grub-core/kern/emu/misc.c
+++ b/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) #if !defined (GRUB_MACHINE_EMU) || defined (GRUB_UTIL)
void void
@ -107,13 +116,17 @@ index dfd8a8ec48..0ff13bcaf8 100644
+__attribute__ ((noreturn)) +__attribute__ ((noreturn))
+grub_exit (int rc) +grub_exit (int rc)
{ {
-#if defined (GRUB_KERNEL)
+#if defined (GRUB_KERNEL) && !defined (GRUB_MACHINE_EFI)
grub_reboot ();
#endif
- exit (1); - exit (1);
+ exit (rc < 0 ? 1 : rc); + exit (rc < 0 ? 1 : rc);
} }
#endif #endif
diff --git a/grub-core/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c 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 --- a/grub-core/kern/i386/coreboot/init.c
+++ b/grub-core/kern/i386/coreboot/init.c +++ b/grub-core/kern/i386/coreboot/init.c
@@ -41,7 +41,7 @@ extern grub_uint8_t _end[]; @@ -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 /* 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(). */ 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 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 --- a/grub-core/kern/i386/qemu/init.c
+++ b/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c
@@ -42,7 +42,7 @@ extern grub_uint8_t _end[]; @@ -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 /* 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(). */ 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 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 --- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c
@@ -71,7 +71,7 @@ grub_addr_t grub_ieee1275_original_stack; @@ -114,7 +114,7 @@ grub_addr_t grub_ieee1275_original_stack;
#endif #define BYTE22 (DY_MEM_V2 | DRC_INFO)
void void
-grub_exit (void) -grub_exit (void)
@ -152,7 +165,7 @@ index d483e35eed..e71d158416 100644
grub_ieee1275_exit (); grub_ieee1275_exit ();
} }
diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c 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 --- a/grub-core/kern/mips/arc/init.c
+++ b/grub-core/kern/mips/arc/init.c +++ b/grub-core/kern/mips/arc/init.c
@@ -276,7 +276,7 @@ grub_halt (void) @@ -276,7 +276,7 @@ grub_halt (void)
@ -165,7 +178,7 @@ index 2ed3ff3191..5c40c34078 100644
GRUB_ARC_FIRMWARE_VECTOR->exit (); GRUB_ARC_FIRMWARE_VECTOR->exit ();
diff --git a/grub-core/kern/mips/loongson/init.c b/grub-core/kern/mips/loongson/init.c 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 --- a/grub-core/kern/mips/loongson/init.c
+++ b/grub-core/kern/mips/loongson/init.c +++ b/grub-core/kern/mips/loongson/init.c
@@ -304,7 +304,7 @@ grub_halt (void) @@ -304,7 +304,7 @@ grub_halt (void)
@ -178,7 +191,7 @@ index 7b96531b98..dff598ca7b 100644
grub_halt (); grub_halt ();
} }
diff --git a/grub-core/kern/mips/qemu_mips/init.c b/grub-core/kern/mips/qemu_mips/init.c 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 --- a/grub-core/kern/mips/qemu_mips/init.c
+++ b/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))) @@ -75,7 +75,7 @@ grub_machine_fini (int flags __attribute__ ((unused)))
@ -191,10 +204,10 @@ index be88b77d22..8b6c55ffc0 100644
grub_halt (); grub_halt ();
} }
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c 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 --- a/grub-core/kern/misc.c
+++ b/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 (); grub_getkey ();
} }
@ -215,7 +228,7 @@ index 3af336ee22..63b586d09c 100644
grub_fatal (const char *fmt, ...) grub_fatal (const char *fmt, ...)
{ {
diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c 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 --- a/grub-core/kern/uboot/init.c
+++ b/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; @@ -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) else if (ver > API_SIG_VERSION)
{ {
diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c 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 --- a/grub-core/kern/xen/init.c
+++ b/grub-core/kern/xen/init.c +++ b/grub-core/kern/xen/init.c
@@ -584,7 +584,7 @@ grub_machine_init (void) @@ -584,7 +584,7 @@ grub_machine_init (void)
@ -253,15 +266,15 @@ index 782ca72952..708b060f32 100644
struct sched_shutdown arg; struct sched_shutdown arg;
diff --git a/include/grub/misc.h b/include/grub/misc.h 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 --- a/include/grub/misc.h
+++ b/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, @@ -385,7 +385,7 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT; __attribute__ ((format (GNU_PRINTF, 1, 2))) WARN_UNUSED_RESULT;
char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) 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) (void) __attribute__ ((noreturn));
+void EXPORT_FUNC(grub_exit) (int rc) __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 EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint64_t d, grub_uint64_t d,
grub_uint64_t *r);

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

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

@ -17,7 +17,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 30 insertions(+), 8 deletions(-) 2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c 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 --- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c +++ b/grub-core/kern/main.c
@@ -128,16 +128,15 @@ grub_set_prefix_and_root (void) @@ -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 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -339,7 +339,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

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

@ -28,10 +28,10 @@ Signed-off-by: Will Thompson <wjt@endlessm.com>
create mode 100644 grub-core/commands/loadenv.h create mode 100644 grub-core/commands/loadenv.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def 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 --- a/grub-core/Makefile.core.def
+++ b/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; common = commands/blocklist.c;
}; };
@ -48,7 +48,7 @@ index c865a08b02..c15e91943b 100644
module = { module = {
name = boot; name = boot;
common = commands/boot.c; common = commands/boot.c;
@@ -980,6 +990,7 @@ module = { @@ -1009,6 +1019,7 @@ module = {
module = { module = {
name = loadenv; name = loadenv;
common = commands/loadenv.c; 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 diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
new file mode 100644 new file mode 100644
index 0000000000..e907a6a5d2 index 00000000000..e907a6a5d28
--- /dev/null --- /dev/null
+++ b/grub-core/commands/blscfg.c +++ b/grub-core/commands/blscfg.c
@@ -0,0 +1,1177 @@ @@ -0,0 +1,1177 @@
@ -1240,7 +1240,7 @@ index 0000000000..e907a6a5d2
+ grub_unregister_extcmd (oldcmd); + grub_unregister_extcmd (oldcmd);
+} +}
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c 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 --- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c +++ b/grub-core/commands/legacycfg.c
@@ -143,7 +143,7 @@ legacy_file (const char *filename) @@ -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 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 --- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c +++ b/grub-core/commands/loadenv.c
@@ -28,6 +28,8 @@ @@ -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) 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 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 --- a/grub-core/commands/menuentry.c
+++ b/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, @@ -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; src[len - 1] = ch;
args[argc - 1] = src; args[argc - 1] = src;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
@ -1455,7 +1455,7 @@ index 62571e6dfc..7ca2e5400b 100644
grub_free ((void *) entry->title); grub_free ((void *) entry->title);
diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h diff --git a/grub-core/commands/loadenv.h b/grub-core/commands/loadenv.h
new file mode 100644 new file mode 100644
index 0000000000..952f46121b index 00000000000..952f46121bd
--- /dev/null --- /dev/null
+++ b/grub-core/commands/loadenv.h +++ b/grub-core/commands/loadenv.h
@@ -0,0 +1,93 @@ @@ -0,0 +1,93 @@
@ -1553,7 +1553,7 @@ index 0000000000..952f46121b
+ return 0; + return 0;
+} +}
diff --git a/include/grub/compiler.h b/include/grub/compiler.h 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 --- a/include/grub/compiler.h
+++ b/include/grub/compiler.h +++ b/include/grub/compiler.h
@@ -56,4 +56,6 @@ @@ -56,4 +56,6 @@
@ -1564,7 +1564,7 @@ index 8f3be3ae70..ebafec6895 100644
+ +
#endif /* ! GRUB_COMPILER_HEADER */ #endif /* ! GRUB_COMPILER_HEADER */
diff --git a/include/grub/menu.h b/include/grub/menu.h 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 --- a/include/grub/menu.h
+++ b/include/grub/menu.h +++ b/include/grub/menu.h
@@ -20,6 +20,16 @@ @@ -20,6 +20,16 @@
@ -1595,7 +1595,7 @@ index ee2b5e9104..0acdc2aa6b 100644
typedef struct grub_menu_entry *grub_menu_entry_t; typedef struct grub_menu_entry *grub_menu_entry_t;
diff --git a/include/grub/normal.h b/include/grub/normal.h 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 --- a/include/grub/normal.h
+++ b/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, @@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes,

@ -20,10 +20,10 @@ Signed-off-by: David A. Marlin <dmarlin@redhat.com>
2 files changed, 17 insertions(+), 1 deletion(-) 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in 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 --- a/util/grub-mkconfig.in
+++ b/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_ENABLE_CRYPTODISK \
GRUB_BADRAM \ GRUB_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \ GRUB_OS_PROBER_SKIP_LIST \
@ -34,10 +34,10 @@ index d3e879b8e5..8ea2315ebc 100644
if test "x${grub_cfg}" != "x"; then if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new" rm -f "${grub_cfg}.new"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/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 sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)' echo '$(echo "$message" | grub_quote)'
initrd $(echo $initrd_path) initrd $(echo $initrd_path)
@ -51,7 +51,7 @@ index e8b01c0d0c..dc75a1c30b 100644
EOF EOF
fi fi
sed "s/^/$submenu_indentation/" << EOF 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 gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
fi fi

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

@ -13,20 +13,20 @@ Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
5 files changed, 7 insertions(+), 7 deletions(-) 5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term, @@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term,
grub_term_cls (term); grub_term_cls (term);
- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
+ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION); + msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION);
if (!msg_formatted) if (!msg_formatted)
return; return;
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in 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 --- a/tests/util/grub-shell-tester.in
+++ b/tests/util/grub-shell-tester.in +++ b/tests/util/grub-shell-tester.in
@@ -56,7 +56,7 @@ for option in "$@"; do @@ -56,7 +56,7 @@ for option in "$@"; do
@ -39,10 +39,10 @@ index 8a87109b15..9a4319d4f4 100644
--modules=*) --modules=*)
ms=`echo "$option" | sed -e 's/--modules=//'` ms=`echo "$option" | sed -e 's/--modules=//'`
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in 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 --- a/tests/util/grub-shell.in
+++ b/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 usage
exit 0 ;; exit 0 ;;
-v | --version) -v | --version)
@ -50,9 +50,9 @@ index 93e9f51484..ec1182bf93 100644
+ echo "$0 (GRUB ${PACKAGE_VERSION})" + echo "$0 (GRUB ${PACKAGE_VERSION})"
exit 0 ;; exit 0 ;;
--trim) --trim)
trim=1 trim=1 ;;
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
@ -68,7 +68,7 @@ index dc75a1c30b..4a499c53a6 100644
fi fi
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in 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 --- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@" @@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"

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

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in
@@ -26,7 +26,7 @@ datarootdir="@datarootdir@" @@ -26,7 +26,7 @@ datarootdir="@datarootdir@"

@ -17,7 +17,7 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
1 file changed, 3 insertions(+), 2 deletions(-) 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -347,7 +347,7 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 51 insertions(+), 46 deletions(-) 1 file changed, 51 insertions(+), 46 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), @@ -345,61 +345,66 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)),

@ -14,7 +14,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in
@@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@" @@ -29,7 +29,8 @@ export TEXTDOMAINDIR="@localedir@"

@ -7,38 +7,26 @@ Related: rhbz#1148652
Signed-off-by: Peter Jones <pjones@redhat.com> 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/net/net.c | 2 +-
grub-core/normal/main.c | 134 ++++++++++++++++++++--------------------- 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 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 --- a/grub-core/kern/ieee1275/init.c
+++ b/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); grub_free (canon);
} }
else else
- *device = grub_ieee1275_encode_devname (bootpath); - *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); + filename = grub_ieee1275_get_filename (bootpath);
+ if (filename) + if (filename)
{ + {
- *lastslash = '\0';
- grub_translate_ieee1275_path (filename);
+ char *lastslash = grub_strrchr (filename, '\\'); + char *lastslash = grub_strrchr (filename, '\\');
+
- *path = filename;
- }
+ /* Truncate at last directory. */ + /* Truncate at last directory. */
+ if (lastslash) + if (lastslash)
+ { + {
@ -49,17 +37,32 @@ index e71d158416..0cd2a62723 100644
+ } + }
+ } + }
+ *device = grub_ieee1275_encode_devname (bootpath); + *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); grub_free (bootpath);
} }
diff --git a/grub-core/net/net.c b/grub-core/net/net.c 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 --- a/grub-core/net/net.c
+++ b/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. */ /* Remove the remaining minus sign at the end. */
config[config_len] = '\0'; config[config_len] = '\0';
@ -69,7 +72,7 @@ index 4d3eb5c1a5..0ef148f4ad 100644
static struct grub_preboot *fini_hnd; static struct grub_preboot *fini_hnd;
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config) @@ -335,81 +335,79 @@ grub_enter_normal_mode (const char *config)

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

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

@ -17,7 +17,7 @@ Signed-off-by: Josef Bacik <jbacik@fb.com>
1 file changed, 29 insertions(+), 13 deletions(-) 1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c 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 --- a/grub-core/net/tcp.c
+++ b/grub-core/net/tcp.c +++ b/grub-core/net/tcp.c
@@ -106,6 +106,18 @@ struct tcphdr @@ -106,6 +106,18 @@ struct tcphdr
@ -39,7 +39,7 @@ index e8ad34b84d..7d4b822626 100644
struct tcp_pseudohdr struct tcp_pseudohdr
{ {
grub_uint32_t src; 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; grub_net_tcp_socket_t socket;
static grub_uint16_t in_port = 21550; static grub_uint16_t in_port = 21550;
struct grub_net_buff *nb; struct grub_net_buff *nb;
@ -48,7 +48,7 @@ index e8ad34b84d..7d4b822626 100644
int i; int i;
grub_uint8_t *nbd; grub_uint8_t *nbd;
grub_net_link_level_address_t ll_target_addr; 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; tcph = (void *) nb->data;

@ -6,18 +6,18 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
grub-core/net/bootp.c | 173 +++++++++++++++++++++++++++++++++++++ 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/net.c | 72 +++++++++++++++
grub-core/net/tftp.c | 4 + grub-core/net/tftp.c | 3 +
include/grub/efi/api.h | 129 +++++++++++++++++++++++++-- include/grub/efi/api.h | 129 +++++++++++++++++++++++++--
include/grub/net.h | 60 +++++++++++++ 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 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 --- a/grub-core/net/bootp.c
+++ b/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; static grub_command_t cmd_getdhcp, cmd_bootp, cmd_dhcp;
@ -198,7 +198,7 @@ index 6fb5627025..e28fb6a09f 100644
grub_bootp_init (void) grub_bootp_init (void)
{ {
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c
@@ -18,11 +18,14 @@ @@ -18,11 +18,14 @@
@ -216,16 +216,16 @@ index 5388f952ba..173fb63153 100644
GRUB_MOD_LICENSE ("GPLv3+"); 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) char **path)
{ {
struct grub_net_card *card; struct grub_net_card *card;
- grub_efi_device_path_t *dp; - grub_efi_device_path_t *dp;
+ grub_efi_device_path_t *dp, *ldp = NULL; + grub_efi_device_path_t *dp, *ldp = NULL;
struct grub_net_network_level_interface *inter;
dp = grub_efi_get_device_path (hnd); grub_efi_device_path_t *vlan_dp;
if (! dp) grub_efi_uint16_t vlan_dp_len;
@@ -340,14 +343,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, @@ -361,14 +364,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_efi_device_path_t *cdp; grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe; struct grub_efi_pxe *pxe;
struct grub_efi_pxe_mode *pxe_mode; struct grub_efi_pxe_mode *pxe_mode;
@ -246,7 +246,7 @@ index 5388f952ba..173fb63153 100644
int match; int match;
/* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6 /* 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 devices. We skip them when enumerating cards, so here we need to
find matching MAC device. 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 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_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_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) if (!match)
continue; continue;
} }
@ -265,11 +265,6 @@ index 5388f952ba..173fb63153 100644
continue; continue;
+ +
pxe_mode = pxe->mode; 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) + if (pxe_mode->using_ipv6)
+ { + {
+ grub_net_link_level_address_t hwaddr; + grub_net_link_level_address_t hwaddr;
@ -281,41 +276,86 @@ index 5388f952ba..173fb63153 100644
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue"); + pxe_mode->dhcp_ack_received ? "" : " cannot continue");
+ if (!pxe_mode->dhcp_ack_received) + if (!pxe_mode->dhcp_ack_received)
+ continue; + 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; + hwaddr.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ grub_memcpy (hwaddr.mac, + grub_memcpy (hwaddr.mac,
+ card->efi_net->mode->current_address, + card->efi_net->mode->current_address,
+ sizeof (hwaddr.mac)); + 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, + (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
+ 1, device, path); + 1, device, path);
+ if (intf && device && path) + if (inter && device && path)
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ } + }
+ else + 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_dprintf ("efinet", "using ipv4 and dhcp\n");
+ grub_net_configure_by_dhcp_ack (card->name, card, 0, + inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
+ (struct grub_net_bootp_packet *) + (struct grub_net_bootp_packet *)
+ &pxe_mode->dhcp_ack, + &pxe_mode->dhcp_ack,
+ sizeof (pxe_mode->dhcp_ack), + sizeof (pxe_mode->dhcp_ack),
+ 1, device, path); + 1, device, path);
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (vlan_dp))
+ grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); + grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ } + if (inter != NULL)
return; {
- 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 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 --- a/grub-core/net/net.c
+++ b/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; grub_net_network_level_interfaces = inter;
} }
+int +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_uint8_t *mask;
+ grub_uint16_t mask16[8]; + grub_uint16_t mask16[8];
@ -390,10 +430,10 @@ index 0ef148f4ad..22f2689aae 100644
grub_err_t grub_err_t
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter, 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 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 --- a/grub-core/net/tftp.c
+++ b/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->not_easily_seekable = 1;
file->data = data; file->data = data;
@ -401,14 +441,13 @@ index 7f44b30f52..4ab2f5c735 100644
err = grub_net_resolve_address (file->device->net->server, &addr); err = grub_net_resolve_address (file->device->net->server, &addr);
if (err) if (err)
{ {
+ grub_dprintf("tftp", "Address resolution failed: %d\n", err); @@ -369,11 +370,13 @@ tftp_open (struct grub_file *file, const char *filename)
grub_free (data);
return err; return err;
} }
+ grub_dprintf("tftp", "opening connection\n"); + grub_dprintf("tftp", "opening connection\n");
data->sock = grub_net_udp_open (addr, data->sock = grub_net_udp_open (addr,
TFTP_SERVER_PORT, tftp_receive, port ? port : TFTP_SERVER_PORT, tftp_receive,
file); file);
if (!data->sock) if (!data->sock)
{ {
@ -417,10 +456,10 @@ index 7f44b30f52..4ab2f5c735 100644
return grub_errno; return grub_errno;
} }
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h 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 --- a/include/grub/efi/api.h
+++ b/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 void *grub_efi_event_t;
typedef grub_efi_uint64_t grub_efi_lba_t; typedef grub_efi_uint64_t grub_efi_lba_t;
typedef grub_efi_uintn_t grub_efi_tpl_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_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_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; 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 typedef struct grub_efi_pxe
diff --git a/include/grub/net.h b/include/grub/net.h 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 --- a/include/grub/net.h
+++ b/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_uint8_t vendor[0];
} GRUB_PACKED; } GRUB_PACKED;
@ -627,7 +666,7 @@ index 7ae4b6bd80..8a05ec4fe7 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 #define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82
#define GRUB_NET_BOOTP_RFC1048_MAGIC_2 0x53 #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, grub_size_t size,
int is_def, char **device, char **path); int is_def, char **device, char **path);

@ -12,14 +12,14 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
grub-core/net/bootp.c | 1059 ++++++++++++++++++++++++++++++------ 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 ++ grub-core/net/ip.c | 39 ++
include/grub/efi/api.h | 2 +- include/grub/efi/api.h | 2 +-
include/grub/net.h | 91 ++-- 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 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 --- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c
@@ -24,6 +24,98 @@ @@ -24,6 +24,98 @@
@ -121,7 +121,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
struct grub_dhcp_discover_options struct grub_dhcp_discover_options
{ {
@@ -604,6 +696,584 @@ out: @@ -610,6 +702,584 @@ out:
return err; return err;
} }
@ -427,7 +427,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
+ grub_dhcp6_session_t se; + grub_dhcp6_session_t se;
+ struct grub_datetime date; + struct grub_datetime date;
+ grub_err_t err; + grub_err_t err;
+ grub_int32_t t = 0; + grub_int64_t t = 0;
+ +
+ se = grub_malloc (sizeof (*se)); + 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 * This is called directly from net/ip.c:handle_dgram(), because those
* BOOTP/DHCP packets are a bit special due to their improper * 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 static grub_err_t
grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)), grub_cmd_dhcpopt (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args) 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; return err;
} }
@ -1119,7 +1119,7 @@ index 08b6b2b5d6..fe93b80f1c 100644
void void
grub_bootp_init (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, cmd_getdhcp = grub_register_command ("net_get_dhcp_option", grub_cmd_dhcpopt,
N_("VAR INTERFACE NUMBER DESCRIPTION"), N_("VAR INTERFACE NUMBER DESCRIPTION"),
N_("retrieve DHCP option and save it into VAR. If VAR is - then print the value.")); 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_bootp);
grub_unregister_command (cmd_dhcp); grub_unregister_command (cmd_dhcp);
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/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; pxe_mode = pxe->mode;
if (pxe_mode->using_ipv6) if (pxe_mode->using_ipv6)
{ {
@ -1149,7 +1149,7 @@ index a673bea807..8e25680db0 100644
grub_dprintf ("efinet", "using ipv6 and dhcpv6\n"); grub_dprintf ("efinet", "using ipv6 and dhcpv6\n");
grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n", grub_dprintf ("efinet", "dhcp_ack_received: %s%s\n",
pxe_mode->dhcp_ack_received ? "yes" : "no", 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) if (!pxe_mode->dhcp_ack_received)
continue; continue;
@ -1158,26 +1158,24 @@ index a673bea807..8e25680db0 100644
- card->efi_net->mode->current_address, - card->efi_net->mode->current_address,
- sizeof (hwaddr.mac)); - 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, - (const struct grub_net_dhcpv6_packet *)&pxe_mode->dhcp_ack.dhcpv6,
- 1, device, path); - 1, device, path);
- if (intf && device && path) + inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
+ grub_net_configure_by_dhcpv6_reply (card->name, card, 0, + (struct grub_net_dhcp6_packet *)
+ (struct grub_net_dhcp6_packet *) + &pxe_mode->dhcp_ack,
+ &pxe_mode->dhcp_ack, + sizeof (pxe_mode->dhcp_ack),
+ sizeof (pxe_mode->dhcp_ack), + 1, device, path);
+ 1, device, path);
+ if (grub_errno) + if (grub_errno)
+ grub_print_error (); + grub_print_error ();
+ if (device && path) if (inter && device && path)
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *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 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 --- a/grub-core/net/ip.c
+++ b/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; struct udphdr *udph;
udph = (struct udphdr *) nb->data; udph = (struct udphdr *) nb->data;
@ -1224,10 +1222,10 @@ index a5896f6dc2..ce6bdc75c6 100644
{ {
const struct grub_net_bootp_packet *bootp; const struct grub_net_bootp_packet *bootp;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h 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 --- a/include/grub/efi/api.h
+++ b/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 filters;
grub_efi_uint8_t ip_count; grub_efi_uint8_t ip_count;
@ -1237,10 +1235,10 @@ index 9962880147..7614b58dca 100644
} grub_efi_pxe_ip_filter_t; } grub_efi_pxe_ip_filter_t;
diff --git a/include/grub/net.h b/include/grub/net.h 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 --- a/include/grub/net.h
+++ b/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_uint8_t vendor[0];
} GRUB_PACKED; } GRUB_PACKED;
@ -1336,7 +1334,7 @@ index d55d505a03..543251f727 100644
#define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63 #define GRUB_NET_BOOTP_RFC1048_MAGIC_0 0x63
#define GRUB_NET_BOOTP_RFC1048_MAGIC_1 0x82 #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); int is_def, char **device, char **path);
struct grub_net_network_level_interface * struct grub_net_network_level_interface *
@ -1355,7 +1353,7 @@ index d55d505a03..543251f727 100644
int int
grub_ipv6_get_masksize(grub_uint16_t *mask); 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, grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_network_level_interface *iface); struct grub_net_network_level_interface *iface);

@ -24,10 +24,10 @@ Resolves: rhbz#1226325
create mode 100644 util/grub-get-kernel-settings.in create mode 100644 util/grub-get-kernel-settings.in
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 7f59ad788f..0d0e6782a1 100644 index 493e336ec6c..3602b4ab62b 100644
--- a/configure.ac --- a/configure.ac
+++ b/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-mkconfig])
grub_TRANSFORM([grub-mkfont]) grub_TRANSFORM([grub-mkfont])
grub_TRANSFORM([grub-mkimage]) grub_TRANSFORM([grub-mkimage])
@ -36,10 +36,10 @@ index 7f59ad788f..0d0e6782a1 100644
grub_TRANSFORM([grub-mklayout]) grub_TRANSFORM([grub-mklayout])
grub_TRANSFORM([grub-mkpasswd-pbkdf2]) grub_TRANSFORM([grub-mkpasswd-pbkdf2])
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index 4ee22c5daa..18a9242776 100644 index 95884956a68..84a17ef5cfa 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -716,6 +716,13 @@ script = { @@ -725,6 +725,13 @@ script = {
installdir = sbin; installdir = sbin;
}; };
@ -55,17 +55,17 @@ index 4ee22c5daa..18a9242776 100644
common = util/grub-set-default.in; common = util/grub-set-default.in;
diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m diff --git a/docs/man/grub-get-kernel-settings.h2m b/docs/man/grub-get-kernel-settings.h2m
new file mode 100644 new file mode 100644
index 0000000000..b8051f01f3 index 00000000000..b8051f01f3a
--- /dev/null --- /dev/null
+++ b/docs/man/grub-get-kernel-settings.h2m +++ b/docs/man/grub-get-kernel-settings.h2m
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
+[NAME] +[NAME]
+grub-get-kernel-settings \- Evaluate the system's kernel installation settings for use while making a grub configuration file +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 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 --- a/util/bash-completion.d/grub-completion.bash.in
+++ b/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 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 diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
new file mode 100644 new file mode 100644
index 0000000000..7e87dfccc0 index 00000000000..7e87dfccc0e
--- /dev/null --- /dev/null
+++ b/util/grub-get-kernel-settings.in +++ b/util/grub-get-kernel-settings.in
@@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
@ -189,7 +189,7 @@ index 0000000000..7e87dfccc0
+ echo export GRUB_UPDATE_DEFAULT_KERNEL + echo export GRUB_UPDATE_DEFAULT_KERNEL
+fi +fi
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in 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 --- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in
@@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@" @@ -45,6 +45,7 @@ grub_probe="${sbindir}/@grub_probe@"
@ -210,10 +210,10 @@ index ba14cf6261..005f093809 100644
if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then if [ -z "${GRUB_DISABLE_LINUX_UUID}" ]; then
GRUB_DISABLE_LINUX_UUID="true" GRUB_DISABLE_LINUX_UUID="true"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/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" os="$1"
version="$2" version="$2"
type="$3" type="$3"
@ -223,7 +223,7 @@ index 786dbabb4a..292e333324 100644
if [ -z "$boot_device_id" ]; then if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" 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)" 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;" title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
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/" echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else else
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" 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 fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then 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 if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi 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 is_top_level=false
fi fi
@ -266,6 +266,6 @@ index 786dbabb4a..292e333324 100644
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
- linux_entry "${OS}" "${version}" recovery \ - linux_entry "${OS}" "${version}" recovery \
+ linux_entry "${OS}" "${version}" recovery standard \ + linux_entry "${OS}" "${version}" recovery standard \
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
fi fi
done

@ -5,18 +5,18 @@ Subject: [PATCH] Make grub_fatal() also backtrace.
--- ---
grub-core/Makefile.core.def | 3 ++ 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/arm64/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++
grub-core/lib/backtrace.c | 2 ++ grub-core/lib/backtrace.c | 2 ++
grub-core/lib/i386/backtrace.c | 14 +++++++++- 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 create mode 100644 grub-core/lib/arm64/backtrace.c
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def 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 --- a/grub-core/Makefile.core.def
+++ b/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; softdiv = lib/division.c;
@ -27,19 +27,19 @@ index c15e91943b..058c88ac3a 100644
i386_xen = kern/i386/dl.c; i386_xen = kern/i386/dl.c;
i386_xen_pvh = 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 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 --- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c +++ b/grub-core/kern/misc.c
@@ -24,6 +24,7 @@ @@ -26,6 +26,7 @@
#include <grub/term.h>
#include <grub/env.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#include <grub/types.h>
#include <grub/charset.h>
+#include <grub/backtrace.h> +#include <grub/backtrace.h>
union printf_arg union printf_arg
{ {
@@ -1199,8 +1200,13 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected) @@ -1301,6 +1302,11 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
static void __attribute__ ((noreturn)) void __attribute__ ((noreturn))
grub_abort (void) grub_abort (void)
{ {
+#ifndef GRUB_UTIL +#ifndef GRUB_UTIL
@ -48,14 +48,11 @@ index 63b586d09c..a3e215155b 100644
+#endif +#endif
+#endif +#endif
grub_printf ("\nAborted."); grub_printf ("\nAborted.");
-
+
#ifndef GRUB_UTIL #ifndef GRUB_UTIL
if (grub_term_inputs)
#endif
diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
new file mode 100644 new file mode 100644
index 0000000000..1079b5380e index 00000000000..1079b5380e1
--- /dev/null --- /dev/null
+++ b/grub-core/lib/arm64/backtrace.c +++ b/grub-core/lib/arm64/backtrace.c
@@ -0,0 +1,62 @@ @@ -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 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 --- a/grub-core/lib/backtrace.c
+++ b/grub-core/lib/backtrace.c +++ b/grub-core/lib/backtrace.c
@@ -29,6 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -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 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 --- a/grub-core/lib/i386/backtrace.c
+++ b/grub-core/lib/i386/backtrace.c +++ b/grub-core/lib/i386/backtrace.c
@@ -15,11 +15,23 @@ @@ -15,11 +15,23 @@

@ -9,11 +9,11 @@ time.
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
docs/grub-dev.texi | 4 +- docs/grub-dev.texi | 4 +-
docs/grub.texi | 321 ++++++++++++++++++++++++++++------------------------- docs/grub.texi | 357 ++++++++++++++++++++++++++++-------------------------
2 files changed, 171 insertions(+), 154 deletions(-) 2 files changed, 189 insertions(+), 172 deletions(-)
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi 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 --- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi +++ b/docs/grub-dev.texi
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
@ -35,7 +35,7 @@ index 6c629a23e2..19f708ee66 100644
@setchapternewpage odd @setchapternewpage odd
diff --git a/docs/grub.texi b/docs/grub.texi diff --git a/docs/grub.texi b/docs/grub.texi
index 69f08d289f..0615d0ed97 100644 index 974bc0ddb07..c30701b4e1f 100644
--- a/docs/grub.texi --- a/docs/grub.texi
+++ b/docs/grub.texi +++ b/docs/grub.texi
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
@ -72,31 +72,7 @@ index 69f08d289f..0615d0ed97 100644
@end direntry @end direntry
@setchapternewpage odd @setchapternewpage odd
@@ -103,15 +103,15 @@ This edition documents version @value{VERSION}. @@ -223,7 +223,7 @@ surprising.
* 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.
@item @item
@file{grub.cfg} is typically automatically generated by @file{grub.cfg} is typically automatically generated by
@ -105,7 +81,7 @@ index 69f08d289f..0615d0ed97 100644
easier to handle versioned kernel upgrades. easier to handle versioned kernel upgrades.
@item @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 @item
A small amount of persistent storage is available across reboots, using the A small amount of persistent storage is available across reboots, using the
@command{save_env} and @command{load_env} commands in GRUB and the @command{save_env} and @command{load_env} commands in GRUB and the
@ -114,7 +90,7 @@ index 69f08d289f..0615d0ed97 100644
(@pxref{Environment block}). (@pxref{Environment block}).
@item @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: OS name. E.g. for GNU/Linux:
@example @example
@ -123,7 +99,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
On AROS we use another syntax. For volumes: 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. E.g.
@example @example
@ -132,7 +108,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
On Windows we use UNC path. For volumes it's typically 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. E.g.
@example @example
@ -141,7 +117,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
Beware that you may need to further escape the backslashes depending on your 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. when needed. E.g.
@example @example
@ -150,7 +126,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
@node Installation @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 After you have done that, you need to install the boot loader on a
drive (floppy or hard disk) by using the utility 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 GRUB comes with boot images, which are normally put in the directory
@file{/usr/lib/grub/<cpu>-<platform>} (for BIOS-based machines @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}. the @dfn{boot directory}.
@menu @menu
@ -187,7 +163,7 @@ index 69f08d289f..0615d0ed97 100644
The usage is basically very simple. You only need to specify one The usage is basically very simple. You only need to specify one
argument to the program, namely, where to install the boot loader. The 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: of the first IDE disk:
@example @example
@ -203,7 +179,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
But all the above examples assume that GRUB should put images under 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{mke2fs /dev/fd0}
# @kbd{mount -t ext2 /dev/fd0 /mnt} # @kbd{mount -t ext2 /dev/fd0 /mnt}
# @kbd{mkdir /mnt/boot} # @kbd{mkdir /mnt/boot}
@ -212,7 +188,7 @@ index 69f08d289f..0615d0ed97 100644
# @kbd{umount /mnt} # @kbd{umount /mnt}
@end group @end group
@end example @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 @example
# @kbd{losetup /dev/loop0 /dev/sdb1} # @kbd{losetup /dev/loop0 /dev/sdb1}
# @kbd{mount /dev/loop0 /mnt/usb} # @kbd{mount /dev/loop0 /mnt/usb}
@ -254,7 +230,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
@node Making a GRUB bootable CD-ROM @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. other GRUB modules.
To make a simple generic GRUB rescue CD, you can use the To make a simple generic GRUB rescue CD, you can use the
@ -267,7 +243,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
You will often need to include other files in your image. To do this, first 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: Finally, make the image:
@example @example
@ -276,7 +252,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
This produces a file named @file{grub.iso}, which then can be burned 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 @node Device map
@section The map between BIOS drives and OS devices @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 etc.) read it to map BIOS drives to OS devices. This file consists of lines
like this: 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 @node Simple configuration
@section Simple configuration handling @section Simple configuration handling
@ -314,7 +290,7 @@ index 69f08d289f..0615d0ed97 100644
valid POSIX shell input; normally, it will just be a sequence of 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 @samp{KEY=value} lines, but if the value contains spaces or other special
characters then it must be quoted. For example: 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 and may be translated
If you set this to @samp{saved}, then the default menu entry will be that 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 the environment block, which may not be available in all situations
(@pxref{Environment block}). (@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 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 useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with @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 This option relies on the environment block, which may not be available in
all situations (@pxref{Environment block}). 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 @end example
@item GRUB_DISABLE_LINUX_UUID @item GRUB_DISABLE_LINUX_UUID
@ -341,7 +317,17 @@ index 69f08d289f..0615d0ed97 100644
universally-unique identifiers (UUIDs) to identify the root filesystem to universally-unique identifiers (UUIDs) to identify the root filesystem to
the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is 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 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. mode menu entries.
@item GRUB_DISABLE_UUID @item GRUB_DISABLE_UUID
@ -350,7 +336,7 @@ index 69f08d289f..0615d0ed97 100644
universally-unique identifiers (UUIDs) to identify various filesystems to universally-unique identifiers (UUIDs) to identify various filesystems to
search for files. This is usually more reliable, but in some cases it may 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 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 @item GRUB_VIDEO_BACKEND
If graphical video support is required, either because the @samp{gfxterm} If graphical video support is required, either because the @samp{gfxterm}
graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set, graphical terminal is in use or because @samp{GRUB_GFXPAYLOAD_LINUX} is set,
@ -366,7 +352,7 @@ index 69f08d289f..0615d0ed97 100644
@item GRUB_GFXMODE @item GRUB_GFXMODE
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that 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. GRUB will tell Linux to boot in normal text mode.
@item GRUB_DISABLE_OS_PROBER @item GRUB_DISABLE_OS_PROBER
@ -375,7 +361,7 @@ index 69f08d289f..0615d0ed97 100644
@command{os-prober} program, if installed, to discover other operating @command{os-prober} program, if installed, to discover other operating
systems installed on the same system and generate appropriate menu entries systems installed on the same system and generate appropriate menu entries
for them. Set this option to @samp{true} to disable this. 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> output. For efi chainloaders it's <UUID>@@<EFI FILE>
@item GRUB_DISABLE_SUBMENU @item GRUB_DISABLE_SUBMENU
@ -384,7 +370,7 @@ index 69f08d289f..0615d0ed97 100644
the kernel with highest version number and put all other found kernels the kernel with highest version number and put all other found kernels
or alternative menu entries for recovery mode in submenu. For entries returned 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 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 on top level will be generated instead. Changing this option will require
changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback}) changing existing values of @samp{GRUB_DEFAULT}, @samp{fallback} (@pxref{fallback})
and @samp{default} (@pxref{default}) environment variables as well as saved 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 check for encrypted disks and generate additional commands needed to access
them during boot. Note that in this case unattended boot is not possible them during boot. Note that in this case unattended boot is not possible
because GRUB will wait for passphrase to unlock encrypted container. 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 @end table
@ -408,7 +394,48 @@ index 69f08d289f..0615d0ed97 100644
edit the scripts in @file{/etc/grub.d} directly. edit the scripts in @file{/etc/grub.d} directly.
@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom @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 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 Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
install self-compiled latest GRUB with: 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, 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 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 in /etc/default/grub
@ -441,7 +468,7 @@ index 69f08d289f..0615d0ed97 100644
@} @}
menuentry "Windows XP" @{ 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 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, example, when it is not straightforward to find the real configuration file,
or when you need to debug problems with loading that 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 After the embedded configuration file (if any) is executed, GRUB will load
the @samp{normal} module (@pxref{normal}), which will then read the real 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 @example
@group @group
search.fs_label grub root search.fs_label grub root
@ -478,7 +505,7 @@ index 69f08d289f..0615d0ed97 100644
else else
echo "Could not find an example configuration file!" echo "Could not find an example configuration file!"
fi 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 group
@end example @end example
@ -487,7 +514,7 @@ index 69f08d289f..0615d0ed97 100644
server. server.
The grub.cfg file is placed in the same directory as the path output by 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 @end table
To take full advantage of this function, install GRUB into the MBR 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 If you have a laptop which has a similar feature and not in the above list
could you figure your address and contribute? 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 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, image from a local disk and jump to it. Because of the size restriction,
@file{boot.img} cannot understand any file system structure, so @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. core image into @file{boot.img} when installing GRUB.
@item diskboot.img @item diskboot.img
@@ -2806,7 +2813,7 @@ images. @@ -2851,7 +2858,7 @@ images.
@item core.img @item core.img
This is the core image of GRUB. It is built dynamically from the kernel 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}, program. Usually, it contains enough modules to access @file{/boot/grub},
and loads everything else (including menu handling, the ability to load 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 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 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 @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 contains the @samp{iso9660} module. It is usually best to use the
@ -523,7 +550,7 @@ index 69f08d289f..0615d0ed97 100644
@item nbgrub @item nbgrub
There is as yet no equivalent for @file{nbgrub} in GRUB 2; it was used by 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 An absolute file name resembles a Unix absolute file name, using
@samp{/} for the directory separator (not @samp{\} as in DOS). One @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 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, 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}), 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 On ZFS filesystem the first path component must be
@var{volume}@samp{@@}[@var{snapshot}]. @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 @samp{snap-129}. Trailing @samp{@@} after volume name is mandatory even if
snapshot name is omitted. 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}. @samp{other>minix>minix-3.4.0}.
This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple This variable is often set by @samp{GRUB_DEFAULT} (@pxref{Simple
@ -554,7 +581,7 @@ index 69f08d289f..0615d0ed97 100644
@node fallback @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 example, French would be named as @samp{fr}, and Simplified Chinese as
@samp{zh_CN}. @samp{zh_CN}.
@ -563,7 +590,7 @@ index 69f08d289f..0615d0ed97 100644
reasonable default for this variable based on the system locale. 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 @subsection locale_dir
If this variable is set, it names the directory where translation files may 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 default for this variable if internationalization is needed and any
translation files are available. 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 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 (@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 dynamically loaded from this directory, so it must be set correctly in order
for many parts of GRUB to work. 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. amount of state.
The environment block is a preallocated 1024-byte file, which normally lives 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 +@command{grub2-mkconfig} uses this facility to implement
@samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}). @samp{GRUB_SAVEDEFAULT} (@pxref{Simple configuration}).
@node Modules
@@ -4476,7 +4483,7 @@ Translate @var{string} into the current language. @@ -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 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 environment (@pxref{lang}). Translation files in MO format are read from
@ -615,7 +642,7 @@ index 69f08d289f..0615d0ed97 100644
@end deffn @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 @deffn Command password_pbkdf2 user hashed-password
Define a user named @var{user} with password hash @var{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}. to generate password hashes. @xref{Security}.
@end deffn @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 which has an associated password. @samp{password} sets the password in
plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2} plain text, requiring @file{grub.cfg} to be secure; @samp{password_pbkdf2}
sets the password hashed using the Password-Based Key Derivation Function 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 In order to enable authentication support, the @samp{superusers} environment
variable must be set to a list of usernames, separated by any of spaces, 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 group
@end example @end example
@ -644,11 +671,13 @@ index 69f08d289f..0615d0ed97 100644
generating configuration files with authentication. You can use generating configuration files with authentication. You can use
@file{/etc/grub.d/40_custom} to add simple superuser authentication, by @file{/etc/grub.d/40_custom} to add simple superuser authentication, by
adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2} 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} 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}). -(@pxref{Invoking grub-install}).
+using the @code{--pubkey} option to @command{grub2-install}
+(@pxref{Invoking grub2-install}). +(@pxref{Invoking grub2-install}).
+ +
+@comment Unfortunately --pubkey is not yet supported by 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 GRUB uses GPG-style detached signatures (meaning that a file
@file{foo.sig} will be produced when file @file{foo} is signed), and @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 For successful validation of all of GRUB's subcomponents and the
loaded OS kernel, they must all be signed. One way to accomplish this loaded OS kernel, they must all be signed. One way to accomplish this
is the following (after having already produced the desired is the following (after having already produced the desired
@ -674,7 +703,7 @@ index 69f08d289f..0615d0ed97 100644
@example @example
@group @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 Note that internally signature enforcement is controlled by setting
the environment variable @code{check_signatures} equal to the environment variable @code{check_signatures} equal to
@code{enforce}. Passing one or more @code{--pubkey} options 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 equal to @code{enforce} in @file{core.img} prior to processing any
configuration files. 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} GRUB's normal start-up procedure involves setting the @samp{prefix}
environment variable to a value set in the core image by 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. things GRUB is supposed to do.
If, instead, you only get a rescue shell, this usually means that GRUB 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 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 GRUB was not correctly installed. It may be more useful to try to reinstall
@ -707,7 +745,7 @@ index 69f08d289f..0615d0ed97 100644
@itemize @bullet{} @itemize @bullet{}
@item @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. drive ordering entirely.
@item @item
@ -716,14 +754,34 @@ index 69f08d289f..0615d0ed97 100644
to a partition but GRUB has already been installed in the master boot to a partition but GRUB has already been installed in the master boot
record, then the GRUB installation in the partition will be ignored. 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 @@ -7052,33 +7069,33 @@ bootability on other machines.
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 -@node Invoking grub-install
-@chapter Invoking grub-install -@section Invoking grub-install
+@node Invoking grub2-install +@node Invoking grub2-install
+@chapter Invoking grub2-install +@section Invoking grub2-install
-The program @command{grub-install} generates a GRUB core image using -The program @command{grub-install} generates a GRUB core image using
-@command{grub-mkimage} and installs it on your system. You must specify the -@command{grub-mkimage} and installs it on your system. You must specify the
@ -744,7 +802,7 @@ index 69f08d289f..0615d0ed97 100644
@table @option @table @option
@item --help @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 If this option is not specified then it defaults to @file{/boot}, so
@example @example
@ -760,7 +818,7 @@ index 69f08d289f..0615d0ed97 100644
@end example @end example
Here is an example in which you have a separate @dfn{boot} partition which is 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}: @file{/mnt/boot}:
@example @example
@ -780,14 +838,14 @@ index 69f08d289f..0615d0ed97 100644
extra space in the bootloader embedding area for Reed-Solomon extra space in the bootloader embedding area for Reed-Solomon
error-correcting codes. This enables GRUB to still boot successfully error-correcting codes. This enables GRUB to still boot successfully
if some blocks are corrupted. The exact amount of protection offered 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. outside of the MBR. Disable the Reed-Solomon codes with this option.
@end table @end table
-@node Invoking grub-mkconfig -@node Invoking grub-mkconfig
-@chapter Invoking grub-mkconfig -@section Invoking grub-mkconfig
+@node Invoking grub2-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{grub-mkconfig} generates a configuration file for GRUB
+The program @command{grub2-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 @example
-grub-mkconfig -o /boot/grub/grub.cfg -grub-mkconfig -o /boot/grub/grub.cfg
+grub-mkconfig -o /boot/grub2/grub.cfg +grub2-mkconfig -o /boot/grub2/grub.cfg
@end example @end example
-@command{grub-mkconfig} accepts the following options: -@command{grub-mkconfig} accepts the following options:
@ -803,21 +861,22 @@ index 69f08d289f..0615d0ed97 100644
@table @option @table @option
@item --help @item --help
@@ -6553,17 +6570,17 @@ it to standard output. @@ -7156,17 +7173,17 @@ it to standard output.
@end table @end table
-@node Invoking grub-mkpasswd-pbkdf2 -@node Invoking grub-mkpasswd-pbkdf2
-@chapter Invoking grub-mkpasswd-pbkdf2 -@section Invoking grub-mkpasswd-pbkdf2
+@node Invoking grub2-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{grub-mkpasswd-pbkdf2} generates password hashes for
+The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for +The program @command{grub2-mkpasswd-pbkdf2} generates password hashes for
GRUB (@pxref{Security}). GRUB (@pxref{Security}).
@example @example
grub-mkpasswd-pbkdf2 -grub-mkpasswd-pbkdf2
+grub2-mkpasswd-pbkdf2
@end example @end example
-@command{grub-mkpasswd-pbkdf2} accepts the following options: -@command{grub-mkpasswd-pbkdf2} accepts the following options:
@ -825,14 +884,14 @@ index 69f08d289f..0615d0ed97 100644
@table @option @table @option
@item -c @var{number} @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 @end table
-@node Invoking grub-mkrelpath -@node Invoking grub-mkrelpath
-@chapter Invoking grub-mkrelpath -@section Invoking grub-mkrelpath
+@node Invoking grub2-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{grub-mkrelpath} makes a file system path relative to
+The program @command{grub2-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 @table @option
@item --help @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 @end table
-@node Invoking grub-mkrescue -@node Invoking grub-mkrescue
-@chapter Invoking grub-mkrescue -@section Invoking grub-mkrescue
+@node Invoking grub2-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{grub-mkrescue} generates a bootable GRUB rescue image
+The program @command{grub2-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}). (@pxref{Making a GRUB bootable CD-ROM}).
@example @example
grub-mkrescue -o grub.iso -grub-mkrescue -o grub.iso
+grub2-mkrescue -o grub.iso
@end example @end example
-All arguments not explicitly listed as @command{grub-mkrescue} options are -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. passed on directly to @command{xorriso} in @command{mkisofs} emulation mode.
Options passed to @command{xorriso} will normally be interpreted as Options passed to @command{xorriso} will normally be interpreted as
@command{mkisofs} options; if the option @samp{--} is used, then anything @command{mkisofs} options; if the option @samp{--} is used, then anything
@@ -6633,7 +6650,7 @@ mkdir -p disk/boot/grub @@ -7233,10 +7250,10 @@ commonly used to add extra files to the image:
grub-mkrescue -o grub.iso disk @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 @end example
-@command{grub-mkrescue} accepts the following options: -@command{grub-mkrescue} accepts the following options:
@ -886,7 +950,7 @@ index 69f08d289f..0615d0ed97 100644
@table @option @table @option
@item --help @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. default.
@item --grub-mkimage=@var{file} @item --grub-mkimage=@var{file}
@ -897,16 +961,16 @@ index 69f08d289f..0615d0ed97 100644
-@node Invoking grub-mount -@node Invoking grub-mount
-@chapter Invoking grub-mount -@section Invoking grub-mount
+@node Invoking grub2-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{grub-mount} performs a read-only mount of any file
+The program @command{grub2-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 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 drivers via FUSE. (It is only available if FUSE development files were
present when GRUB was built.) This has a number of uses: 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. system type.
@end itemize @end itemize
@ -914,7 +978,8 @@ index 69f08d289f..0615d0ed97 100644
+Using @command{grub2-mount} is normally as simple as: +Using @command{grub2-mount} is normally as simple as:
@example @example
grub-mount /dev/sda1 /mnt -grub-mount /dev/sda1 /mnt
+grub2-mount /dev/sda1 /mnt
@end example @end example
-@command{grub-mount} must be given one or more images and a mount point as -@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 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: 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} @item -K prompt|@var{file}
@itemx --zfs-key=prompt|@var{file} @itemx --zfs-key=prompt|@var{file}
Load a ZFS encryption key. If you use @samp{prompt} as the argument, 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. root of the supplied file system.
If @var{device} is just a number, then it will be treated as a partition 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 @end table
-@node Invoking grub-probe -@node Invoking grub-probe
-@chapter Invoking grub-probe -@section Invoking grub-probe
+@node Invoking grub2-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{grub-probe} probes device information for a given path
+The program @command{grub2-probe} probes device information for a given path +The program @command{grub2-probe} probes device information for a given path
or device. or device.
@example @example
@@ -6764,7 +6781,7 @@ grub-probe --target=fs /boot/grub -grub-probe --target=fs /boot/grub
grub-probe --target=drive --device /dev/sda1 -grub-probe --target=drive --device /dev/sda1
+grub2-probe --target=fs /boot/grub
+grub2-probe --target=drive --device /dev/sda1
@end example @end example
-@command{grub-probe} must be given a path or device as a non-option -@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: argument, and also accepts the following options:
@table @option @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 @item -d
@itemx --device @itemx --device
If this option is given, then the non-option argument is a system 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} @item -t @var{target}
@itemx --target=@var{target} @itemx --target=@var{target}
@@ -6839,19 +6856,19 @@ Print verbose messages. @@ -7442,19 +7459,19 @@ Print verbose messages.
@end table @end table
-@node Invoking grub-script-check -@node Invoking grub-script-check
-@chapter Invoking grub-script-check -@section Invoking grub-script-check
+@node Invoking grub2-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{grub-script-check} takes a GRUB script file
+The program @command{grub2-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 @example
-grub-script-check /boot/grub/grub.cfg -grub-script-check /boot/grub/grub.cfg
+grub-script-check /boot/grub2/grub.cfg +grub2-script-check /boot/grub2/grub.cfg
@end example @end example
-@command{grub-script-check} accepts the following options: -@command{grub-script-check} accepts the following options:

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

@ -19,12 +19,12 @@ variable and loading the config file from the subvolume.
Signed-off-by: Jeff Mahoney <jeffm@suse.com> 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 + 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 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 --- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c
@@ -38,6 +38,9 @@ @@ -38,6 +38,9 @@
@ -89,7 +89,7 @@ index 63203034df..f1fff7385b 100644
static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2, static grub_disk_addr_t superblock_sectors[] = { 64 * 2, 64 * 1024 * 2,
256 * 1048576 * 2, 1048576ULL * 1048576ULL * 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; return GRUB_ERR_NONE;
} }
@ -152,7 +152,7 @@ index 63203034df..f1fff7385b 100644
static struct grub_btrfs_data * static struct grub_btrfs_data *
grub_btrfs_mount (grub_device_t dev) 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].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id; data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -166,7 +166,7 @@ index 63203034df..f1fff7385b 100644
return data; 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; return GRUB_ERR_NONE;
} }
@ -258,7 +258,7 @@ index 63203034df..f1fff7385b 100644
static grub_err_t static grub_err_t
find_path (struct grub_btrfs_data *data, find_path (struct grub_btrfs_data *data,
const char *path, struct grub_btrfs_key *key, 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; char *origpath = NULL;
unsigned symlinks_max = 32; unsigned symlinks_max = 32;
@ -289,15 +289,18 @@ index 63203034df..f1fff7385b 100644
while (1) while (1)
{ {
while (path[0] == '/') 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; path = path_alloc = tmp;
if (path[0] == '/') if (path[0] == '/')
{ {
- err = get_root (data, key, tree, type); - err = get_root (data, key, tree, type);
- if (err) - if (err)
- return err;
+ if (data->fs_tree) + if (data->fs_tree)
+ { {
- grub_free (direl);
- grub_free (path_alloc);
- grub_free (origpath);
- return err;
+ *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY; + *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
+ *tree = data->fs_tree; + *tree = data->fs_tree;
+ /* This is a tree root, so everything starts at objectid 256 */ + /* 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); + err = get_root (data, key, tree, type);
+ if (err) + if (err)
+ return err; + {
+ } + grub_free (direl);
+ grub_free (path_alloc);
+ grub_free (origpath);
+ return err;
+ }
}
} }
continue; continue;
} @@ -2256,18 +2450,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
@@ -2114,18 +2308,10 @@ grub_btrfs_read (grub_file_t file, char *buf, grub_size_t len)
data->tree, file->offset, buf, 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[0]),
grub_be_to_cpu16 (data->sblock.uuid[1]), grub_be_to_cpu16 (data->sblock.uuid[1]),
grub_be_to_cpu16 (data->sblock.uuid[2]), 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[5]),
grub_be_to_cpu16 (data->sblock.uuid[6]), grub_be_to_cpu16 (data->sblock.uuid[6]),
grub_be_to_cpu16 (data->sblock.uuid[7])); grub_be_to_cpu16 (data->sblock.uuid[7]));
@ -357,7 +364,7 @@ index 63203034df..f1fff7385b 100644
grub_btrfs_unmount (data); 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 #endif
@ -600,7 +607,7 @@ index 63203034df..f1fff7385b 100644
static struct grub_fs grub_btrfs_fs = { static struct grub_fs grub_btrfs_fs = {
.name = "btrfs", .name = "btrfs",
.fs_dir = grub_btrfs_dir, .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 #endif
}; };
@ -690,7 +697,7 @@ index 63203034df..f1fff7385b 100644
+ +
+// vim: si et sw=2: +// vim: si et sw=2:
diff --git a/include/grub/btrfs.h b/include/grub/btrfs.h 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 --- a/include/grub/btrfs.h
+++ b/include/grub/btrfs.h +++ b/include/grub/btrfs.h
@@ -29,6 +29,7 @@ enum @@ -29,6 +29,7 @@ enum

@ -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 ");

@ -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)

@ -12,10 +12,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c 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 --- a/grub-core/fs/btrfs.c
+++ b/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); subvol_set_env);
grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env, grub_register_variable_hook ("btrfs_subvolid", subvolid_get_env,
subvolid_set_env); subvolid_set_env);

@ -10,10 +10,10 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1 file changed, 76 insertions(+), 31 deletions(-) 1 file changed, 76 insertions(+), 31 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c 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 --- a/grub-core/fs/btrfs.c
+++ b/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; struct grub_btrfs_data *data;
grub_err_t err; grub_err_t err;
@ -21,7 +21,7 @@ index ad1b56b716..113c1f746c 100644
if (!dev->disk) 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].dev = dev;
data->devices_attached[0].id = data->sblock.this_device.device_id; data->devices_attached[0].id = data->sblock.this_device.device_id;
@ -40,7 +40,7 @@ index ad1b56b716..113c1f746c 100644
} }
return data; 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; grub_size_t allocated = 0;
struct grub_btrfs_dir_item *direl = NULL; struct grub_btrfs_dir_item *direl = NULL;
struct grub_btrfs_key key_out; struct grub_btrfs_key key_out;
@ -87,7 +87,7 @@ index ad1b56b716..113c1f746c 100644
} }
else 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) while (1)
{ {
@ -120,7 +120,7 @@ index ad1b56b716..113c1f746c 100644
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY) 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] == '.') if (ctokenlen == 1 && ctoken[0] == '.')
{ {
@ -131,7 +131,7 @@ index ad1b56b716..113c1f746c 100644
continue; continue;
} }
if (ctokenlen == 2 && ctoken[0] == '.' && ctoken[1] == '.') 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; *type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
key->object_id = key_out.offset; key->object_id = key_out.offset;
@ -143,7 +143,7 @@ index ad1b56b716..113c1f746c 100644
continue; 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; return err;
} }
@ -154,7 +154,7 @@ index ad1b56b716..113c1f746c 100644
if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK) if (cdirel->type == GRUB_BTRFS_DIR_ITEM_TYPE_SYMLINK)
{ {
struct grub_btrfs_inode inode; 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; path = path_alloc = tmp;
if (path[0] == '/') if (path[0] == '/')
{ {
@ -188,7 +188,7 @@ index ad1b56b716..113c1f746c 100644
} }
else else
{ {
@@ -2716,6 +2760,7 @@ GRUB_MOD_INIT (btrfs) @@ -2922,6 +2966,7 @@ GRUB_MOD_INIT (btrfs)
subvolid_set_env); subvolid_set_env);
grub_env_export ("btrfs_subvol"); grub_env_export ("btrfs_subvol");
grub_env_export ("btrfs_subvolid"); grub_env_export ("btrfs_subvolid");

@ -9,16 +9,16 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
grub-core/osdep/linux/getroot.c | 7 +++++++ grub-core/osdep/linux/getroot.c | 7 +++++++
grub-core/osdep/unix/config.c | 17 +++++++++++++++-- grub-core/osdep/unix/config.c | 17 +++++++++++++++--
util/config.c | 10 ++++++++++ util/config.c | 10 ++++++++++
util/grub-install.c | 15 +++++++++++++++ util/grub-install.c | 14 ++++++++++++++
util/grub-mkrelpath.c | 6 ++++++ util/grub-mkrelpath.c | 6 ++++++
include/grub/emu/config.h | 1 + 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 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 --- a/grub-core/osdep/linux/getroot.c
+++ b/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; return NULL;
} }
@ -26,7 +26,7 @@ index 001b818fe5..caf9b1ccd3 100644
char ** char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) 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); ret = grub_find_root_devices_from_btrfs (dir);
fs_prefix = get_btrfs_fs_prefix (entries[i].enc_path); 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) 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 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 --- a/grub-core/osdep/unix/config.c
+++ b/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) @@ -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[2] = script;
argv[3] = '\0'; argv[3] = '\0';
diff --git a/util/config.c b/util/config.c diff --git a/util/config.c b/util/config.c
index ebcdd8f5e2..f044a880a7 100644 index ebcdd8f5e22..f044a880a76 100644
--- a/util/config.c --- a/util/config.c
+++ b/util/config.c +++ b/util/config.c
@@ -42,6 +42,16 @@ grub_util_parse_config (FILE *f, struct grub_util_config *cfg, int simple) @@ -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) sizeof ("GRUB_DISTRIBUTOR=") - 1) == 0)
{ {
diff --git a/util/grub-install.c b/util/grub-install.c 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 --- a/util/grub-install.c
+++ b/util/grub-install.c +++ b/util/grub-install.c
@@ -827,6 +827,8 @@ fill_core_services (const char *core_services) @@ -843,6 +843,8 @@ try_open (const char *path)
free (sysv_plist);
} }
#endif
+extern int use_relative_path_on_btrfs; +extern int use_relative_path_on_btrfs;
+ +
int int
main (int argc, char *argv[]) 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); grub_util_load_config (&config);
@ -118,11 +118,10 @@ index 0fbe7f78c6..0f66f36d23 100644
if (!bootloader_id && config.grub_distributor) if (!bootloader_id && config.grub_distributor)
{ {
char *ptr; char *ptr;
@@ -1352,6 +1357,16 @@ main (int argc, char *argv[]) @@ -1366,6 +1371,15 @@ main (int argc, char *argv[])
fprintf (load_cfg_f, "set debug='%s'\n", relative_grubdir = xstrdup ("/");
debug_image);
} }
+
+ if (config.is_suse_btrfs_snapshot_enabled + if (config.is_suse_btrfs_snapshot_enabled
+ && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0) + && grub_strncmp(grub_fs->name, "btrfs", sizeof ("btrfs") - 1) == 0)
+ { + {
@ -136,7 +135,7 @@ index 0fbe7f78c6..0f66f36d23 100644
char *install_drive = NULL; char *install_drive = NULL;
diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c 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 --- a/util/grub-mkrelpath.c
+++ b/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c
@@ -40,9 +40,12 @@ struct arguments @@ -40,9 +40,12 @@ struct arguments
@ -163,7 +162,7 @@ index 47a241a391..5db7a9a7d9 100644
if (state->arg_num == 0) if (state->arg_num == 0)
arguments->pathname = xstrdup (arg); arguments->pathname = xstrdup (arg);
diff --git a/include/grub/emu/config.h b/include/grub/emu/config.h 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 --- a/include/grub/emu/config.h
+++ b/include/grub/emu/config.h +++ b/include/grub/emu/config.h
@@ -37,6 +37,7 @@ struct grub_util_config @@ -37,6 +37,7 @@ struct grub_util_config

@ -13,10 +13,10 @@ Signed-off-by: Michael Chang <mchang@suse.com>
5 files changed, 38 insertions(+), 2 deletions(-) 5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in 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 --- a/util/grub-mkconfig.in
+++ b/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_BADRAM \
GRUB_OS_PROBER_SKIP_LIST \ GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \ GRUB_DISABLE_SUBMENU \
@ -27,7 +27,7 @@ index 005f093809..535c0f0249 100644
if test "x${grub_cfg}" != "x"; then if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new" rm -f "${grub_cfg}.new"
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in 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 --- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in
@@ -49,7 +49,11 @@ grub_warn () @@ -49,7 +49,11 @@ grub_warn ()
@ -43,7 +43,7 @@ index 0f6505bf3b..5e96f6cc5d 100644
is_path_readable_by_grub () is_path_readable_by_grub ()
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in 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 --- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in
@@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@" @@ -27,6 +27,14 @@ export TEXTDOMAINDIR="@localedir@"
@ -90,10 +90,10 @@ index 858b526c92..de727e6ee6 100644
+EOF +EOF
+fi +fi
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in 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 --- a/util/grub.d/10_linux.in
+++ b/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 case x"$GRUB_FS" in
xbtrfs) xbtrfs)
@ -109,10 +109,10 @@ index 292e333324..7bb3a211a7 100644
xzfs) xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` 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 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 --- a/util/grub.d/20_linux_xen.in
+++ b/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 case x"$GRUB_FS" in
xbtrfs) xbtrfs)

@ -13,7 +13,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4 files changed, 392 insertions(+), 5 deletions(-) 4 files changed, 392 insertions(+), 5 deletions(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c 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 --- a/grub-core/fs/btrfs.c
+++ b/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c
@@ -41,6 +41,7 @@ @@ -41,6 +41,7 @@
@ -37,7 +37,7 @@ index 113c1f746c..d323746ecf 100644
static grub_err_t static grub_err_t
read_sblock (grub_disk_t disk, struct grub_btrfs_superblock *sb) 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_err_t err;
grub_uint64_t tree = 0; grub_uint64_t tree = 0;
grub_uint8_t type; grub_uint8_t type;
@ -64,10 +64,10 @@ index 113c1f746c..d323746ecf 100644
if (err) if (err)
return grub_error(GRUB_ERR_FILE_NOT_FOUND, "couldn't locate %s\n", path); 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, @@ -2316,11 +2340,20 @@ grub_btrfs_dir (grub_device_t device, const char *path,
int r = 0;
grub_uint64_t tree; grub_uint64_t tree;
grub_uint8_t type; grub_uint8_t type;
grub_size_t est_size = 0;
+ char *new_path = NULL; + char *new_path = NULL;
if (!data) if (!data)
@ -86,7 +86,7 @@ index 113c1f746c..d323746ecf 100644
if (err) if (err)
{ {
grub_btrfs_unmount (data); 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; struct grub_btrfs_inode inode;
grub_uint8_t type; grub_uint8_t type;
struct grub_btrfs_key key_in; struct grub_btrfs_key key_in;
@ -109,7 +109,7 @@ index 113c1f746c..d323746ecf 100644
if (err) if (err)
{ {
grub_btrfs_unmount (data); 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; return 0;
} }
@ -260,7 +260,7 @@ index 113c1f746c..d323746ecf 100644
static grub_err_t static grub_err_t
get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree, get_fs_root(struct grub_btrfs_data *data, grub_uint64_t tree,
grub_uint64_t objectid, grub_uint64_t offset, 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; static grub_command_t cmd_info;
@ -268,7 +268,7 @@ index 113c1f746c..d323746ecf 100644
static grub_extcmd_t cmd_list_subvols; static grub_extcmd_t cmd_list_subvols;
static char * 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, cmd_info = grub_register_command("btrfs-info", grub_cmd_btrfs_info,
"DEVICE", "DEVICE",
"Print BtrFS info about DEVICE."); "Print BtrFS info about DEVICE.");
@ -279,10 +279,10 @@ index 113c1f746c..d323746ecf 100644
grub_cmd_btrfs_list_subvols, 0, grub_cmd_btrfs_list_subvols, 0,
"[-p|-n] [-o var] DEVICE", "[-p|-n] [-o var] DEVICE",
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c 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 --- a/grub-core/osdep/linux/getroot.c
+++ b/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]; grub_uint32_t unused[9];
}; };
@ -297,7 +297,7 @@ index caf9b1ccd3..28790307e0 100644
struct btrfs_ioctl_search_args { struct btrfs_ioctl_search_args {
struct btrfs_ioctl_search_key key; struct btrfs_ioctl_search_key key;
grub_uint64_t buf[(4096 - sizeof(struct btrfs_ioctl_search_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; int use_relative_path_on_btrfs = 0;
@ -407,7 +407,7 @@ index caf9b1ccd3..28790307e0 100644
char ** char **
grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) 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) else if (grub_strcmp (entries[i].fstype, "btrfs") == 0)
{ {
ret = grub_find_root_devices_from_btrfs (dir); 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) 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; return grub_dev;
} }
@ -462,10 +462,10 @@ index caf9b1ccd3..28790307e0 100644
grub_make_system_path_relative_to_its_root_os (const char *path) grub_make_system_path_relative_to_its_root_os (const char *path)
{ {
diff --git a/util/grub-install.c b/util/grub-install.c 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 --- a/util/grub-install.c
+++ b/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]); prefix_drive = xasprintf ("(%s)", grub_drives[0]);
} }
@ -522,7 +522,7 @@ index 0f66f36d23..84ed6e88ec 100644
const char *core_name = NULL; const char *core_name = NULL;
diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h 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 --- a/include/grub/emu/getroot.h
+++ b/include/grub/emu/getroot.h +++ b/include/grub/emu/getroot.h
@@ -53,6 +53,11 @@ char ** @@ -53,6 +53,11 @@ char **

@ -10,10 +10,10 @@ Ref: bsc#953538
1 file changed, 31 insertions(+), 1 deletion(-) 1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c 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 --- a/grub-core/fs/btrfs.c
+++ b/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; return GRUB_ERR_NONE;
} }

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

@ -10,21 +10,21 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 32 insertions(+), 4 deletions(-) 1 file changed, 32 insertions(+), 4 deletions(-)
diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h 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 --- a/include/grub/efi/efi.h
+++ b/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h
@@ -24,6 +24,10 @@ @@ -36,6 +36,10 @@ struct linux_arch_kernel_header {
#include <grub/dl.h> struct grub_pe_image_header pe_image_header;
#include <grub/efi/api.h> };
+/* Variables. */ +/* Variables. */
+extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table); +extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
+extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle); +extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);
+ +
/* Functions. */ /* 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); 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_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version); grub_efi_uint32_t *descriptor_version);
void grub_efi_memory_fini (void); void grub_efi_memory_fini (void);
@ -39,7 +39,7 @@ index 585fa6662b..03f9a9d011 100644
+ grub_efi_status_t status; + grub_efi_status_t status;
+ +
+ b = grub_efi_system_table->boot_services; + 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; + return status;
+} +}
+ +
@ -51,14 +51,14 @@ index 585fa6662b..03f9a9d011 100644
+ grub_efi_status_t status; + grub_efi_status_t status;
+ +
+ b = grub_efi_system_table->boot_services; + b = grub_efi_system_table->boot_services;
+ status = efi_call_1 (b->free_pool, buffer); + status = b->free_pool(buffer);
+ return status; + return status;
+} +}
+ +
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle); 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); 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); 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_fini (void);
void grub_efi_set_prefix (void); void grub_efi_set_prefix (void);

@ -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);

@ -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

@ -8,10 +8,10 @@ Subject: [PATCH] don't use int for efi status
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c 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 --- a/grub-core/kern/efi/efi.c
+++ b/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 void
grub_exit (int retval) grub_exit (int retval)
{ {

@ -8,7 +8,7 @@ Subject: [PATCH] make GRUB_MOD_INIT() declare its function prototypes.
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/include/grub/dl.h b/include/grub/dl.h 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 --- a/include/grub/dl.h
+++ b/include/grub/dl.h +++ b/include/grub/dl.h
@@ -54,6 +54,7 @@ grub_mod_fini (void) @@ -54,6 +54,7 @@ grub_mod_fini (void)

@ -16,10 +16,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 1 insertion(+), 11 deletions(-) 1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c 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 --- a/util/grub-install.c
+++ b/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; char *d;
is_guess = 1; is_guess = 1;

@ -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);

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

@ -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))

@ -9,7 +9,7 @@ Subject: [PATCH] align struct efi_variable better...
2 files changed, 2 insertions(+), 1 deletion(-) 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h 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 --- a/include/grub/efiemu/runtime.h
+++ b/include/grub/efiemu/runtime.h +++ b/include/grub/efiemu/runtime.h
@@ -33,5 +33,5 @@ struct efi_variable @@ -33,5 +33,5 @@ struct efi_variable
@ -20,10 +20,10 @@ index 36d2dedf47..9d93ba88ba 100644
+} GRUB_PACKED GRUB_ALIGNED(8); +} GRUB_PACKED GRUB_ALIGNED(8);
#endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */ #endif /* ! GRUB_EFI_EMU_RUNTIME_HEADER */
diff --git a/include/grub/types.h b/include/grub/types.h 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 --- a/include/grub/types.h
+++ b/include/grub/types.h +++ b/include/grub/types.h
@@ -29,6 +29,7 @@ @@ -30,6 +30,7 @@
#else #else
#define GRUB_PACKED __attribute__ ((packed)) #define GRUB_PACKED __attribute__ ((packed))
#endif #endif

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

@ -12,10 +12,10 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c 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 --- a/grub-core/kern/misc.c
+++ b/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) grub_abort (void)
{ {
#ifndef GRUB_UTIL #ifndef GRUB_UTIL

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

@ -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;

@ -8,7 +8,7 @@ Subject: [PATCH] normal: don't draw our startup message if debug is set
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c 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 --- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c +++ b/grub-core/normal/main.c
@@ -430,6 +430,9 @@ grub_normal_reader_init (int nested) @@ -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 " msg_formatted = grub_xasprintf (_("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere " "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 "

@ -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 diff --git a/include/grub/arm/efi/console.h b/include/grub/arm/efi/console.h
new file mode 100644 new file mode 100644
index 0000000000..1592f6f76b index 00000000000..1592f6f76b5
--- /dev/null --- /dev/null
+++ b/include/grub/arm/efi/console.h +++ b/include/grub/arm/efi/console.h
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
@ -47,7 +47,7 @@ index 0000000000..1592f6f76b
+#endif /* ! GRUB_ARM_EFI_CONSOLE_H */ +#endif /* ! GRUB_ARM_EFI_CONSOLE_H */
diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h diff --git a/include/grub/arm64/efi/console.h b/include/grub/arm64/efi/console.h
new file mode 100644 new file mode 100644
index 0000000000..9568933938 index 00000000000..95689339384
--- /dev/null --- /dev/null
+++ b/include/grub/arm64/efi/console.h +++ b/include/grub/arm64/efi/console.h
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
@ -77,7 +77,7 @@ index 0000000000..9568933938
+#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */ +#endif /* ! GRUB_ARM64_EFI_CONSOLE_H */
diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h diff --git a/include/grub/i386/efi/console.h b/include/grub/i386/efi/console.h
new file mode 100644 new file mode 100644
index 0000000000..9231375cb0 index 00000000000..9231375cb07
--- /dev/null --- /dev/null
+++ b/include/grub/i386/efi/console.h +++ b/include/grub/i386/efi/console.h
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
@ -107,7 +107,7 @@ index 0000000000..9231375cb0
+#endif /* ! GRUB_I386_EFI_CONSOLE_H */ +#endif /* ! GRUB_I386_EFI_CONSOLE_H */
diff --git a/include/grub/x86_64/efi/console.h b/include/grub/x86_64/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 new file mode 100644
index 0000000000..dba9d8678d index 00000000000..dba9d8678d0
--- /dev/null --- /dev/null
+++ b/include/grub/x86_64/efi/console.h +++ b/include/grub/x86_64/efi/console.h
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@

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

@ -15,7 +15,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++ grub-core/kern/i386/backtrace.c | 125 ++++++++++++++++++++++++++++++++
grub-core/kern/i386/pc/init.c | 4 +- grub-core/kern/i386/pc/init.c | 4 +-
grub-core/kern/ieee1275/init.c | 1 - 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/kern/mm.c | 6 +-
grub-core/lib/arm64/backtrace.c | 62 ---------------- grub-core/lib/arm64/backtrace.c | 62 ----------------
grub-core/lib/i386/backtrace.c | 78 -------------------- 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/ia64/efi/startup.S | 3 +-
grub-core/kern/sparc64/ieee1275/crt0.S | 3 +- grub-core/kern/sparc64/ieee1275/crt0.S | 3 +-
grub-core/Makefile.am | 1 + 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%) rename grub-core/{lib => commands}/backtrace.c (98%)
create mode 100644 grub-core/kern/arm64/backtrace.c create mode 100644 grub-core/kern/arm64/backtrace.c
create mode 100644 grub-core/kern/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 delete mode 100644 grub-core/lib/i386/backtrace.c
diff --git a/Makefile.util.def b/Makefile.util.def diff --git a/Makefile.util.def b/Makefile.util.def
index 88f55e35c4..bda9fd1211 100644 index acbcc8c208c..1079add5bbe 100644
--- a/Makefile.util.def --- a/Makefile.util.def
+++ b/Makefile.util.def +++ b/Makefile.util.def
@@ -51,6 +51,12 @@ library = { @@ -51,6 +51,12 @@ library = {
@ -55,10 +55,10 @@ index 88f55e35c4..bda9fd1211 100644
library = { library = {
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def 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 --- a/grub-core/Makefile.core.def
+++ b/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/rescue_reader.c;
common = kern/term.c; common = kern/term.c;
common = kern/verifiers.c; common = kern/verifiers.c;
@ -71,7 +71,7 @@ index 058c88ac3a..52ec0fafcd 100644
noemu = kern/compiler-rt.c; noemu = kern/compiler-rt.c;
noemu = kern/mm.c; noemu = kern/mm.c;
@@ -188,9 +194,6 @@ kernel = { @@ -199,9 +205,6 @@ kernel = {
softdiv = lib/division.c; softdiv = lib/division.c;
@ -81,7 +81,7 @@ index 058c88ac3a..52ec0fafcd 100644
i386 = kern/i386/dl.c; i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c; i386_xen = kern/i386/dl.c;
i386_xen_pvh = kern/i386/dl.c; i386_xen_pvh = kern/i386/dl.c;
@@ -2399,15 +2402,12 @@ module = { @@ -2455,15 +2458,12 @@ module = {
module = { module = {
name = backtrace; name = backtrace;
@ -103,7 +103,7 @@ diff --git a/grub-core/lib/backtrace.c b/grub-core/commands/backtrace.c
similarity index 98% similarity index 98%
rename from grub-core/lib/backtrace.c rename from grub-core/lib/backtrace.c
rename to grub-core/commands/backtrace.c rename to grub-core/commands/backtrace.c
index c0ad6ab8be..8b5ec3913b 100644 index c0ad6ab8be1..8b5ec3913b5 100644
--- a/grub-core/lib/backtrace.c --- a/grub-core/lib/backtrace.c
+++ b/grub-core/commands/backtrace.c +++ b/grub-core/commands/backtrace.c
@@ -54,7 +54,7 @@ grub_cmd_backtrace (grub_command_t cmd __attribute__ ((unused)), @@ -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 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 --- a/grub-core/gdb/cstub.c
+++ b/grub-core/gdb/cstub.c +++ b/grub-core/gdb/cstub.c
@@ -215,7 +215,6 @@ grub_gdb_trap (int trap_no) @@ -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 diff --git a/grub-core/kern/arm64/backtrace.c b/grub-core/kern/arm64/backtrace.c
new file mode 100644 new file mode 100644
index 0000000000..019c6fdfef index 00000000000..019c6fdfef2
--- /dev/null --- /dev/null
+++ b/grub-core/kern/arm64/backtrace.c +++ b/grub-core/kern/arm64/backtrace.c
@@ -0,0 +1,94 @@ @@ -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 diff --git a/grub-core/kern/backtrace.c b/grub-core/kern/backtrace.c
new file mode 100644 new file mode 100644
index 0000000000..4a82e865cc index 00000000000..4a82e865cc6
--- /dev/null --- /dev/null
+++ b/grub-core/kern/backtrace.c +++ b/grub-core/kern/backtrace.c
@@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
@ -331,10 +331,10 @@ index 0000000000..4a82e865cc
+ grub_backtrace (skip + 1); + grub_backtrace (skip + 1);
+} +}
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c 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 --- a/grub-core/kern/dl.c
+++ b/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; return 0;
} }
@ -385,7 +385,7 @@ index 7afb9e6f72..88d2077709 100644
/* Register a symbol with the name NAME and the address ADDR. */ /* Register a symbol with the name NAME and the address ADDR. */
grub_err_t grub_err_t
grub_dl_register_symbol (const char *name, void *addr, int isfunc, 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; const char *str;
Elf_Word size, entsize; Elf_Word size, entsize;
@ -395,7 +395,7 @@ index 7afb9e6f72..88d2077709 100644
i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) 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 diff --git a/grub-core/kern/i386/backtrace.c b/grub-core/kern/i386/backtrace.c
new file mode 100644 new file mode 100644
index 0000000000..2413f9a57d index 00000000000..2413f9a57db
--- /dev/null --- /dev/null
+++ b/grub-core/kern/i386/backtrace.c +++ b/grub-core/kern/i386/backtrace.c
@@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
@ -525,7 +525,7 @@ index 0000000000..2413f9a57d
+#endif +#endif
+} +}
diff --git a/grub-core/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c 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 --- a/grub-core/kern/i386/pc/init.c
+++ b/grub-core/kern/i386/pc/init.c +++ b/grub-core/kern/i386/pc/init.c
@@ -153,7 +153,7 @@ compact_mem_regions (void) @@ -153,7 +153,7 @@ compact_mem_regions (void)
@ -537,7 +537,7 @@ index 27bc68b8a5..b51d0abfa6 100644
/* Helper for grub_machine_init. */ /* Helper for grub_machine_init. */
static int 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. */ /* This has to happen before any BIOS calls. */
grub_via_workaround_init (); grub_via_workaround_init ();
@ -547,27 +547,23 @@ index 27bc68b8a5..b51d0abfa6 100644
/* Initialize the console as early as possible. */ /* Initialize the console as early as possible. */
grub_console_init (); grub_console_init ();
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c 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 --- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/init.c
@@ -63,7 +63,6 @@ @@ -70,7 +70,6 @@
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024) */
#endif #define RUNTIME_MIN_SPACE (128UL * 1024 * 1024)
-extern char _start[]; -extern char _start[];
extern char _end[]; extern char _end[];
#ifdef __sparc__ #ifdef __sparc__
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c 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 --- a/grub-core/kern/misc.c
+++ b/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) @@ -1302,12 +1302,12 @@ grub_printf_fmt_check (const char *fmt, const char *fmt_expected)
void __attribute__ ((noreturn))
/* Abort GRUB. This function does not return. */
-static void __attribute__ ((noreturn))
+static inline void __attribute__ ((noreturn))
grub_abort (void) grub_abort (void)
{ {
-#ifndef GRUB_UTIL -#ifndef GRUB_UTIL
@ -584,7 +580,7 @@ index c60601b699..a432a6be54 100644
#ifndef GRUB_UTIL #ifndef GRUB_UTIL
if (grub_term_inputs) 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; va_list ap;
@ -593,10 +589,10 @@ index c60601b699..a432a6be54 100644
grub_vprintf (_(fmt), ap); grub_vprintf (_(fmt), ap);
va_end (ap); va_end (ap);
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c 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 --- a/grub-core/kern/mm.c
+++ b/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; break;
if (! *r) 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 diff --git a/grub-core/lib/arm64/backtrace.c b/grub-core/lib/arm64/backtrace.c
deleted file mode 100644 deleted file mode 100644
index 1079b5380e..0000000000 index 1079b5380e1..00000000000
--- a/grub-core/lib/arm64/backtrace.c --- a/grub-core/lib/arm64/backtrace.c
+++ /dev/null +++ /dev/null
@@ -1,62 +0,0 @@ @@ -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 diff --git a/grub-core/lib/i386/backtrace.c b/grub-core/lib/i386/backtrace.c
deleted file mode 100644 deleted file mode 100644
index c67273db3a..0000000000 index c67273db3ae..00000000000
--- a/grub-core/lib/i386/backtrace.c --- a/grub-core/lib/i386/backtrace.c
+++ /dev/null +++ /dev/null
@@ -1,78 +0,0 @@ @@ -1,78 +0,0 @@
@ -766,7 +762,7 @@ index c67273db3a..0000000000
-} -}
- -
diff --git a/include/grub/backtrace.h b/include/grub/backtrace.h 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 --- a/include/grub/backtrace.h
+++ b/include/grub/backtrace.h +++ b/include/grub/backtrace.h
@@ -19,8 +19,14 @@ @@ -19,8 +19,14 @@
@ -787,10 +783,10 @@ index 395519762f..275cf85e2d 100644
#endif #endif
diff --git a/include/grub/dl.h b/include/grub/dl.h 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 --- a/include/grub/dl.h
+++ b/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 #endif
@ -800,7 +796,7 @@ index 91933b85f2..2f76e6b043 100644
int isfunc, grub_dl_t mod); int isfunc, grub_dl_t mod);
diff --git a/include/grub/kernel.h b/include/grub/kernel.h 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 --- a/include/grub/kernel.h
+++ b/include/grub/kernel.h +++ b/include/grub/kernel.h
@@ -111,6 +111,9 @@ grub_addr_t grub_modules_get_end (void); @@ -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)); void grub_main (void) __attribute__ ((noreturn));
diff --git a/grub-core/kern/arm/efi/startup.S b/grub-core/kern/arm/efi/startup.S 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 --- a/grub-core/kern/arm/efi/startup.S
+++ b/grub-core/kern/arm/efi/startup.S +++ b/grub-core/kern/arm/efi/startup.S
@@ -23,6 +23,8 @@ @@ -23,6 +23,8 @@
@ -827,7 +823,7 @@ index 9f8265315a..f3bc41f9d0 100644
/* /*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in r1/r0. * 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 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 --- a/grub-core/kern/arm/startup.S
+++ b/grub-core/kern/arm/startup.S +++ b/grub-core/kern/arm/startup.S
@@ -48,6 +48,8 @@ @@ -48,6 +48,8 @@
@ -840,7 +836,7 @@ index 3946fe8e18..5679a1d00a 100644
b codestart b codestart
diff --git a/grub-core/kern/arm64/efi/startup.S b/grub-core/kern/arm64/efi/startup.S 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 --- a/grub-core/kern/arm64/efi/startup.S
+++ b/grub-core/kern/arm64/efi/startup.S +++ b/grub-core/kern/arm64/efi/startup.S
@@ -19,7 +19,9 @@ @@ -19,7 +19,9 @@
@ -854,7 +850,7 @@ index 666a7ee3c9..41676bdb2b 100644
/* /*
* EFI_SYSTEM_TABLE and EFI_HANDLE are passed in x1/x0. * 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 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 --- a/grub-core/kern/i386/qemu/startup.S
+++ b/grub-core/kern/i386/qemu/startup.S +++ b/grub-core/kern/i386/qemu/startup.S
@@ -24,7 +24,8 @@ @@ -24,7 +24,8 @@
@ -868,7 +864,7 @@ index 0d89858d9b..939f182fc7 100644
jmp codestart jmp codestart
diff --git a/grub-core/kern/ia64/efi/startup.S b/grub-core/kern/ia64/efi/startup.S 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 --- a/grub-core/kern/ia64/efi/startup.S
+++ b/grub-core/kern/ia64/efi/startup.S +++ b/grub-core/kern/ia64/efi/startup.S
@@ -24,8 +24,9 @@ @@ -24,8 +24,9 @@
@ -883,7 +879,7 @@ index d75c6d7cc7..8f2a593e52 100644
alloc loc0=ar.pfs,2,4,0,0 alloc loc0=ar.pfs,2,4,0,0
mov loc1=rp mov loc1=rp
diff --git a/grub-core/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S 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 --- a/grub-core/kern/sparc64/ieee1275/crt0.S
+++ b/grub-core/kern/sparc64/ieee1275/crt0.S +++ b/grub-core/kern/sparc64/ieee1275/crt0.S
@@ -22,7 +22,8 @@ @@ -22,7 +22,8 @@
@ -897,7 +893,7 @@ index 03b916f053..701bf63abc 100644
ba codestart ba codestart
mov %o4, %o0 mov %o4, %o0
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am 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 --- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am +++ b/grub-core/Makefile.am
@@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h @@ -66,6 +66,7 @@ CLEANFILES += grub_script.yy.c grub_script.yy.h

@ -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
{

@ -26,7 +26,7 @@ Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/include/grub/kernel.h b/include/grub/kernel.h 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 --- a/include/grub/kernel.h
+++ b/include/grub/kernel.h +++ b/include/grub/kernel.h
@@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void); @@ -111,8 +111,10 @@ grub_addr_t grub_modules_get_end (void);

@ -8,15 +8,15 @@ Subject: [PATCH] Fixup for newer compiler
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/conf/Makefile.common b/conf/Makefile.common diff --git a/conf/Makefile.common b/conf/Makefile.common
index 191b1a70c6..5f0ef96985 100644 index ece9ed8a1bf..6262f21a772 100644
--- a/conf/Makefile.common --- a/conf/Makefile.common
+++ b/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) LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) 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
+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 +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
if !COND_emu
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding if COND_HAVE_ASM_USCORE
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d LDFLAGS_KERNEL += -Wl,--defsym=_malloc=_grub_malloc -Wl,--defsym=_free=_grub_free

@ -23,22 +23,22 @@ Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
[msalter: Fix max string calculation in grub_net_hwaddr_to_str] [msalter: Fix max string calculation in grub_net_hwaddr_to_str]
Signed-off-by: Mark Salter <msalter@redhat.com> 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/bootp.c | 15 ++--
grub-core/net/drivers/efi/efinet.c | 8 +- grub-core/net/drivers/efi/efinet.c | 8 +-
grub-core/net/drivers/emu/emunet.c | 1 + grub-core/net/drivers/emu/emunet.c | 1 +
grub-core/net/drivers/i386/pc/pxe.c | 13 +-- grub-core/net/drivers/i386/pc/pxe.c | 13 +--
grub-core/net/drivers/ieee1275/ofnet.c | 2 + grub-core/net/drivers/ieee1275/ofnet.c | 2 +
grub-core/net/drivers/uboot/ubootnet.c | 1 + 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/icmp6.c | 15 ++--
grub-core/net/ip.c | 4 +- grub-core/net/ip.c | 4 +-
grub-core/net/net.c | 50 ++++++----- grub-core/net/net.c | 50 ++++++-----
include/grub/net.h | 19 ++-- 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 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 --- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c +++ b/grub-core/net/arp.c
@@ -31,22 +31,12 @@ enum @@ -31,22 +31,12 @@ enum
@ -137,7 +137,7 @@ index 54306e3b16..67b409a8ac 100644
nbd = nb.data; nbd = nb.data;
send_ethernet_packet (inf, &nb, target_mac_addr, GRUB_NET_ETHERTYPE_ARP); 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_net_arp_receive (struct grub_net_buff *nb, struct grub_net_card *card,
grub_uint16_t *vlantag) grub_uint16_t *vlantag)
{ {
@ -177,33 +177,36 @@ index 54306e3b16..67b409a8ac 100644
+ +
+ /* The source protocol address. */ + /* The source protocol address. */
sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4; sender_addr.type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
+ grub_memcpy(&sender_addr.ipv4, tmp_ptr, pln); - 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)
- 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_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+ tmp_ptr += pln; + tmp_ptr += pln;
+ +
+ grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1); grub_net_link_layer_add_address (card, &sender_addr, &sender_mac_addr, 1);
+
+ /* The target hardware address. */ + /* The target hardware address. */
+ tmp_ptr += hln; + tmp_ptr += hln;
+ +
+ /* The target protocol address. */ + /* 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;
- if (arp_packet->sender_ip == pending_req)
+ grub_memcpy(&target_addr.ipv4, tmp_ptr, pln); + grub_memcpy(&target_addr.ipv4, tmp_ptr, pln);
+ +
+ if (sender_addr.ipv4 == pending_req) + 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);
-
FOR_NET_NETWORK_LEVEL_INTERFACES (inf) FOR_NET_NETWORK_LEVEL_INTERFACES (inf)
{ {
/* Verify vlantag id */ /* 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? */ /* Am I the protocol address target? */
if (grub_net_addr_cmp (&inf->address, &target_addr) == 0 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_uint8_t arp_data[128];
grub_err_t err; 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_clear (&nb_reply);
grub_netbuff_reserve (&nb_reply, 128); grub_netbuff_reserve (&nb_reply, 128);
@ -271,10 +274,10 @@ index 54306e3b16..67b409a8ac 100644
/* Change operation to REPLY and send packet */ /* Change operation to REPLY and send packet */
send_ethernet_packet (inf, &nb_reply, target, GRUB_NET_ETHERTYPE_ARP); 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 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 --- a/grub-core/net/bootp.c
+++ b/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) int is_def, char **device, char **path)
{ {
grub_net_network_level_address_t addr; grub_net_network_level_address_t addr;
@ -282,7 +285,7 @@ index e28fb6a09f..08b6b2b5d6 100644
struct grub_net_network_level_interface *inter; struct grub_net_network_level_interface *inter;
int mask = -1; int mask = -1;
char server_ip[sizeof ("xxx.xxx.xxx.xxx")]; 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) if (path)
*path = 0; *path = 0;
@ -297,7 +300,7 @@ index e28fb6a09f..08b6b2b5d6 100644
if (!inter) if (!inter)
return 0; 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)); grub_memset (pack, 0, sizeof (*pack));
pack->opcode = 1; pack->opcode = 1;
pack->hw_type = 1; pack->hw_type = 1;
@ -308,20 +311,20 @@ index e28fb6a09f..08b6b2b5d6 100644
err = grub_get_datetime (&date); err = grub_get_datetime (&date);
if (err || !grub_datetime2unixtime (&date, &t)) 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 else
pack->ident = iface->xid; pack->ident = iface->xid;
- grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6); - grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, 6);
+ grub_memcpy (&pack->mac_addr, &iface->hwaddress.mac, pack->hw_len); + 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 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/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? */ /* This should not happen... Why? */
continue; continue;
@ -329,12 +332,12 @@ index 173fb63153..a673bea807 100644
+ continue; + continue;
+ +
if (net->mode->state == GRUB_EFI_NETWORK_STOPPED if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
&& efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS) && net->start (net) != GRUB_EFI_SUCCESS)
continue; continue;
@@ -315,10 +318,11 @@ grub_efinet_findcards (void) @@ -332,10 +335,11 @@ grub_efinet_findcards (void)
card->name = grub_xasprintf ("efinet%d", i++); * such as LoadFile2 for initrd loading.
card->driver = &efidriver; */
card->flags = 0; card->flags = GRUB_NET_CARD_NO_CLOSE_ON_FINI_HW;
- card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; - card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+ card->default_address.type = net->mode->if_type; + card->default_address.type = net->mode->if_type;
+ card->default_address.len = net->mode->hwaddr_size; + card->default_address.len = net->mode->hwaddr_size;
@ -346,7 +349,7 @@ index 173fb63153..a673bea807 100644
card->efi_handle = *handle; card->efi_handle = *handle;
diff --git a/grub-core/net/drivers/emu/emunet.c b/grub-core/net/drivers/emu/emunet.c 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 --- a/grub-core/net/drivers/emu/emunet.c
+++ b/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 = @@ -46,6 +46,7 @@ static struct grub_net_card emucard =
@ -358,7 +361,7 @@ index b194920861..5b6c5e16a6 100644
}, },
.flags = 0 .flags = 0
diff --git a/grub-core/net/drivers/i386/pc/pxe.c b/grub-core/net/drivers/i386/pc/pxe.c 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 --- a/grub-core/net/drivers/i386/pc/pxe.c
+++ b/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) @@ -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; 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 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 --- a/grub-core/net/drivers/ieee1275/ofnet.c
+++ b/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, @@ -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; args = bootpath + grub_strlen (devpath) + 1;
do 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); grub_memcpy (&lla.mac, pprop, 6);
lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET; lla.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
@ -410,7 +413,7 @@ index 3860b6f78d..bcb3f9ea02 100644
card->txbufsize = ALIGN_UP (card->mtu, 64) + 256; 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 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 --- a/grub-core/net/drivers/uboot/ubootnet.c
+++ b/grub-core/net/drivers/uboot/ubootnet.c +++ b/grub-core/net/drivers/uboot/ubootnet.c
@@ -131,6 +131,7 @@ GRUB_MOD_INIT (ubootnet) @@ -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->txbufsize = ALIGN_UP (card->mtu, 64) + 256;
card->txbuf = grub_zalloc (card->txbufsize); card->txbuf = grub_zalloc (card->txbufsize);
diff --git a/grub-core/net/ethernet.c b/grub-core/net/ethernet.c 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 --- a/grub-core/net/ethernet.c
+++ b/grub-core/net/ethernet.c +++ b/grub-core/net/ethernet.c
@@ -29,13 +29,6 @@ @@ -29,13 +29,6 @@
@ -447,7 +450,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
+ grub_uint8_t *eth; + grub_uint8_t *eth;
grub_err_t err; grub_err_t err;
- grub_uint8_t etherhdr_size; - 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_uint32_t vlantag = 0;
+ grub_uint8_t hw_addr_len = inf->card->default_address.len; + grub_uint8_t hw_addr_len = inf->card->default_address.len;
+ grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2; + grub_uint8_t etherhdr_size = 2 * hw_addr_len + 2;
@ -487,7 +490,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
if (!inf->card->opened) if (!inf->card->opened)
{ {
err = GRUB_ERR_NONE; 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; inf->card->opened = 1;
} }
@ -499,14 +502,15 @@ index 4d7ceed6f9..9aae83a5eb 100644
- (char *) nb->data + etherhdr_size - 6, 2); - (char *) nb->data + etherhdr_size - 6, 2);
- -
- /* Add the tag in the middle */ - /* 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 - 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); 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, grub_net_recv_ethernet_packet (struct grub_net_buff *nb,
struct grub_net_card *card) 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 */ - /* 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 */ - /* longer than the original one. The vlantag id is extracted and the header */
- /* is reseted to the original size. */ - /* 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.type = card->default_address.type;
+ hwaddress.len = hw_addr_len; + hwaddress.len = hw_addr_len;
+ grub_memcpy (hwaddress.mac, eth, 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)); + type = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
+ if (type == VLANTAG_IDENTIFIER) + 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 */ + /* Skip vlan tag */
+ eth += 2; + eth += 2;
+ vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth)); + vlantag = grub_be_to_cpu16 (*(grub_uint16_t*)(eth));
@ -559,7 +563,7 @@ index 4d7ceed6f9..9aae83a5eb 100644
err = grub_netbuff_pull (nb, etherhdr_size); err = grub_netbuff_pull (nb, etherhdr_size);
if (err) if (err)
return 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. */ /* ARP packet. */
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c 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 --- a/grub-core/net/icmp6.c
+++ b/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, @@ -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) if (ohdr->type == OPTION_PREFIX && ohdr->len == 4)
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c 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 --- a/grub-core/net/ip.c
+++ b/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 if (inf->card == card
&& inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV && inf->address.type == GRUB_NET_NETWORK_LEVEL_PROTOCOL_DHCP_RECV
&& inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET && inf->hwaddress.type == GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
@ -627,7 +631,7 @@ index ea5edf8f1f..a5896f6dc2 100644
grub_net_process_dhcp (nb, inf); grub_net_process_dhcp (nb, inf);
grub_netbuff_free (nb); grub_netbuff_free (nb);
diff --git a/grub-core/net/net.c b/grub-core/net/net.c 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 --- a/grub-core/net/net.c
+++ b/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, @@ -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[0] = 0x33;
hw_addr->mac[1] = 0x33; hw_addr->mac[1] = 0x33;
hw_addr->mac[2] = ((grub_be_to_cpu64 (proto_addr->ipv6[1]) >> 24) & 0xff); 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 void
grub_net_hwaddr_to_str (const grub_net_link_level_address_t *addr, char *str) 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); - grub_printf (_("Unsupported hw address type %d\n"), addr->type);
} }
int void
@@ -789,13 +791,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a, @@ -813,13 +815,17 @@ grub_net_hwaddr_cmp (const grub_net_link_level_address_t *a,
return -1; return -1;
if (a->type > b->type) if (a->type > b->type)
return +1; return +1;
@ -713,7 +717,7 @@ index 22f2689aae..a46f82362e 100644
int int
diff --git a/include/grub/net.h b/include/grub/net.h 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 --- a/include/grub/net.h
+++ b/include/grub/net.h +++ b/include/grub/net.h
@@ -29,7 +29,8 @@ @@ -29,7 +29,8 @@
@ -728,7 +732,7 @@ index 8a05ec4fe7..af0404db7e 100644
GRUB_NET_OUR_IPV4_HEADER_SIZE = 20, GRUB_NET_OUR_IPV4_HEADER_SIZE = 20,
@@ -42,15 +43,17 @@ enum @@ -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 - GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET
+ /* IANA ARP constant to define hardware type. */ + /* IANA ARP constant to define hardware type. */
@ -746,7 +750,7 @@ index 8a05ec4fe7..af0404db7e 100644
}; };
} grub_net_link_level_address_t; } 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") #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:"\
+ "XX:XX:XX:XX:XX:XX:XX:XX")) + "XX:XX:XX:XX:XX:XX:XX:XX"))
void /* Max VLAN id = 4094 */
grub_net_addr_to_str (const grub_net_network_level_address_t *target, #define GRUB_NET_MAX_STR_VLAN_LEN (sizeof ("vlanXXXX"))

@ -15,12 +15,12 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 46 insertions(+), 27 deletions(-) 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 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/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 (); grub_print_error ();
if (device && path) if (inter && device && path)
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path); grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
+ if (grub_errno) + if (grub_errno)
+ grub_print_error (); + grub_print_error ();
@ -28,10 +28,10 @@ index 8e25680db0..014e5bf980 100644
else else
{ {
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h 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 --- a/include/grub/efi/api.h
+++ b/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_dhcpv6_packet_t dhcpv6;
} grub_efi_pxe_packet_t; } grub_efi_pxe_packet_t;
@ -63,7 +63,7 @@ index 7614b58dca..91ab528e4d 100644
typedef struct grub_efi_pxe_icmp_error typedef struct grub_efi_pxe_icmp_error
{ {
grub_efi_uint8_t type; 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_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t; } grub_efi_pxe_tftp_error_t;
@ -112,7 +112,7 @@ index 7614b58dca..91ab528e4d 100644
typedef struct grub_efi_pxe_mode typedef struct grub_efi_pxe_mode
{ {
grub_efi_boolean_t started; 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_packet_t pxe_bis_reply;
grub_efi_pxe_ip_filter_t ip_filter; grub_efi_pxe_ip_filter_t ip_filter;
grub_efi_uint32_t arp_cache_entries; grub_efi_uint32_t arp_cache_entries;

@ -12,10 +12,10 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
1 file changed, 17 insertions(+) 1 file changed, 17 insertions(+)
diff --git a/docs/grub.texi b/docs/grub.texi diff --git a/docs/grub.texi b/docs/grub.texi
index 0615d0ed97..04ed6ac1f0 100644 index c30701b4e1f..44c4e665a0d 100644
--- a/docs/grub.texi --- a/docs/grub.texi
+++ b/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_dns:: Add a DNS server
* net_add_route:: Add routing entry * net_add_route:: Add routing entry
* net_bootp:: Perform a bootp/DHCP autoconfiguration * 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_addr:: Remove IP address from interface
* net_del_dns:: Remove a DNS server * net_del_dns:: Remove a DNS server
* net_del_route:: Remove a route entry * 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 @end deffn

@ -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);

@ -22,7 +22,7 @@ Signed-off-by: Ken Lin <ken.lin@hpe.com>
2 files changed, 56 insertions(+) 2 files changed, 56 insertions(+)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c 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 --- a/grub-core/net/bootp.c
+++ b/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c
@@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
@ -33,7 +33,7 @@ index fe93b80f1c..8fb8918ae7 100644
#include <grub/net/ip.h> #include <grub/net/ip.h>
#include <grub/net/netbuff.h> #include <grub/net/netbuff.h>
#include <grub/net/udp.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) if (opt && opt_len)
grub_env_set_net_property (name, "rootpath", (const char *) 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) if (opt && opt_len)
grub_env_set_net_property (name, "extensionspath", (const char *) 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 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 --- a/include/grub/net.h
+++ b/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_MESSAGE_TYPE = 53,
GRUB_NET_DHCP_SERVER_IDENTIFIER = 54, GRUB_NET_DHCP_SERVER_IDENTIFIER = 54,
GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55, GRUB_NET_DHCP_PARAMETER_REQUEST_LIST = 55,

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

@ -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,

@ -27,12 +27,12 @@ the same way it used to be.
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.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 ++ 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 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
@ -43,7 +43,7 @@ index 014e5bf980..8171ecaa5e 100644
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
@@ -331,6 +332,227 @@ grub_efinet_findcards (void) @@ -348,6 +349,227 @@ grub_efinet_findcards (void)
grub_free (handles); grub_free (handles);
} }
@ -271,7 +271,7 @@ index 014e5bf980..8171ecaa5e 100644
static void static void
grub_efi_net_config_real (grub_efi_handle_t hnd, char **device, grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path) 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; grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe; struct grub_efi_pxe *pxe;
@ -284,7 +284,7 @@ index 014e5bf980..8171ecaa5e 100644
if (card->driver != &efidriver) if (card->driver != &efidriver)
continue; 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 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_IPV4_DEVICE_PATH_SUBTYPE
@ -307,7 +307,7 @@ index 014e5bf980..8171ecaa5e 100644
dup_ldp = grub_efi_find_last_device_path (dup_dp); dup_ldp = grub_efi_find_last_device_path (dup_dp);
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; 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, pxe = grub_efi_open_protocol (hnd, &pxe_io_guid,
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL); 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 ? "yes" : "no",
+ pxe_mode->dhcp_ack_received ? "" : " cannot continue"); + pxe_mode->dhcp_ack_received ? "" : " cannot continue");
grub_net_configure_by_dhcpv6_reply (card->name, card, 0, inter = grub_net_configure_by_dhcpv6_reply (card->name, card, 0,
(struct grub_net_dhcp6_packet *) (struct grub_net_dhcp6_packet *)
- &pxe_mode->dhcp_ack, - &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack), - sizeof (pxe_mode->dhcp_ack),
+ packet_buf, + packet_buf,
+ packet_bufsz, + packet_bufsz,
1, device, path); 1, device, path);
if (grub_errno) if (grub_errno)
grub_print_error (); 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_dprintf ("efinet", "using ipv4 and dhcp\n");
grub_net_configure_by_dhcp_ack (card->name, card, 0, inter = grub_net_configure_by_dhcp_ack (card->name, card, 0,
(struct grub_net_bootp_packet *) (struct grub_net_bootp_packet *)
- &pxe_mode->dhcp_ack, - &pxe_mode->dhcp_ack,
- sizeof (pxe_mode->dhcp_ack), - sizeof (pxe_mode->dhcp_ack),
+ packet_buf, + packet_buf,
+ packet_bufsz, + packet_bufsz,
1, device, path); 1, device, path);
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *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) + if (nb)
+ grub_netbuff_free (nb); + grub_netbuff_free (nb);
+ +
return; + return;
} }
} }
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h 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 --- a/include/grub/efi/api.h
+++ b/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 remote_port;
grub_efi_uint16_t protocol; grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address; grub_efi_uint8_t static_ip_address;
@ -387,9 +394,9 @@ index 91ab528e4d..4a51667adb 100644
} GRUB_PACKED; } GRUB_PACKED;
typedef struct grub_efi_ipv4_device_path grub_efi_ipv4_device_path_t; 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; } 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 +#define GRUB_EFI_URI_DEVICE_PATH_SUBTYPE 24
+ +

@ -29,34 +29,34 @@ Signed-off-by: Michael Chang <mchang@suse.com>
Signed-off-by: Ken Lin <ken.lin@hpe.com> Signed-off-by: Ken Lin <ken.lin@hpe.com>
--- ---
grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++ grub-core/net/drivers/efi/efinet.c | 163 +++++++++++++++++++++++++++++++++++++
include/grub/efi/api.h | 75 +++++++++++++++++ include/grub/efi/api.h | 76 +++++++++++++++++
2 files changed, 238 insertions(+) 2 files changed, 239 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c
@@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -33,6 +33,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
/* GUID. */ /* GUID. */
static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID; static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; static grub_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_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 ip6_config_guid = GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID;
static grub_err_t static grub_err_t
send_card_buffer (struct grub_net_card *dev, 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); grub_free (handles);
} }
+static grub_efi_handle_t +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_device_path_t **r_device_path)
+{ +{
+ grub_efi_handle_t handle; + grub_efi_handle_t handle;
+ grub_efi_status_t status; + 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); + protocol, &device_path, &handle);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
@ -92,9 +92,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs) + if (!addrs)
+ return 0; + return 0;
+ +
+ status = efi_call_4 (conf->get_data, conf, + status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs); + &data_size, addrs);
+ +
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL) + if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ { + {
@ -103,9 +103,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs) + if (!addrs)
+ return 0; + return 0;
+ +
+ status = efi_call_4 (conf->get_data, conf, + status = conf->get_data(conf,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ &data_size, addrs); + &data_size, addrs);
+ } + }
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
@ -142,9 +142,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs) + if (!addrs)
+ return 0; + return 0;
+ +
+ status = efi_call_4 (conf->get_data, conf, + status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs); + &data_size, addrs);
+ +
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL) + if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ { + {
@ -153,9 +153,9 @@ index 8171ecaa5e..715a6168d7 100644
+ if (!addrs) + if (!addrs)
+ return 0; + return 0;
+ +
+ status = efi_call_4 (conf->get_data, conf, + status = conf->get_data(conf,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ &data_size, addrs); + &data_size, addrs);
+ } + }
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
@ -171,7 +171,7 @@ index 8171ecaa5e..715a6168d7 100644
static struct grub_net_buff * static struct grub_net_buff *
grub_efinet_create_dhcp_ack_from_device_path (grub_efi_device_path_t *dp, int *use_ipv6) 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; grub_efi_ipv4_device_path_t *ipv4 = (grub_efi_ipv4_device_path_t *) ldp;
struct grub_net_bootp_packet *bp; struct grub_net_bootp_packet *bp;
grub_uint8_t *ptr; grub_uint8_t *ptr;
@ -180,7 +180,7 @@ index 8171ecaa5e..715a6168d7 100644
bp = (struct grub_net_bootp_packet *) nb->tail; bp = (struct grub_net_bootp_packet *) nb->tail;
err = grub_netbuff_put (nb, sizeof (*bp) + 4); 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; *ptr++ = sizeof ("HTTPClient") - 1;
grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1); grub_memcpy (ptr, "HTTPClient", sizeof ("HTTPClient") - 1);
@ -206,7 +206,7 @@ index 8171ecaa5e..715a6168d7 100644
ptr = nb->tail; ptr = nb->tail;
err = grub_netbuff_put (nb, 1); err = grub_netbuff_put (nb, 1);
if (err) 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 *opt;
struct grub_net_dhcp6_option_iana *iana; struct grub_net_dhcp6_option_iana *iana;
struct grub_net_dhcp6_option_iaaddr *iaaddr; struct grub_net_dhcp6_option_iaaddr *iaaddr;
@ -215,7 +215,7 @@ index 8171ecaa5e..715a6168d7 100644
d6p = (struct grub_net_dhcp6_packet *)nb->tail; d6p = (struct grub_net_dhcp6_packet *)nb->tail;
err = grub_netbuff_put (nb, sizeof(*d6p)); 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); opt->len = grub_cpu_to_be16 (uri_len);
grub_memcpy (opt->data, uri_dp->uri, 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 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 --- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h +++ b/include/grub/efi/api.h
@@ -352,6 +352,15 @@ @@ -369,6 +369,16 @@
#define GRUB_EFI_RNG_PROTOCOL_GUID \
{ 0x3152bca5, 0xeade, 0x433d, \
{ 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \ { 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 } \
+ }
+#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \ +#define GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID \
+ { 0x5b446ed1, 0xe30b, 0x4faa, \ + { 0x5b446ed1, 0xe30b, 0x4faa, \
+ { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ + { 0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \
@ -258,12 +257,14 @@ index 4a51667adb..0b490195ad 100644
+#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \ +#define GRUB_EFI_IP6_CONFIG_PROTOCOL_GUID \
+ { 0x937fe521, 0x95ae, 0x4d1a, \ + { 0x937fe521, 0x95ae, 0x4d1a, \
+ { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \ + { 0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } \
} + }
+
struct grub_efi_sal_system_table #define LINUX_EFI_INITRD_MEDIA_GUID \
@@ -1883,6 +1892,72 @@ struct grub_efi_rng_protocol { 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 { +enum grub_efi_ip4_config2_data_type {
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, + 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; +typedef struct grub_efi_ip6_config_protocol grub_efi_ip6_config_protocol_t;
+ +
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ struct initrd_media_device_path {
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ grub_efi_vendor_media_device_path_t vendor;
|| defined(__riscv) grub_efi_device_path_t end;

@ -33,18 +33,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/net/drivers/efi/efinet.c | 27 + grub-core/net/drivers/efi/efinet.c | 27 +
grub-core/net/efi/dhcp.c | 397 ++++++++++ grub-core/net/efi/dhcp.c | 397 ++++++++++
grub-core/net/efi/efi_netfs.c | 57 ++ 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/ip4_config.c | 398 ++++++++++
grub-core/net/efi/ip6_config.c | 422 +++++++++++ grub-core/net/efi/ip6_config.c | 422 +++++++++++
grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++ grub-core/net/efi/net.c | 1428 ++++++++++++++++++++++++++++++++++++
grub-core/net/efi/pxe.c | 424 +++++++++++ grub-core/net/efi/pxe.c | 424 +++++++++++
grub-core/net/net.c | 74 ++ grub-core/net/net.c | 74 ++
util/grub-mknetdir.c | 23 +- 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/dhcp.h | 343 +++++++++
include/grub/efi/http.h | 215 ++++++ include/grub/efi/http.h | 215 ++++++
include/grub/net/efi.h | 144 ++++ 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/dhcp.c
create mode 100644 grub-core/net/efi/efi_netfs.c create mode 100644 grub-core/net/efi/efi_netfs.c
create mode 100644 grub-core/net/efi/http.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 create mode 100644 include/grub/net/efi.h
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def 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 --- a/grub-core/Makefile.core.def
+++ b/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; common = hook/datehook.c;
}; };
@ -73,7 +73,7 @@ index 52ec0fafcd..12797336c9 100644
module = { module = {
name = net; name = net;
common = net/net.c; common = net/net.c;
@@ -2313,6 +2319,12 @@ module = { @@ -2369,6 +2375,12 @@ module = {
common = net/ethernet.c; common = net/ethernet.c;
common = net/arp.c; common = net/arp.c;
common = net/netbuff.c; common = net/netbuff.c;
@ -87,7 +87,7 @@ index 52ec0fafcd..12797336c9 100644
module = { module = {
diff --git a/grub-core/io/bufio.c b/grub-core/io/bufio.c 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 --- a/grub-core/io/bufio.c
+++ b/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) @@ -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) if (file->offset + res < next_buf)
{ {
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c 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 --- a/grub-core/kern/efi/efi.c
+++ b/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 *ipv4
= (grub_efi_ipv4_device_path_t *) dp; = (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[0],
(unsigned) ipv4->local_ip_address[1], (unsigned) ipv4->local_ip_address[1],
(unsigned) ipv4->local_ip_address[2], (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->remote_port,
(unsigned) ipv4->protocol, (unsigned) ipv4->protocol,
(unsigned) ipv4->static_ip_address); (unsigned) ipv4->static_ip_address);
@ -190,7 +190,7 @@ index d6a2fb5778..2a446f5031 100644
} }
break; break;
case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE: 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", dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp); (grub_efi_vendor_device_path_t *) dp);
break; break;
@ -231,7 +231,7 @@ index d6a2fb5778..2a446f5031 100644
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype); grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
break; break;
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c 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 --- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
@ -242,7 +242,7 @@ index 715a6168d7..e11d759f19 100644
GRUB_MOD_LICENSE ("GPLv3+"); 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); 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 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_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_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 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_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_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)) && GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_URI_DEVICE_PATH_SUBTYPE))
continue; continue;
dup_dp = grub_efi_duplicate_device_path (dp); 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); 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 = grub_efi_find_last_device_path (dup_dp);
dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; 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) GRUB_MOD_INIT(efinet)
{ {
@ -294,8 +294,8 @@ index 715a6168d7..e11d759f19 100644
grub_efinet_findcards (); grub_efinet_findcards ();
grub_efi_net_config = grub_efi_net_config_real; grub_efi_net_config = grub_efi_net_config_real;
} }
@@ -856,5 +881,7 @@ GRUB_MOD_FINI(efinet) @@ -900,5 +925,7 @@ GRUB_MOD_FINI(efinet)
FOR_NET_CARDS_SAFE (card, next) FOR_NET_CARDS_SAFE (card, next)
if (card->driver == &efidriver) if (card->driver == &efidriver)
grub_net_card_unregister (card); 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 diff --git a/grub-core/net/efi/dhcp.c b/grub-core/net/efi/dhcp.c
new file mode 100644 new file mode 100644
index 0000000000..dbef63d8c0 index 00000000000..ca19902441b
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/dhcp.c +++ b/grub-core/net/efi/dhcp.c
@@ -0,0 +1,397 @@ @@ -0,0 +1,397 @@
@ -385,7 +385,7 @@ index 0000000000..dbef63d8c0
+ grub_efi_uint32_t option_count = 0; + grub_efi_uint32_t option_count = 0;
+ grub_efi_uint32_t i; + 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) + if (status != GRUB_EFI_BUFFER_TOO_SMALL)
+ return NULL; + return NULL;
@ -394,7 +394,7 @@ index 0000000000..dbef63d8c0
+ if (!option_list) + if (!option_list)
+ return NULL; + 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) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_free (option_list); + grub_free (option_list);
@ -443,13 +443,13 @@ index 0000000000..dbef63d8c0
+ +
+ if (!mode->started) + if (!mode->started)
+ { + {
+ status = efi_call_2 (pxe->start, pxe, 0); + status = pxe->start(pxe, 0);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n"); + 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) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp4 configure failed, %d\n", (int)status); + grub_printf ("dhcp4 configure failed, %d\n", (int)status);
@ -500,7 +500,7 @@ index 0000000000..dbef63d8c0
+ config.option_list = &options; + config.option_list = &options;
+ +
+ /* FIXME: What if the dhcp has bounded */ + /* 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); + grub_free (options);
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
@ -508,14 +508,14 @@ index 0000000000..dbef63d8c0
+ continue; + continue;
+ } + }
+ +
+ status = efi_call_2 (netdev->dhcp4->start, netdev->dhcp4, NULL); + status = netdev->dhcp4->start(netdev->dhcp4, NULL);
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp4 start failed, %d\n", (int)status); + grub_printf ("dhcp4 start failed, %d\n", (int)status);
+ continue; + 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) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status); + grub_printf ("dhcp4 get mode failed, %d\n", (int)status);
@ -616,21 +616,21 @@ index 0000000000..dbef63d8c0
+ config.rapid_commit = 0; + config.rapid_commit = 0;
+ config.solicit_retransmission = &retrans; + config.solicit_retransmission = &retrans;
+ +
+ status = efi_call_2 (dev->dhcp6->configure, dev->dhcp6, &config); + status = dev->dhcp6->configure(dev->dhcp6, &config);
+ grub_free (opt); + grub_free (opt);
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp6 configure failed, %d\n", (int)status); + grub_printf ("dhcp6 configure failed, %d\n", (int)status);
+ continue; + continue;
+ } + }
+ status = efi_call_1 (dev->dhcp6->start, dev->dhcp6); + status = dev->dhcp6->start(dev->dhcp6);
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp6 start failed, %d\n", (int)status); + grub_printf ("dhcp6 start failed, %d\n", (int)status);
+ continue; + 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) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_printf ("dhcp4 get mode failed, %d\n", (int)status); + 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_dhcp6_packet_option_t **options = NULL;
+ grub_efi_uint32_t i; + 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) + if (status == GRUB_EFI_BUFFER_TOO_SMALL && count)
+ { + {
+ options = grub_malloc (count * sizeof(*options)); + 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) + if (status != GRUB_EFI_SUCCESS)
@ -696,8 +696,8 @@ index 0000000000..dbef63d8c0
+ grub_free (options); + grub_free (options);
+ } + }
+ +
+ efi_call_1 (b->free_pool, mode.client_id); + b->free_pool(mode.client_id);
+ efi_call_1 (b->free_pool, mode.ia); + b->free_pool(mode.ia);
+ } + }
+ +
+ return GRUB_ERR_NONE; + return GRUB_ERR_NONE;
@ -707,7 +707,7 @@ index 0000000000..dbef63d8c0
+grub_command_func_t grub_efi_net_bootp6 = grub_cmd_efi_bootp6; +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 diff --git a/grub-core/net/efi/efi_netfs.c b/grub-core/net/efi/efi_netfs.c
new file mode 100644 new file mode 100644
index 0000000000..ef371d885e index 00000000000..ef371d885ea
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/efi_netfs.c +++ b/grub-core/net/efi/efi_netfs.c
@@ -0,0 +1,57 @@ @@ -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 diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
new file mode 100644 new file mode 100644
index 0000000000..3f61fd2fa5 index 00000000000..de28badccb0
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c
@@ -0,0 +1,419 @@ @@ -0,0 +1,410 @@
+ +
+#include <grub/efi/api.h> +#include <grub/efi/api.h>
+#include <grub/efi/efi.h> +#include <grub/efi/efi.h>
@ -802,9 +802,9 @@ index 0000000000..3f61fd2fa5
+ +
+ http_config.local_address_is_ipv6 = 1; + http_config.local_address_is_ipv6 = 1;
+ sz = sizeof (manual_address); + sz = sizeof (manual_address);
+ status = efi_call_4 (dev->ip6_config->get_data, dev->ip6_config, + status = dev->ip6_config->get_data(dev->ip6_config,
+ GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, &manual_address); + &sz, &manual_address);
+ +
+ if (status == GRUB_EFI_NOT_FOUND) + if (status == GRUB_EFI_NOT_FOUND)
+ { + {
@ -834,19 +834,19 @@ index 0000000000..3f61fd2fa5
+ http_config.access_point.ipv4_node = &httpv4_node; + 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) + if (status == GRUB_EFI_ALREADY_STARTED)
+ { + {
+ /* XXX: This hangs HTTPS boot */ + /* XXX: This hangs HTTPS boot */
+#if 0 +#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_error (GRUB_ERR_IO, N_("couldn't reset http instance"));
+ grub_print_error (); + grub_print_error ();
+ return; + return;
+ } + }
+ status = efi_call_2 (http->configure, http, &http_config); + status = http->configure(http, &http_config);
+#endif +#endif
+ return; + return;
+ } + }
@ -945,12 +945,9 @@ index 0000000000..3f61fd2fa5
+ request_token.message = &request_message; + request_token.message = &request_message;
+ +
+ request_callback_done = 0; + request_callback_done = 0;
+ status = efi_call_5 (b->create_event, + status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL, + grub_efi_http_request_callback, NULL,
+ GRUB_EFI_TPL_CALLBACK, + &request_token.event);
+ grub_efi_http_request_callback,
+ NULL,
+ &request_token.event);
+ +
+ if (status != GRUB_EFI_SUCCESS) + 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); + 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) + 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); + grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status); + return grub_error (GRUB_ERR_IO, "Fail to send a request! status=0x%x\n", status);
+ } + }
+ /* TODO: Add Timeout */ + /* TODO: Add Timeout */
+ while (!request_callback_done) + while (!request_callback_done)
+ efi_call_1(http->poll, http); + http->poll(http);
+ +
+ response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS; + response_data.status_code = GRUB_EFI_HTTP_STATUS_UNSUPPORTED_STATUS;
+ response_message.data.response = &response_data; + response_message.data.response = &response_data;
@ -981,16 +978,13 @@ index 0000000000..3f61fd2fa5
+ response_message.body = NULL; + response_message.body = NULL;
+ response_token.event = NULL; + response_token.event = NULL;
+ +
+ status = efi_call_5 (b->create_event, + status = b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL, + grub_efi_http_response_callback, NULL,
+ GRUB_EFI_TPL_CALLBACK, + &response_token.event);
+ grub_efi_http_response_callback,
+ NULL,
+ &response_token.event);
+ +
+ if (status != GRUB_EFI_SUCCESS) + 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); + grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to create an event! status=0x%x\n", status); + 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 */ + /* wait for HTTP response */
+ response_callback_done = 0; + response_callback_done = 0;
+ status = efi_call_2 (http->response, http, &response_token); + status = http->response(http, &response_token);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ efi_call_1 (b->close_event, response_token.event); + b->close_event(response_token.event);
+ efi_call_1 (b->close_event, request_token.event); + b->close_event(request_token.event);
+ grub_free (request_data.url); + grub_free (request_data.url);
+ return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status); + return grub_error (GRUB_ERR_IO, "Fail to receive a response! status=%d\n", (int)status);
+ } + }
+ +
+ /* TODO: Add Timeout */ + /* TODO: Add Timeout */
+ while (!response_callback_done) + 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) + 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; + grub_efi_http_status_code_t status_code = response_message.data.response->status_code;
+ +
+ if (response_message.headers) + if (response_message.headers)
+ efi_call_1 (b->free_pool, response_message.headers); + b->free_pool(response_message.headers);
+ efi_call_1 (b->close_event, response_token.event); + b->close_event(response_token.event);
+ efi_call_1 (b->close_event, request_token.event); + b->close_event(request_token.event);
+ grub_free (request_data.url); + grub_free (request_data.url);
+ if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND) + if (status_code == GRUB_EFI_HTTP_STATUS_404_NOT_FOUND)
+ { + {
@ -1049,9 +1043,9 @@ index 0000000000..3f61fd2fa5
+ } + }
+ +
+ if (response_message.headers) + if (response_message.headers)
+ efi_call_1 (b->free_pool, response_message.headers); + b->free_pool(response_message.headers);
+ efi_call_1 (b->close_event, response_token.event); + b->close_event(response_token.event);
+ efi_call_1 (b->close_event, request_token.event); + b->close_event(request_token.event);
+ grub_free (request_data.url); + grub_free (request_data.url);
+ +
+ return GRUB_ERR_NONE; + return GRUB_ERR_NONE;
@ -1076,12 +1070,9 @@ index 0000000000..3f61fd2fa5
+ return -1; + return -1;
+ } + }
+ +
+ efi_call_5 (b->create_event, + b->create_event(GRUB_EFI_EVT_NOTIFY_SIGNAL, GRUB_EFI_TPL_CALLBACK,
+ GRUB_EFI_EVT_NOTIFY_SIGNAL, + grub_efi_http_response_callback, NULL,
+ GRUB_EFI_TPL_CALLBACK, + &response_token.event);
+ grub_efi_http_response_callback,
+ NULL,
+ &response_token.event);
+ +
+ while (len) + while (len)
+ { + {
@ -1096,23 +1087,23 @@ index 0000000000..3f61fd2fa5
+ +
+ response_callback_done = 0; + response_callback_done = 0;
+ +
+ status = efi_call_2 (http->response, http, &response_token); + status = http->response(http, &response_token);
+ if (status != GRUB_EFI_SUCCESS) + 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); + grub_error (GRUB_ERR_IO, "Error! status=%d\n", (int)status);
+ return -1; + return -1;
+ } + }
+ +
+ while (!response_callback_done) + while (!response_callback_done)
+ efi_call_1(http->poll, http); + http->poll(http);
+ +
+ sum += response_message.body_length; + sum += response_message.body_length;
+ buf += response_message.body_length; + buf += response_message.body_length;
+ len -= 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; + 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 diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
new file mode 100644 new file mode 100644
index 0000000000..b711a5d945 index 00000000000..1deba25e79e
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/ip4_config.c +++ b/grub-core/net/efi/ip4_config.c
@@ -0,0 +1,398 @@ @@ -0,0 +1,398 @@
@ -1305,17 +1296,17 @@ index 0000000000..b711a5d945
+ if (!interface_info) + if (!interface_info)
+ return NULL; + 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_INTERFACEINFO, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info); + &sz, interface_info);
+ +
+ if (status == GRUB_EFI_BUFFER_TOO_SMALL) + if (status == GRUB_EFI_BUFFER_TOO_SMALL)
+ { + {
+ grub_free (interface_info); + grub_free (interface_info);
+ interface_info = grub_malloc (sz); + interface_info = grub_malloc (sz);
+ status = efi_call_4 (ip4_config->get_data, ip4_config, + status = ip4_config->get_data(ip4_config,
+ GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info); + &sz, interface_info);
+ } + }
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
@ -1339,9 +1330,9 @@ index 0000000000..b711a5d945
+ if (!manual_address) + if (!manual_address)
+ return NULL; + 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, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address); + &sz, manual_address);
+ +
+ if (status != GRUB_EFI_SUCCESS) + 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, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address); + sizeof(*address), address);
+ +
@ -1562,9 +1553,9 @@ index 0000000000..b711a5d945
+{ +{
+ grub_efi_status_t status; + grub_efi_status_t status;
+ +
+ 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_GATEWAY, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_GATEWAY,
+ sizeof (address->ip4), &address->ip4); + sizeof (address->ip4), &address->ip4);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ return 0; + return 0;
@ -1578,9 +1569,9 @@ index 0000000000..b711a5d945
+{ +{
+ grub_efi_status_t status; + grub_efi_status_t status;
+ +
+ 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_DNSSERVER, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip4), &address->ip4); + sizeof (address->ip4), &address->ip4);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ return 0; + 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 diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
new file mode 100644 new file mode 100644
index 0000000000..017c4d05bc index 00000000000..29a03973265
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/ip6_config.c +++ b/grub-core/net/efi/ip6_config.c
@@ -0,0 +1,422 @@ @@ -0,0 +1,422 @@
@ -1729,7 +1720,7 @@ index 0000000000..017c4d05bc
+ sz = sizeof (*interface_info) + sizeof (*interface_info->route_table); + sz = sizeof (*interface_info) + sizeof (*interface_info->route_table);
+ interface_info = grub_malloc (sz); + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info); + &sz, interface_info);
+ +
@ -1737,7 +1728,7 @@ index 0000000000..017c4d05bc
+ { + {
+ grub_free (interface_info); + grub_free (interface_info);
+ interface_info = grub_malloc (sz); + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
+ &sz, interface_info); + &sz, interface_info);
+ } + }
@ -1763,7 +1754,7 @@ index 0000000000..017c4d05bc
+ if (!manual_address) + if (!manual_address)
+ return NULL; + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ sizeof(*address), address); + sizeof(*address), address);
+ +
@ -1990,7 +1981,7 @@ index 0000000000..017c4d05bc
+{ +{
+ grub_efi_status_t status; + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_GATEWAY,
+ sizeof (address->ip6), &address->ip6); + sizeof (address->ip6), &address->ip6);
+ +
@ -2006,7 +1997,7 @@ index 0000000000..017c4d05bc
+ +
+ grub_efi_status_t status; + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_DNSSERVER,
+ sizeof (address->ip6), &address->ip6); + 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 diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
new file mode 100644 new file mode 100644
index 0000000000..86bce6535d index 00000000000..1a19ee27144
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c
@@ -0,0 +1,1428 @@ @@ -0,0 +1,1428 @@
@ -2050,15 +2041,15 @@ index 0000000000..86bce6535d
+ +
+#define GRUB_EFI_IP6_PREFIX_LENGTH 64 +#define GRUB_EFI_IP6_PREFIX_LENGTH 64
+ +
+static grub_efi_guid_t ip4_config_guid = GRUB_EFI_IP4_CONFIG2_PROTOCOL_GUID; +static grub_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 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_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_guid_t http_guid = GRUB_EFI_HTTP_PROTOCOL_GUID;
+static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID; +static grub_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_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_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_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 dhcp6_guid = GRUB_EFI_DHCP6_PROTOCOL_GUID;
+ +
+struct grub_efi_net_device *net_devices; +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__) +#define efi_net_interface(m,...) efi_net_interface_ ## m (net_interface, ## __VA_ARGS__)
+ +
+static grub_efi_handle_t +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_device_path_t **r_device_path)
+{ +{
+ grub_efi_handle_t handle; + grub_efi_handle_t handle;
+ grub_efi_status_t status; + 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); + protocol, &device_path, &handle);
+ +
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
@ -2721,7 +2712,7 @@ index 0000000000..86bce6535d
+} +}
+ +
+static grub_efi_handle_t +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_service_binding_t *service;
+ grub_efi_status_t status; + grub_efi_status_t status;
@ -2734,7 +2725,7 @@ index 0000000000..86bce6535d
+ return NULL; + return NULL;
+ } + }
+ +
+ status = efi_call_2 (service->create_child, service, &child_dev); + status = service->create_child(service, &child_dev);
+ if (status != GRUB_EFI_SUCCESS) + if (status != GRUB_EFI_SUCCESS)
+ { + {
+ grub_error (GRUB_ERR_IO, N_("Failed to create child device of http service %x"), status); + 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; + 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, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_POLICY,
+ sizeof (ip4_policy), &ip4_policy) != GRUB_EFI_SUCCESS) + 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); + 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; + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_POLICY,
+ sizeof (ip6_policy), &ip6_policy) != GRUB_EFI_SUCCESS) + 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); + 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 diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
new file mode 100644 new file mode 100644
index 0000000000..531949cba5 index 00000000000..b84f86ea470
--- /dev/null --- /dev/null
+++ b/grub-core/net/efi/pxe.c +++ b/grub-core/net/efi/pxe.c
@@ -0,0 +1,424 @@ @@ -0,0 +1,424 @@
@ -3484,7 +3475,7 @@ index 0000000000..531949cba5
+ if (!manual_address) + if (!manual_address)
+ return NULL; + 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, + GRUB_EFI_IP6_CONFIG_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address); + &sz, manual_address);
+ +
@ -3509,7 +3500,7 @@ index 0000000000..531949cba5
+ if (!manual_address) + if (!manual_address)
+ return NULL; + 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, + GRUB_EFI_IP4_CONFIG2_DATA_TYPE_MANUAL_ADDRESS,
+ &sz, manual_address); + &sz, manual_address);
+ +
@ -3532,7 +3523,7 @@ index 0000000000..531949cba5
+ if (!mode->started) + if (!mode->started)
+ { + {
+ grub_efi_status_t status; + 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) + if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't start PXE\n"); + grub_printf ("Couldn't start PXE\n");
@ -3555,7 +3546,7 @@ index 0000000000..531949cba5
+ grub_efi_pxe_ip_address_t station_ip; + grub_efi_pxe_ip_address_t station_ip;
+ +
+ grub_memcpy (station_ip.v6.addr, manual_address->address, sizeof (station_ip.v6.addr)); + 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) + if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't set station ip\n"); + 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 (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)); + 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) + if (status != GRUB_EFI_SUCCESS)
+ grub_printf ("Couldn't set station ip\n"); + 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); + server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ } + }
+ +
+ status = efi_call_10 (pxe->mtftp, + status = pxe->mtftp(
+ pxe, + pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, + GRUB_EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
+ NULL, + NULL,
@ -3816,7 +3807,7 @@ index 0000000000..531949cba5
+ server_ip.v4.addr[i] = grub_strtoul (p, &p, 10); + server_ip.v4.addr[i] = grub_strtoul (p, &p, 10);
+ } + }
+ +
+ status = efi_call_10 (pxe->mtftp, + status = pxe->mtftp(
+ pxe, + pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, + GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf, + buf,
@ -3847,7 +3838,7 @@ index 0000000000..531949cba5
+ return 0; + return 0;
+ } + }
+ +
+ status = efi_call_10 (pxe->mtftp, + status = pxe->mtftp(
+ pxe, + pxe,
+ GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE, + GRUB_EFI_PXE_BASE_CODE_TFTP_READ_FILE,
+ buf2, + buf2,
@ -3890,7 +3881,7 @@ index 0000000000..531949cba5
+ }; + };
+ +
diff --git a/grub-core/net/net.c b/grub-core/net/net.c 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 --- a/grub-core/net/net.c
+++ b/grub-core/net/net.c +++ b/grub-core/net/net.c
@@ -32,6 +32,9 @@ @@ -32,6 +32,9 @@
@ -3903,8 +3894,8 @@ index 0ce5e675ed..55aed92722 100644
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
@@ -2033,8 +2036,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute; @@ -2092,8 +2095,49 @@ static grub_command_t cmd_addaddr, cmd_deladdr, cmd_addroute, cmd_delroute;
static grub_command_t cmd_lsroutes, cmd_lscards; static grub_command_t cmd_setvlan, cmd_lsroutes, cmd_lscards;
static grub_command_t cmd_lsaddr, cmd_slaac; static grub_command_t cmd_lsaddr, cmd_slaac;
+#ifdef GRUB_MACHINE_EFI +#ifdef GRUB_MACHINE_EFI
@ -3953,7 +3944,7 @@ index 0ce5e675ed..55aed92722 100644
grub_register_variable_hook ("net_default_server", defserver_get_env, grub_register_variable_hook ("net_default_server", defserver_get_env,
defserver_set_env); defserver_set_env);
grub_env_export ("net_default_server"); 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_net_restore_hw,
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK); GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
grub_net_poll_cards_idle = grub_net_poll_cards_idle_real; 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 ("net_default_server", 0, 0);
grub_register_variable_hook ("pxe_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_net_fini_hw (0);
grub_loader_unregister_preboot_hook (fini_hnd); 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 +#ifdef GRUB_MACHINE_EFI
+ init_mode = INIT_MODE_NONE; + init_mode = INIT_MODE_NONE;
+#endif +#endif
} }
diff --git a/util/grub-mknetdir.c b/util/grub-mknetdir.c 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 --- a/util/grub-mknetdir.c
+++ b/util/grub-mknetdir.c +++ b/util/grub-mknetdir.c
@@ -32,13 +32,15 @@ @@ -32,13 +32,15 @@
@ -4055,7 +4046,7 @@ index a2461cda1c..77958dd9dd 100644
{ {
const char *mkimage_target; const char *mkimage_target;
const char *netmodule; 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); grub_install_push_module (targets[platform].netmodule);
output = grub_util_path_concat_ext (2, grubdir, "core", targets[platform].ext); 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, grub_install_make_image_wrap (input_dir, prefix, output,
0, load_cfg, 0, load_cfg,
targets[platform].mkimage_target, 0); 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); grub_install_mkdir_p (base);
@ -4082,10 +4073,10 @@ index a2461cda1c..77958dd9dd 100644
if (!grub_install_source_directory) if (!grub_install_source_directory)
{ {
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h 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 --- a/include/grub/efi/api.h
+++ b/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_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_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_ipv6_address_t v6;
+} grub_efi_pxe_ip_address_t; +} grub_efi_pxe_ip_address_t;
struct grub_efi_guid /* XXX although the spec does not specify the padding, this actually
{ must have the padding! */
@@ -889,6 +906,8 @@ struct grub_efi_ipv6_device_path @@ -917,6 +934,8 @@ struct grub_efi_ipv6_device_path
grub_efi_uint16_t remote_port; grub_efi_uint16_t remote_port;
grub_efi_uint16_t protocol; grub_efi_uint16_t protocol;
grub_efi_uint8_t static_ip_address; grub_efi_uint8_t static_ip_address;
@ -4118,7 +4109,7 @@ index 0b490195ad..f431f49973 100644
} GRUB_PACKED; } GRUB_PACKED;
typedef struct grub_efi_ipv6_device_path grub_efi_ipv6_device_path_t; 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; } GRUB_PACKED;
typedef struct grub_efi_uri_device_path grub_efi_uri_device_path_t; 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 #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
/* Media Device Path. */ /* 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; } GRUB_PACKED;
typedef struct grub_efi_bios_device_path grub_efi_bios_device_path_t; 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 struct grub_efi_open_protocol_information_entry
{ {
grub_efi_handle_t agent_handle; 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_char8_t error_string[127];
} grub_efi_pxe_tftp_error_t; } grub_efi_pxe_tftp_error_t;
@ -4200,18 +4191,27 @@ index 0b490195ad..f431f49973 100644
#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8 #define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
typedef struct grub_efi_pxe_ip_filter 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 typedef struct grub_efi_pxe
{ {
grub_uint64_t rev; 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); + grub_efi_status_t (*start) (struct grub_efi_pxe *this, grub_efi_boolean_t use_ipv6);
void (*stop) (void); + void (*stop) (void);
- void (*dhcp) (void);
+ grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this, + grub_efi_status_t (*dhcp) (struct grub_efi_pxe *this,
+ grub_efi_boolean_t sort_offers); + grub_efi_boolean_t sort_offers);
void (*discover) (void); + void (*discover) (void);
- void (*mftp) (void);
+ grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this, + grub_efi_status_t (*mtftp) (struct grub_efi_pxe *this,
+ grub_efi_pxe_base_code_tftp_opcode_t operation, + grub_efi_pxe_base_code_tftp_opcode_t operation,
+ void *buffer_ptr, + void *buffer_ptr,
@ -4223,20 +4223,19 @@ index 0b490195ad..f431f49973 100644
+ grub_efi_char8_t *filename, + grub_efi_char8_t *filename,
+ grub_efi_pxe_base_code_mtftp_info_t *info, + grub_efi_pxe_base_code_mtftp_info_t *info,
+ grub_efi_boolean_t dont_use_buffer); + grub_efi_boolean_t dont_use_buffer);
void (*udpwrite) (void); + void (*udpwrite) (void);
void (*udpread) (void); + void (*udpread) (void);
void (*setipfilter) (void); + void (*setipfilter) (void);
void (*arp) (void); + void (*arp) (void);
void (*setparams) (void); + void (*setparams) (void);
- void (*setstationip) (void);
+ grub_efi_status_t (*set_station_ip) (struct grub_efi_pxe *this, + 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_station_ip,
+ grub_efi_pxe_ip_address_t *new_subnet_mask); + grub_efi_pxe_ip_address_t *new_subnet_mask);
+ //void (*setstationip) (void); + void (*setpackets) (void);
void (*setpackets) (void);
struct grub_efi_pxe_mode *mode; struct grub_efi_pxe_mode *mode;
} grub_efi_pxe_t; } 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; 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 { enum grub_efi_ip6_config_data_type {
GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO, GRUB_EFI_IP6_CONFIG_DATA_TYPE_INTERFACEINFO,
GRUB_EFI_IP6_CONFIG_DATA_TYPE_ALT_INTERFACEID, 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; 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; +typedef struct grub_efi_ip6_config_manual_address grub_efi_ip6_config_manual_address_t;
+ +
#if (GRUB_TARGET_SIZEOF_VOID_P == 4) || defined (__ia64__) \ struct initrd_media_device_path {
|| defined (__aarch64__) || defined (__MINGW64__) || defined (__CYGWIN__) \ grub_efi_vendor_media_device_path_t vendor;
|| defined(__riscv) grub_efi_device_path_t end;
diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h diff --git a/include/grub/efi/dhcp.h b/include/grub/efi/dhcp.h
new file mode 100644 new file mode 100644
index 0000000000..fdb88eb810 index 00000000000..fdb88eb810e
--- /dev/null --- /dev/null
+++ b/include/grub/efi/dhcp.h +++ b/include/grub/efi/dhcp.h
@@ -0,0 +1,343 @@ @@ -0,0 +1,343 @@
@ -4682,7 +4681,7 @@ index 0000000000..fdb88eb810
+#endif /* ! GRUB_EFI_DHCP_HEADER */ +#endif /* ! GRUB_EFI_DHCP_HEADER */
diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h diff --git a/include/grub/efi/http.h b/include/grub/efi/http.h
new file mode 100644 new file mode 100644
index 0000000000..c5e9a89f50 index 00000000000..c5e9a89f505
--- /dev/null --- /dev/null
+++ b/include/grub/efi/http.h +++ b/include/grub/efi/http.h
@@ -0,0 +1,215 @@ @@ -0,0 +1,215 @@
@ -4903,7 +4902,7 @@ index 0000000000..c5e9a89f50
+#endif /* !GRUB_EFI_HTTP_HEADER */ +#endif /* !GRUB_EFI_HTTP_HEADER */
diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h diff --git a/include/grub/net/efi.h b/include/grub/net/efi.h
new file mode 100644 new file mode 100644
index 0000000000..de90d223e8 index 00000000000..de90d223e8e
--- /dev/null --- /dev/null
+++ b/include/grub/net/efi.h +++ b/include/grub/net/efi.h
@@ -0,0 +1,144 @@ @@ -0,0 +1,144 @@

@ -18,11 +18,11 @@ signed code is allowed to be executed.
Signed-off-by: Michael Chang <mchang@suse.com> Signed-off-by: Michael Chang <mchang@suse.com>
--- ---
grub-core/net/efi/net.c | 4 +++- grub-core/net/efi/net.c | 4 +++-
grub-core/net/http.c | 5 ++++- grub-core/net/http.c | 8 +++++++-
2 files changed, 7 insertions(+), 2 deletions(-) 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c 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 --- a/grub-core/net/efi/net.c
+++ b/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, @@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf,
@ -38,20 +38,23 @@ index 86bce6535d..4bb308026c 100644
if (buf) if (buf)
{ {
diff --git a/grub-core/net/http.c b/grub-core/net/http.c 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 --- a/grub-core/net/http.c
+++ b/grub-core/net/http.c +++ b/grub-core/net/http.c
@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -29,7 +29,11 @@
enum GRUB_MOD_LICENSE ("GPLv3+");
{
- HTTP_PORT = 80 -#define HTTP_PORT ((grub_uint16_t) 80)
+enum
+ {
+ HTTP_PORT = 80, + HTTP_PORT = 80,
+ HTTP_MAX_CHUNK_SIZE = 0x80000000 + 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) if (data->in_chunk_len == 2)
{ {
data->chunk_rem = grub_strtoul (ptr, 0, 16); data->chunk_rem = grub_strtoul (ptr, 0, 16);

@ -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;

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

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

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

@ -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 diff --git a/docs/grub-boot-indeterminate.service b/docs/grub-boot-indeterminate.service
new file mode 100644 new file mode 100644
index 0000000000..6c8dcb186b index 00000000000..6c8dcb186b6
--- /dev/null --- /dev/null
+++ b/docs/grub-boot-indeterminate.service +++ b/docs/grub-boot-indeterminate.service
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 13 insertions(+), 1 deletion(-) 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/gentpl.py b/gentpl.py diff --git a/gentpl.py b/gentpl.py
index c86550d4f9..f3c5f84f85 100644 index bfab2113a1d..6cad9b8231f 100644
--- a/gentpl.py --- a/gentpl.py
+++ b/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): def foreach_enabled_platform(defn, closure):
@ -35,7 +35,7 @@ index c86550d4f9..f3c5f84f85 100644
for platform in GRUB_PLATFORMS: for platform in GRUB_PLATFORMS:
platform_conditional(platform, closure) 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): def is_platform_independent(defn):
if 'enable' in defn: if 'enable' in defn:
return False return False

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

@ -9,7 +9,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 3 insertions(+), 1 deletion(-) 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c 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 --- a/grub-core/net/efi/net.c
+++ b/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c
@@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void) @@ -1324,7 +1324,9 @@ grub_efi_net_boot_from_https (void)

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

@ -17,11 +17,11 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
3 files changed, 64 insertions(+), 16 deletions(-) 3 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 302300711f..008f6c273b 100644 index fcfbcbb664d..c17e83acf87 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -849,11 +849,23 @@ if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$p @@ -914,11 +914,23 @@ if test "x$target_cpu" = xloongarch64; then
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" TARGET_CCASFLAGS="$TARGET_CCASFLAGS -Wa,-mla-global-with-abs"
fi fi
+# Should grub utils get the host CFLAGS, or the target CFLAGS? +# 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, [ AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
grub_cv_target_cc_soft_float=no grub_cv_target_cc_soft_float=no
if test "x$target_cpu" = xarm64; then 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_srcdir)/include"
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
@ -88,19 +88,19 @@ index 302300711f..008f6c273b 100644
GRUB_PLATFORM="${platform}" GRUB_PLATFORM="${platform}"
diff --git a/conf/Makefile.common b/conf/Makefile.common diff --git a/conf/Makefile.common b/conf/Makefile.common
index 5f0ef96985..2ff9b39357 100644 index 6262f21a772..54f0f7f7664 100644
--- a/conf/Makefile.common --- a/conf/Makefile.common
+++ b/conf/Makefile.common +++ b/conf/Makefile.common
@@ -40,24 +40,25 @@ CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1 @@ -50,24 +50,25 @@ else
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) endif
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 endif
-CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding -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) -CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
-CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
+CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_PLATFORM) -ffreestanding +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) +CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
+CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
@ -129,10 +129,10 @@ index 5f0ef96985..2ff9b39357 100644
# Other variables # Other variables
diff --git a/gentpl.py b/gentpl.py diff --git a/gentpl.py b/gentpl.py
index f09b336869..0e62e14666 100644 index 597129a2bc4..5826a6b14e8 100644
--- a/gentpl.py --- a/gentpl.py
+++ b/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(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("nodist_" + cname(defn) + "_SOURCES", platform_nodist_sources(defn, platform) + " ## platform nodist sources")
var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform)) var_set(cname(defn) + "_LDADD", platform_ldadd(defn, platform))

@ -17,18 +17,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@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/lib/fdt.c | 2 --
grub-core/loader/efi/fdt.c | 2 ++ grub-core/loader/efi/fdt.c | 2 ++
include/grub/fdt.h | 6 ++++++ include/grub/fdt.h | 6 ++++++
grub-core/Makefile.am | 1 + 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 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 --- a/grub-core/Makefile.core.def
+++ b/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/init.c;
arm_coreboot = kern/arm/coreboot/timer.c; arm_coreboot = kern/arm/coreboot/timer.c;
arm_coreboot = kern/arm/coreboot/coreboot.S; arm_coreboot = kern/arm/coreboot/coreboot.S;
@ -36,7 +36,7 @@ index 12797336c9..4e7d90da76 100644
arm_coreboot = bus/fdt.c; arm_coreboot = bus/fdt.c;
arm_coreboot = term/ps2.c; arm_coreboot = term/ps2.c;
arm_coreboot = term/arm/pl050.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/cache_flush.S;
riscv64 = kern/riscv/dl.c; riscv64 = kern/riscv/dl.c;
@ -45,15 +45,7 @@ index 12797336c9..4e7d90da76 100644
emu = disk/host.c; emu = disk/host.c;
emu = kern/emu/cache_s.S; emu = kern/emu/cache_s.S;
emu = kern/emu/hostdisk.c; emu = kern/emu/hostdisk.c;
@@ -1825,7 +1826,6 @@ module = { @@ -1882,7 +1883,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 = {
module = { module = {
name = fdt; name = fdt;
efi = loader/efi/fdt.c; 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 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 --- a/grub-core/lib/fdt.c
+++ b/grub-core/lib/fdt.c +++ b/grub-core/lib/fdt.c
@@ -21,8 +21,6 @@ @@ -21,8 +21,6 @@
@ -75,7 +67,7 @@ index 0d371c5633..37e04bd69e 100644
#define FDT_BEGIN_NODE 0x00000001 #define FDT_BEGIN_NODE 0x00000001
diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c 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 --- a/grub-core/loader/efi/fdt.c
+++ b/grub-core/loader/efi/fdt.c +++ b/grub-core/loader/efi/fdt.c
@@ -27,6 +27,8 @@ @@ -27,6 +27,8 @@
@ -88,7 +80,7 @@ index c86f283d75..c572415d38 100644
static void *fdt; static void *fdt;
diff --git a/include/grub/fdt.h b/include/grub/fdt.h 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 --- a/include/grub/fdt.h
+++ b/include/grub/fdt.h +++ b/include/grub/fdt.h
@@ -19,6 +19,9 @@ @@ -19,6 +19,9 @@
@ -110,7 +102,7 @@ index e609c7e411..3514aa4a5b 100644
+ +
#endif /* ! GRUB_FDT_HEADER */ #endif /* ! GRUB_FDT_HEADER */
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am 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 --- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am +++ b/grub-core/Makefile.am
@@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h @@ -76,6 +76,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/sb.h

@ -9,10 +9,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 20 insertions(+) 1 file changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 008f6c273b..54462e0892 100644 index c17e83acf87..3f3a170ab17 100644
--- a/configure.ac --- a/configure.ac
+++ b/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 done
]) ])

@ -16,7 +16,7 @@ Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2 files changed, 71 insertions(+), 21 deletions(-) 2 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c 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 --- a/grub-core/kern/main.c
+++ b/grub-core/kern/main.c +++ b/grub-core/kern/main.c
@@ -131,11 +131,19 @@ grub_set_prefix_and_root (void) @@ -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 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 --- a/grub-core/net/efi/http.c
+++ b/grub-core/net/efi/http.c +++ b/grub-core/net/efi/http.c
@@ -9,10 +9,52 @@ @@ -9,10 +9,52 @@
@ -97,7 +97,7 @@ index 243acbaa35..de351b2cd0 100644
grub_efi_http_t *http = dev->http; 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_err_t err;
grub_off_t size; grub_off_t size;
char *buf; char *buf;

@ -10,7 +10,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
2 files changed, 17 insertions(+), 4 deletions(-) 2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c 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 --- a/grub-core/kern/err.c
+++ b/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]; @@ -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; return n;
diff --git a/include/grub/err.h b/include/grub/err.h 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 --- a/include/grub/err.h
+++ b/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 grub_err_t EXPORT_VAR(grub_errno);
extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG]; extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];

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

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

@ -12,7 +12,7 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
4 files changed, 10 insertions(+) 4 files changed, 10 insertions(+)
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c 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 --- a/grub-core/disk/diskfilter.c
+++ b/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c
@@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter) @@ -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)) if (!accept_diskfilter && is_valid_diskfilter_name (name))
return 0; 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. */ the same. */
if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size) if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
@ -33,10 +33,10 @@ index 0320115662..7cdffe3ebd 100644
if (!pv->disk) if (!pv->disk)
return grub_errno; return grub_errno;
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c 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 --- a/grub-core/disk/efi/efidisk.c
+++ b/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; return 0;
} }
@ -45,7 +45,7 @@ index f077b5f553..fe8ba6e6c9 100644
grub_free (dup_dp); grub_free (dup_dp);
diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c 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 --- a/grub-core/kern/device.c
+++ b/grub-core/kern/device.c +++ b/grub-core/kern/device.c
@@ -34,6 +34,7 @@ grub_device_open (const char *name) @@ -34,6 +34,7 @@ grub_device_open (const char *name)
@ -57,7 +57,7 @@ index 73b8ecc0c0..f58b58c89d 100644
{ {
name = grub_env_get ("root"); name = grub_env_get ("root");
diff --git a/grub-core/script/script.c b/grub-core/script/script.c 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 --- a/grub-core/script/script.c
+++ b/grub-core/script/script.c +++ b/grub-core/script/script.c
@@ -22,6 +22,11 @@ @@ -22,6 +22,11 @@

@ -9,19 +9,18 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
grub-core/lib/reed_solomon.c | 4 ++-- grub-core/lib/reed_solomon.c | 4 ++--
grub-core/osdep/linux/blocklist.c | 2 +- grub-core/osdep/linux/blocklist.c | 2 +-
grub-core/osdep/linux/getroot.c | 2 +- grub-core/osdep/linux/getroot.c | 2 +-
grub-core/osdep/linux/hostdisk.c | 2 +-
util/grub-fstest.c | 2 +- util/grub-fstest.c | 2 +-
util/grub-menulst2cfg.c | 2 +- util/grub-menulst2cfg.c | 2 +-
util/grub-mkfont.c | 13 +++++++------ util/grub-mkfont.c | 13 +++++++------
util/grub-probe.c | 2 +- util/grub-probe.c | 2 +-
util/setup.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 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 --- a/grub-core/kern/emu/misc.c
+++ b/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); sz = ftello (f);
if (sz < 0) if (sz < 0)
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno)); grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
@ -31,10 +30,10 @@ index 0ff13bcaf8..d278c2921f 100644
ret = (size_t) sz; ret = (size_t) sz;
diff --git a/grub-core/lib/reed_solomon.c b/grub-core/lib/reed_solomon.c 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 --- a/grub-core/lib/reed_solomon.c
+++ b/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) rs_encode (gf_single_t *data, grub_size_t s, grub_size_t rs)
{ {
gf_single_t *rs_polynomial; gf_single_t *rs_polynomial;
@ -43,7 +42,7 @@ index 467305b46a..79037c093f 100644
gf_single_t *m; gf_single_t *m;
m = xcalloc (s + rs, sizeof (gf_single_t)); m = xcalloc (s + rs, sizeof (gf_single_t));
grub_memcpy (m, data, s * 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, encode_block (gf_single_t *ptr, grub_size_t s,
gf_single_t *rptr, grub_size_t rs) 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; 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 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 --- a/grub-core/osdep/linux/blocklist.c
+++ b/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, @@ -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 + fie1.fm_mapped_extents
* sizeof (fie1.fm_extents[1])); * sizeof (fie1.fm_extents[1]));
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c 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 --- a/grub-core/osdep/linux/getroot.c
+++ b/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; int fd;
struct btrfs_ioctl_fs_info_args fsi; struct btrfs_ioctl_fs_info_args fsi;
@ -78,24 +77,11 @@ index 28790307e0..9f730b3518 100644
char **ret; char **ret;
fd = open (dir, 0); 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 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 --- a/util/grub-fstest.c
+++ b/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); read_file (src, cmp_hook, ff);
{ {
@ -105,7 +91,7 @@ index 8386564200..bfcef852d8 100644
fseek (ff, 0, SEEK_END); fseek (ff, 0, SEEK_END);
if (pre != ftell (ff)) if (pre != ftell (ff))
diff --git a/util/grub-menulst2cfg.c b/util/grub-menulst2cfg.c 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 --- a/util/grub-menulst2cfg.c
+++ b/util/grub-menulst2cfg.c +++ b/util/grub-menulst2cfg.c
@@ -34,7 +34,7 @@ main (int argc, char **argv) @@ -34,7 +34,7 @@ main (int argc, char **argv)
@ -118,10 +104,10 @@ index a39f869394..358d604210 100644
grub_util_host_init (&argc, &argv); grub_util_host_init (&argc, &argv);
diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c 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 --- a/util/grub-mkfont.c
+++ b/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 width, height;
int cuttop, cutbottom, cutleft, cutright; int cuttop, cutbottom, cutleft, cutright;
grub_uint8_t *data; grub_uint8_t *data;
@ -131,7 +117,7 @@ index 0fe45a6103..3e09240b99 100644
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME; int flag = FT_LOAD_RENDER | FT_LOAD_MONOCHROME;
FT_Error err; 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; cuttop = cutbottom = cutleft = cutright = 0;
else else
{ {
@ -140,7 +126,7 @@ index 0fe45a6103..3e09240b99 100644
{ {
for (j = 0; j < glyph->bitmap.width; j++) for (j = 0; j < glyph->bitmap.width; j++)
if (glyph->bitmap.buffer[j / 8 + cuttop * glyph->bitmap.pitch] 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; break;
} }
cutbottom = glyph->bitmap.rows - 1 - cutbottom; cutbottom = glyph->bitmap.rows - 1 - cutbottom;
@ -153,7 +139,7 @@ index 0fe45a6103..3e09240b99 100644
{ {
for (j = 0; j < glyph->bitmap.rows; j++) for (j = 0; j < glyph->bitmap.rows; j++)
if (glyph->bitmap.buffer[cutleft / 8 + j * glyph->bitmap.pitch] 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; break;
} }
cutright = glyph->bitmap.width - 1 - cutright; cutright = glyph->bitmap.width - 1 - cutright;
@ -162,7 +148,7 @@ index 0fe45a6103..3e09240b99 100644
cutright = 0; 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; mask = 0;
data = &glyph_info->bitmap[0] - 1; data = &glyph_info->bitmap[0] - 1;
@ -172,10 +158,10 @@ index 0fe45a6103..3e09240b99 100644
add_pixel (&data, &mask, add_pixel (&data, &mask,
glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] & glyph->bitmap.buffer[i / 8 + j * glyph->bitmap.pitch] &
diff --git a/util/grub-probe.c b/util/grub-probe.c 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 --- a/util/grub-probe.c
+++ b/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': case 't':
{ {
@ -185,7 +171,7 @@ index c08e46bbb4..c6fac732b4 100644
for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++) for (i = PRINT_FS; i < ARRAY_SIZE (targets); i++)
if (strcmp (arg, targets[i]) == 0) if (strcmp (arg, targets[i]) == 0)
diff --git a/util/setup.c b/util/setup.c diff --git a/util/setup.c b/util/setup.c
index da5f2c07f5..8b22bb8cca 100644 index 87a889ff7e3..7aab468b0eb 100644
--- a/util/setup.c --- a/util/setup.c
+++ b/util/setup.c +++ b/util/setup.c
@@ -406,7 +406,7 @@ SETUP (const char *dir, @@ -406,7 +406,7 @@ SETUP (const char *dir,

@ -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 Subject: [PATCH] Don't use -Wno-sign-compare -Wno-conversion -Wno-error, do
use -Wextra. 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> Signed-off-by: Peter Jones <pjones@redhat.com>
--- ---
configure.ac | 14 +++++++++++--- configure.ac | 8 ++++++++
conf/Makefile.common | 2 +- conf/Makefile.common | 2 +-
2 files changed, 12 insertions(+), 4 deletions(-) 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index 7b4e1854d3..490353713a 100644 index 2175aa56997..81240397384 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -1452,11 +1452,11 @@ fi @@ -2147,6 +2147,14 @@ if test x"$enable_werror" != xno ; then
# Set them to their new values for the tests below. fi
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"
fi fi
+AC_ARG_ENABLE([wextra], +AC_ARG_ENABLE([wextra],
@ -45,15 +33,15 @@ index 7b4e1854d3..490353713a 100644
TARGET_CCAS=$TARGET_CC TARGET_CCAS=$TARGET_CC
diff --git a/conf/Makefile.common b/conf/Makefile.common diff --git a/conf/Makefile.common b/conf/Makefile.common
index 2ff9b39357..35e14ff017 100644 index 54f0f7f7664..e53ff352407 100644
--- a/conf/Makefile.common --- a/conf/Makefile.common
+++ b/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) platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
starfielddir = $(pkgdatadir)/themes/starfield 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-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=attributes
+CFLAGS_GNULIB = -Wno-undef -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code +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 CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib -I$(top_srcdir)/grub-core/lib/gnulib
CFLAGS_POSIX = -fno-builtin CFLAGS_POSIX = -fno-builtin

@ -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>

@ -12,10 +12,10 @@ Signed-off-by: Peter Jones <pjones@redhat.com>
1 file changed, 7 insertions(+), 9 deletions(-) 1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c 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 --- a/grub-core/osdep/linux/getroot.c
+++ b/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; return grub_dev;
} }

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

Loading…
Cancel
Save