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
This commit is contained in:
Peter Jones 2012-09-19 10:43:43 -04:00
parent 0d0dfe43f9
commit 176f649bbe
4 changed files with 64 additions and 15 deletions

View File

@ -1,15 +1,20 @@
From d829d54d0f461c7bc6a7d8bd549cfdacfac51082 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
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 <pfsmorigo@br.ibm.com>
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

View File

@ -0,0 +1,29 @@
From 7e1f42417dab20d470d1e45dfa73d00c763d792d Mon Sep 17 00:00:00 2001
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
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

View File

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

View File

@ -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 <pjones@redhat.com> - 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 <mjg@redhat.com> - 2.00-7
- Add Apple partition map support for EFI