From 9a5891bd62150d9fe70d0459a89bd1dfe05e033fcc4a9a246bc728e87b92f028 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Thu, 31 Jan 2013 08:53:45 +0000 Subject: [PATCH] Accepting request 150514 from home:michael-chang:branches:Base:System - sync from SLE-11 SP3 to date - set empty prefix to grub.efi for looking up in current directory - grub2-cdpath.patch: fix the grub.cfg not found when booting from optical disk - put grub.efi in grub2's source module directory - create links in system's efi directory to grub.efi - arvidjaar: do not overwrite device path in grub2-cdpath.patch OBS-URL: https://build.opensuse.org/request/show/150514 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=12 --- grub2-cdpath.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++++ grub2.changes | 11 ++++++++++ grub2.spec | 36 +++++++++++++++++---------------- 3 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 grub2-cdpath.patch diff --git a/grub2-cdpath.patch b/grub2-cdpath.patch new file mode 100644 index 0000000..a8a7865 --- /dev/null +++ b/grub2-cdpath.patch @@ -0,0 +1,50 @@ +From: Matthew Garrett +Date: 2012-07-10 11:58:52 EDT +Subject: [PATCH] Add support for crappy cd craparino + +References: fate#314485 +Patch-Mainline: no + +Signed-off-by: Michael Chang + +Follow other code in this function and duplicate device path +before overwriting it. + +Signed-off-by: Andrey Borzenkov + +Index: grub-2.00/grub-core/disk/efi/efidisk.c +=================================================================== +--- grub-2.00.orig/grub-core/disk/efi/efidisk.c ++++ grub-2.00/grub-core/disk/efi/efidisk.c +@@ -820,6 +820,31 @@ grub_efidisk_get_device_name (grub_efi_h + + return dev_name; + } ++ else if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE && ++ (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) == GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE)) ++ { ++ grub_efi_device_path_t *dup_dp, *dup_ldp; ++ ++ /* It is necessary to duplicate the device path so that GRUB ++ can overwrite it. */ ++ dup_dp = duplicate_device_path (dp); ++ if (! dup_dp) ++ return 0; ++ ++ dup_ldp = find_last_device_path (dup_dp); ++ dup_ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ++ dup_ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ++ dup_ldp->length[0] = 4; ++ dup_ldp->length[1] = 0; ++ ++ if (!get_diskname_from_path (dup_dp, device_name)) ++ { ++ grub_free (dup_dp); ++ return 0; ++ } ++ grub_free (dup_dp); ++ return grub_strdup (device_name); ++ } + else + { + /* This should be an entire disk. */ diff --git a/grub2.changes b/grub2.changes index e859c25..fc7f04e 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Jan 30 07:29:29 UTC 2013 - mchang@suse.com + +- sync from SLE-11 SP3 to date +- set empty prefix to grub.efi for looking up in current directory +- grub2-cdpath.patch: fix the grub.cfg not found when booting from + optical disk +- put grub.efi in grub2's source module directory +- create links in system's efi directory to grub.efi +- arvidjaar: do not overwrite device path in grub2-cdpath.patch + ------------------------------------------------------------------- Wed Jan 30 04:36:45 UTC 2013 - arvidjaar@gmail.com diff --git a/grub2.spec b/grub2.spec index 6de126c..9bd98db 100644 --- a/grub2.spec +++ b/grub2.spec @@ -81,14 +81,6 @@ BuildRequires: guile %define only_x86_64 %{nil} %endif -%if 0%{?sles_version} -%global efidir SuSE -%else -%if 0%{?suse_version} -%global efidir opensuse -%endif -%endif - Version: 2.00 Release: 0 Summary: Bootloader with support for Linux, Multiboot and more @@ -136,6 +128,7 @@ Patch26: grub2-fix-enumeration-of-extended-partition.patch Patch27: grub2-add-device-to-os_prober-linux-menuentry.patch Patch28: grub2-fix-unquoted-string-in-class.patch Patch29: grub2-secureboot-chainloader.patch +Patch30: grub2-cdpath.patch PreReq: perl-Bootloader Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -252,6 +245,7 @@ mv docs/grub.texi docs/grub2.texi %patch27 -p1 %patch28 -p1 %patch29 -p1 +%patch30 -p1 cd .. # README.openSUSE @@ -280,9 +274,9 @@ make %{?_smp_mflags} #TODO: add efifwsetup module -FS_MODULES="ext2 fat btrfs ext2 xfs jfs reiserfs" +FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs" CD_MODULES=" all_video boot cat chain configfile echo \ - efinet ext2 font gfxmenu gfxterm gzio halt iso9660 \ + efinet fat font gfxmenu gfxterm gzio halt iso9660 \ jpeg minicmd normal part_apple part_msdos part_gpt \ password_pbkdf2 png reboot search search_fs_uuid \ search_fs_file search_label sleep test video" @@ -294,7 +288,7 @@ CD_MODULES="${CD_MODULES} linux" %endif GRUB_MODULES="${CD_MODULES} ${FS_MODULES} mdraid09 mdraid1x" -./grub-mkimage -O %{grubefiarch} -o grub.efi -p /EFI/%{efidir} \ +./grub-mkimage -O %{grubefiarch} -o grub.efi --prefix= \ -d grub-core ${GRUB_MODULES} #./grub-mkimage -O %{grubefiarch} -o grub.efi -d grub-core part_gpt hfsplus fat \ # ext2 btrfs normal chain boot configfile linux appleldr minicmd \ @@ -338,8 +332,17 @@ make %{?_smp_mflags} cd grub-efi-%{version} make DESTDIR=$RPM_BUILD_ROOT install -install -m 755 -d $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/ -install -m 755 grub.efi $RPM_BUILD_ROOT/boot/efi/EFI/%{efidir}/grub.efi +install -m 644 grub.efi $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubefiarch}/grub.efi + +# Create grub.efi link to system efi directory +# This is for tools like kiwi not fiddling with the path +%if "%{grubefiarch}" == "x86_64-efi" +%define sysefidir %{_exec_prefix}/lib64/efi +%else +%define sysefidir %{_libdir}/efi +%endif +install -d $RPM_BUILD_ROOT%{sysefidir} +ln -sf ../../../%{_libdir}/%{name}/%{grubefiarch}/grub.efi $RPM_BUILD_ROOT%{sysefidir}/grub.efi cd .. %endif @@ -610,11 +613,8 @@ fi %files %{grubefiarch} %defattr(-,root,root,-) -%dir /boot/efi -%dir /boot/efi/EFI -%dir /boot/efi/EFI/%{efidir} -%attr(0755,root,root)/boot/efi/EFI/%{efidir}/grub.efi %dir %{_libdir}/%{name}/%{grubefiarch} +%{_libdir}/%{name}/%{grubefiarch}/grub.efi %{_libdir}/%{name}/%{grubefiarch}/*.img %{_libdir}/%{name}/%{grubefiarch}/*.lst %{_libdir}/%{name}/%{grubefiarch}/*.mod @@ -623,6 +623,8 @@ fi %{_libdir}/%{name}/%{grubefiarch}/gmodule.pl %{_libdir}/%{name}/%{grubefiarch}/kernel.exec %{_libdir}/%{name}/%{grubefiarch}/modinfo.sh +%dir %{sysefidir} +%{sysefidir}/grub.efi %endif %changelog