[grub/f17] Fix CD booting on Apples

Matthew Garrett mjg59 at fedoraproject.org
Wed Apr 25 21:59:19 UTC 2012


commit bd636ca1cc61cb811082f9ecd170c5bdf29da313
Author: Matthew Garrett <mjg at redhat.com>
Date:   Wed Apr 25 17:59:08 2012 -0400

    Fix CD booting on Apples
    
    - Work around Apple firmware bug that hangs in uefi filesystem reads

 0006-Avoid-broken-uefi-fs.patch |   55 +++++++++++++++++++++++++++++++++++++++
 grub.spec                       |   10 +++++-
 2 files changed, 63 insertions(+), 2 deletions(-)
---
diff --git a/0006-Avoid-broken-uefi-fs.patch b/0006-Avoid-broken-uefi-fs.patch
new file mode 100644
index 0000000..4bbb25b
--- /dev/null
+++ b/0006-Avoid-broken-uefi-fs.patch
@@ -0,0 +1,55 @@
+From 1ccd18babed6463dc2f57ed60542deacf8d5fcaf Mon Sep 17 00:00:00 2001
+From: Matthew Garrett <mjg at redhat.com>
+Date: Wed, 25 Apr 2012 16:40:11 -0400
+Subject: [PATCH] Deal with buggy firmware filesystem implementations
+
+Some Apple firmwares don't increment buffersize when returning
+EFI_BUFFER_TOO_SMALL. Hack around that.
+---
+ stage2/fsys_uefi.c |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/stage2/fsys_uefi.c b/stage2/fsys_uefi.c
+index 58b7050..344fefc 100644
+--- a/stage2/fsys_uefi.c
++++ b/stage2/fsys_uefi.c
+@@ -75,7 +75,7 @@ uefi_dir (char *dirname)
+   grub_efi_char16_t *file_name_w = NULL;
+   grub_efi_char16_t *dir_name_w = NULL;
+   grub_efi_file_info_t *fileinfo = NULL;
+-  grub_efi_uintn_t buffersize = 0;  
++  grub_efi_uintn_t buffersize = 0, prev_buffersize;
+   grub_efi_file_t *directory = NULL;
+   int i, dirlen = 0, ret = 0;
+ 
+@@ -106,9 +106,13 @@ uefi_dir (char *dirname)
+     while (1) {
+       int filenamelen;
+ 
++      prev_buffersize = buffersize;
++
+       status = Call_Service_3 (file->read, file, &buffersize, fileinfo);
+ 
+       if (status == GRUB_EFI_BUFFER_TOO_SMALL) {
++	if (buffersize == prev_buffersize)
++	  buffersize += 1024;
+ 	fileinfo = grub_malloc(buffersize);
+ 	continue;
+       } else if (status) {
+@@ -146,9 +150,13 @@ uefi_dir (char *dirname)
+       int filenamelen;
+       int invalid = 0;
+ 
++      prev_buffersize = buffersize;
++
+       status = Call_Service_3 (directory->read, directory, &buffersize, fileinfo);
+ 
+       if (status == GRUB_EFI_BUFFER_TOO_SMALL) {
++	if (buffersize == prev_buffersize)
++	  buffersize += 1024;
+ 	fileinfo = grub_malloc(buffersize);
+ 	continue;
+       } else if (status) {
+-- 
+1.7.10
+
diff --git a/grub.spec b/grub.spec
index 20f7059..0863335 100644
--- a/grub.spec
+++ b/grub.spec
@@ -1,12 +1,12 @@
 Name: grub
 Version: 0.97
-Release: 92%{?dist}
+Release: 93%{?dist}
 Epoch: 1
 Summary: Grand Unified Boot Loader.
 Group: System Environment/Base
 License: GPLv2+
 
-ExclusiveArch: i686 x86_64 ia64
+ExclusiveArch: x86_64 i686
 BuildRequires: binutils >= 2.9.1.0.23, ncurses-devel, ncurses-static, texinfo
 BuildRequires: autoconf /usr/lib/crt1.o automake
 BuildRequires: gnu-efi >= 3.0e-9
@@ -28,6 +28,8 @@ Patch0: grub-fedora-17.patch
 Patch1: 0001-Fix-strange-compilation-problem.patch
 Patch2: 0003-Move_network-disable-earlier.patch
 Patch3: 0004-Make-sure-align-is-initialised.patch
+Patch4: 0005-Fix-Apple-CD-fixup.patch
+Patch5: 0006-Avoid-broken-uefi-fs.patch
 
 %description
 GRUB (Grand Unified Boot Loader) is an experimental boot loader
@@ -122,6 +124,10 @@ fi
 /sbin/grub-crypt
 
 %changelog
+* Wed Apr 25 2012 Matthew Garrett <mjg at redhat.com> - 0.97-93
+- Fix CD booting on Apples
+- Work around Apple firmware bug that hangs in uefi filesystem reads
+
 * Thu Apr 19 2012 Matthew Garrett <mjg at redhat.com> - 0.97-92
 - Build with -Os
 


More information about the scm-commits mailing list