From 9d784831ea8baaf53b70a4fc68f918e999ccde15 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 19 Sep 2012 10:43:43 -0400 Subject: [PATCH] Don't error on insmod on UEFI/SB, but also don't do any insmodding. - Increase device path size for ieee1275 Resolves: rhbz#857936 - Make network booting work on ieee1275 machines. Resolves: rhbz#857936 --- ...h => grub-2.00-add-fw_path-search_v2.patch | 30 ++++++++++++------- ...the-ieee1275-device-path-buffer-size.patch | 29 ++++++++++++++++++ grub-2.00-no-insmod-on-sb.patch | 8 +++-- grub2.spec | 12 ++++++-- 4 files changed, 64 insertions(+), 15 deletions(-) rename grub-2.00-add-fw_path-search.patch => grub-2.00-add-fw_path-search_v2.patch (66%) create mode 100644 grub-2.00-increase-the-ieee1275-device-path-buffer-size.patch diff --git a/grub-2.00-add-fw_path-search.patch b/grub-2.00-add-fw_path-search_v2.patch similarity index 66% rename from grub-2.00-add-fw_path-search.patch rename to grub-2.00-add-fw_path-search_v2.patch index 367415e..c7857c3 100644 --- a/grub-2.00-add-fw_path-search.patch +++ b/grub-2.00-add-fw_path-search_v2.patch @@ -1,15 +1,20 @@ -From d829d54d0f461c7bc6a7d8bd549cfdacfac51082 Mon Sep 17 00:00:00 2001 -From: Matthew Garrett -Date: Mon, 21 May 2012 14:36:39 -0400 -Subject: [PATCH] Add fw_path variable +From 40d6b00fa48ae9c1cecf143da5c6061f6ffcb719 Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Wed, 19 Sep 2012 21:22:55 -0300 +Subject: [PATCH] Add fw_path variable (revised) +This patch makes grub look for its config file on efi where the app was +found. It was originally written by Matthew Garrett, and adapted to fix the +"No modules are loaded on grub2 network boot" issue: + +https://bugzilla.redhat.com/show_bug.cgi?id=857936 --- grub-core/kern/main.c | 16 ++++++++++++++-- - grub-core/normal/main.c | 20 +++++++++++++++++++- - 2 files changed, 33 insertions(+), 3 deletions(-) + grub-core/normal/main.c | 25 ++++++++++++++++++++++++- + 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c -index 185230c..26481c6 100644 +index 3262444..820fd66 100644 --- a/grub-core/kern/main.c +++ b/grub-core/kern/main.c @@ -114,6 +114,20 @@ grub_set_prefix_and_root (void) @@ -43,10 +48,10 @@ index 185230c..26481c6 100644 if (!device && fwdevice) device = fwdevice; diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c -index 1963fe4..64c2a9f 100644 +index 13473ec..39bb734 100644 --- a/grub-core/normal/main.c +++ b/grub-core/normal/main.c -@@ -309,7 +309,25 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), +@@ -333,7 +333,30 @@ grub_cmd_normal (struct grub_command *cmd __attribute__ ((unused)), /* Guess the config filename. It is necessary to make CONFIG static, so that it won't get broken by longjmp. */ char *config; @@ -67,6 +72,11 @@ index 1963fe4..64c2a9f 100644 + grub_file_close (file); + grub_enter_normal_mode (config); + } ++ else ++ { ++ /* Ignore all errors. */ ++ grub_errno = 0; ++ } + grub_free (config); + } + } @@ -74,5 +84,5 @@ index 1963fe4..64c2a9f 100644 prefix = grub_env_get ("prefix"); if (prefix) -- -1.7.10.2 +1.7.10.4 diff --git a/grub-2.00-increase-the-ieee1275-device-path-buffer-size.patch b/grub-2.00-increase-the-ieee1275-device-path-buffer-size.patch new file mode 100644 index 0000000..8d254bf --- /dev/null +++ b/grub-2.00-increase-the-ieee1275-device-path-buffer-size.patch @@ -0,0 +1,29 @@ +From 7e1f42417dab20d470d1e45dfa73d00c763d792d Mon Sep 17 00:00:00 2001 +From: Paulo Flabiano Smorigo +Date: Wed, 19 Sep 2012 20:50:38 -0300 +Subject: [PATCH] increase the ieee1275 device path buffer size + +There are cases when the openfirmware device path is bigger then 64 chars. + +This should fix this bugzilla: +https://bugzilla.redhat.com/show_bug.cgi?id=857936 +--- + grub-core/kern/ieee1275/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c +index 7d03a8a..5c45947 100644 +--- a/grub-core/kern/ieee1275/init.c ++++ b/grub-core/kern/ieee1275/init.c +@@ -82,7 +82,7 @@ void (*grub_ieee1275_net_config) (const char *dev, + void + grub_machine_get_bootlocation (char **device, char **path) + { +- char bootpath[64]; /* XXX check length */ ++ char bootpath[256]; /* Max device path length */ + char *filename; + char *type; + +-- +1.7.10.4 + diff --git a/grub-2.00-no-insmod-on-sb.patch b/grub-2.00-no-insmod-on-sb.patch index 25719e4..828ce81 100644 --- a/grub-2.00-no-insmod-on-sb.patch +++ b/grub-2.00-no-insmod-on-sb.patch @@ -24,13 +24,15 @@ index eec575c..3df9dbd 100644 /* set ENVVAR=VALUE */ static grub_err_t grub_core_cmd_set (struct grub_command *cmd __attribute__ ((unused)), -@@ -81,6 +85,11 @@ grub_core_cmd_insmod (struct grub_command *cmd __attribute__ ((unused)), +@@ -81,6 +85,13 @@ grub_core_cmd_insmod (struct grub_command *cmd __attribute__ ((unused)), { grub_dl_t mod; +#ifdef GRUB_MACHINE_EFI -+ if (grub_efi_secure_boot()) -+ return grub_error (GRUB_ERR_ACCESS_DENIED, N_("Secure Boot forbids insmod")); ++ if (grub_efi_secure_boot()) { ++ //grub_printf("%s\n", N_("Secure Boot forbids insmod")); ++ return 0; ++ } +#endif + if (argc == 0) diff --git a/grub2.spec b/grub2.spec index 54e33e8..758f6c6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -41,7 +41,7 @@ Name: grub2 Epoch: 1 Version: 2.00 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base @@ -55,7 +55,7 @@ Source5: theme.tar.bz2 #Source6: grub-cd.cfg Patch2: grub-1.99-just-say-linux.patch Patch5: grub-1.99-ppc-terminfo.patch -Patch10: grub-2.00-add-fw_path-search.patch +Patch10: grub-2.00-add-fw_path-search_v2.patch Patch11: grub-2.00-Add-fwsetup.patch Patch13: grub-2.00-Dont-set-boot-on-ppc.patch Patch18: grub-2.00-ignore-gnulib-gets-stupidity.patch @@ -66,6 +66,7 @@ Patch22: grub2-use-linuxefi.patch Patch23: grub-2.00-dont-decrease-mmap-size.patch Patch24: grub-2.00-no-insmod-on-sb.patch Patch25: grub-2.00-efidisk-ahci-workaround.patch +Patch26: grub-2.00-increase-the-ieee1275-device-path-buffer-size.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -418,6 +419,13 @@ fi %doc grub-%{tarversion}/themes/starfield/COPYING.CC-BY-SA-3.0 %changelog +* Thu Sep 20 2012 Peter Jones - 2.00-8 +- Don't error on insmod on UEFI/SB, but also don't do any insmodding. +- Increase device path size for ieee1275 + Resolves: rhbz#857936 +- Make network booting work on ieee1275 machines. + Resolves: rhbz#857936 + * Wed Sep 05 2012 Matthew Garrett - 2.00-7 - Add Apple partition map support for EFI