From 88507aed885a5e6490a046c53b26858727b249b336bad029a14508164cee710b Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 22 Mar 2012 11:32:34 +0000 Subject: [PATCH] Accepting request 110168 from devel:openSUSE:Factory - Fix build with gcc 4.7 (needs -fno-strict-aliasing for zfs code). - Fix error in installation to extended partition (bnc#750897) - Added BuildRequires for gnu-unifont OBS-URL: https://build.opensuse.org/request/show/110168 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=30 --- grub2-gcc47.patch | 30 +++++++++++++++++++ grub2-install-opt-skip-fs-probe.patch | 23 ++++++++++++++ ...rate-and-hook-for-extended-partition.patch | 22 ++++++++++++++ grub2-linux.patch | 10 +++---- grub2-unused.patch | 12 ++++---- grub2.changes | 18 +++++++++++ grub2.spec | 29 ++++++++++++++---- 7 files changed, 127 insertions(+), 17 deletions(-) create mode 100644 grub2-gcc47.patch create mode 100644 grub2-install-opt-skip-fs-probe.patch create mode 100644 grub2-iterate-and-hook-for-extended-partition.patch diff --git a/grub2-gcc47.patch b/grub2-gcc47.patch new file mode 100644 index 0000000..a764439 --- /dev/null +++ b/grub2-gcc47.patch @@ -0,0 +1,30 @@ +Index: grub-1.99/grub-core/commands/usbtest.c +=================================================================== +--- grub-1.99.orig/grub-core/commands/usbtest.c ++++ grub-1.99/grub-core/commands/usbtest.c +@@ -111,7 +111,7 @@ grub_usb_get_string (grub_usb_device_t d + static void + usb_print_str (const char *description, grub_usb_device_t dev, int idx) + { +- char *name; ++ char *name = NULL; + grub_usb_err_t err; + /* XXX: LANGID */ + +Index: grub-1.99/conf/Makefile.common +=================================================================== +--- grub-1.99.orig/conf/Makefile.common ++++ grub-1.99/conf/Makefile.common +@@ -11,10 +11,10 @@ if COND_i386_pc + CFLAGS_PLATFORM += -mrtd -mregparm=3 + endif + if COND_i386_efi +- LDFLAGS_PLATFORM = -melf_i386 ++ LDFLAGS_PLATFORM = -Wl,-melf_i386 + endif + if COND_x86_64_efi +- LDFLAGS_PLATFORM = -melf_x86_64 ++ LDFLAGS_PLATFORM = -Wl,-melf_x86_64 + endif + if COND_i386_qemu + CFLAGS_PLATFORM += -mrtd -mregparm=3 diff --git a/grub2-install-opt-skip-fs-probe.patch b/grub2-install-opt-skip-fs-probe.patch new file mode 100644 index 0000000..5885183 --- /dev/null +++ b/grub2-install-opt-skip-fs-probe.patch @@ -0,0 +1,23 @@ +Index: grub-1.99/util/grub-install.in +=================================================================== +--- grub-1.99.orig/util/grub-install.in ++++ grub-1.99/util/grub-install.in +@@ -248,6 +248,9 @@ do + -f | --force) + setup_force="--force" ;; + ++ -s | --skip-fs-probe) ++ setup_skip_fs_probe="--skip-fs-probe" ;; ++ + -*) + echo "Unrecognized option \`$option'" 1>&2 + usage +@@ -581,7 +584,7 @@ fi + # Perform the platform-dependent install + if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then + # Now perform the installation. +- "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}" \ ++ "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} ${setup_skip_fs_probe} --directory="${grubdir}" \ + --device-map="${device_map}" "${install_device}" || exit 1 + elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then + if [ x"$update_nvram" = xyes ]; then diff --git a/grub2-iterate-and-hook-for-extended-partition.patch b/grub2-iterate-and-hook-for-extended-partition.patch new file mode 100644 index 0000000..c9bba99 --- /dev/null +++ b/grub2-iterate-and-hook-for-extended-partition.patch @@ -0,0 +1,22 @@ +Index: grub-1.99/grub-core/partmap/msdos.c +=================================================================== +--- grub-1.99.orig/grub-core/partmap/msdos.c ++++ grub-1.99/grub-core/partmap/msdos.c +@@ -107,11 +107,15 @@ grub_partition_msdos_iterate (grub_disk_ + return grub_error (GRUB_ERR_BAD_PART_TABLE, "dummy mbr"); + + /* If this partition is a normal one, call the hook. */ +- if (! grub_msdos_partition_is_empty (e->type) +- && ! grub_msdos_partition_is_extended (e->type)) ++ if (! grub_msdos_partition_is_empty (e->type)) + { + p.number++; + ++ /* prevent someone doing mkfs or mkswap on an ++ extended partition, but leave room for LILO */ ++ if (grub_msdos_partition_is_extended (e->type)) ++ p.len = 2; ++ + if (hook (disk, &p)) + return grub_errno; + } diff --git a/grub2-linux.patch b/grub2-linux.patch index fe78bd0..9ee3bd2 100644 --- a/grub2-linux.patch +++ b/grub2-linux.patch @@ -1,8 +1,8 @@ -Index: util/grub.d/10_linux.in +Index: grub-1.99/util/grub.d/10_linux.in =================================================================== ---- util/grub.d/10_linux.in.orig -+++ util/grub.d/10_linux.in -@@ -30,7 +30,7 @@ CLASS="--class gnu-linux --class gnu --c +--- grub-1.99.orig/util/grub.d/10_linux.in ++++ grub-1.99/util/grub.d/10_linux.in +@@ -31,7 +31,7 @@ CLASS="--class gnu-linux --class gnu --c if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux else @@ -11,7 +11,7 @@ Index: util/grub.d/10_linux.in CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" fi -@@ -84,7 +84,7 @@ EOF +@@ -116,7 +116,7 @@ EOF message="$(gettext_printf "Loading Linux %s ..." ${version})" cat << EOF echo '$message' diff --git a/grub2-unused.patch b/grub2-unused.patch index 33380d9..d788f9f 100644 --- a/grub2-unused.patch +++ b/grub2-unused.patch @@ -8,11 +8,11 @@ Signed-off-by: Fedora Ninjas grub-core/lib/relocator.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) -diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c -index dbd5fe4..606b545 100644 ---- a/grub-core/lib/relocator.c -+++ b/grub-core/lib/relocator.c -@@ -1010,6 +1010,9 @@ malloc_in_range (struct grub_relocator *rel, +Index: grub-1.99/grub-core/lib/relocator.c +=================================================================== +--- grub-1.99.orig/grub-core/lib/relocator.c ++++ grub-1.99/grub-core/lib/relocator.c +@@ -1021,6 +1021,9 @@ malloc_in_range (struct grub_relocator * = ALIGN_UP (alloc_end, GRUB_RELOCATOR_FIRMWARE_REQUESTS_QUANT); @@ -22,5 +22,3 @@ index dbd5fe4..606b545 100644 #if GRUB_RELOCATOR_HAVE_LEFTOVERS { struct grub_relocator_fw_leftover *lo1 = NULL; --- -1.7.5.1 diff --git a/grub2.changes b/grub2.changes index 81ee810..a3e213c 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Fri Mar 16 09:21:40 UTC 2012 - aj@suse.de + +- Fix build with gcc 4.7 (needs -fno-strict-aliasing for zfs code). + +------------------------------------------------------------------- +Tue Mar 13 04:06:06 UTC 2012 - mchang@suse.com + +- Fix error in installation to extended partition (bnc#750897) + add grub2-iterate-and-hook-for-extended-partition.patch + add grub2-install-opt-skip-fs-probe.patch + +------------------------------------------------------------------- +Mon Mar 12 09:34:40 UTC 2012 - tittiatcoke@gmail.com + +- Added BuildRequires for gnu-unifont in order to create the + necessary fonts for a graphical boot menu. + ------------------------------------------------------------------- Mon Feb 20 13:04:51 UTC 2012 - andrea.turrini@gmail.com diff --git a/grub2.spec b/grub2.spec index 98ec8db..5878200 100644 --- a/grub2.spec +++ b/grub2.spec @@ -1,7 +1,7 @@ # # spec file for package grub2 # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,6 +15,8 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + + Name: grub2 %ifarch x86_64 ppc64 BuildRequires: freetype2-devel-32bit @@ -37,6 +39,7 @@ BuildRequires: bison BuildRequires: device-mapper-devel BuildRequires: fdupes BuildRequires: flex +BuildRequires: gnu-unifont BuildRequires: lzma BuildRequires: ruby BuildRequires: xz @@ -57,8 +60,8 @@ BuildRequires: xz Version: 1.99 Release: 0 Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot License: GPL-3.0+ +Group: System/Boot Url: http://www.gnu.org/software/grub/ Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz Source1: 90_persistent @@ -72,6 +75,9 @@ Patch2: grub2-linux.patch Patch3: gccwarn.patch Patch4: grub2-linux-submenu.patch Patch5: grub2-unused.patch +Patch6: grub2-iterate-and-hook-for-extended-partition.patch +Patch7: grub2-install-opt-skip-fs-probe.patch +Patch8: grub2-gcc47.patch PreReq: perl-Bootloader Requires: gettext-runtime Requires(post): /sbin/install-info @@ -98,6 +104,7 @@ file that is part of this package's documentation for more information. %package efi Summary: GRUB2 for EFI systems +Group: System/Boot %ifarch ia64 x86_64 #Package is available on ia64 and x86_64 only and not necessarily needed Requires: efibootmgr @@ -120,12 +127,17 @@ provides support for EFI systems. (cd grub-%{version}/po && ls *.po | cut -d. -f1 | xargs) >grub-%{version}/po/LINGUAS sed 's,@setfilename grub.info,@setfilename grub2.info,' grub-%{version}/docs/grub.texi >grub-%{version}/docs/grub2.texi sed -i 's,grub.texi,grub2.texi,' grub-%{version}/docs/Makefile.am +## fix unifont location so grub-mkfont can create *.pf2 files +sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/uni|g' grub-%{version}/configure cd grub-%{version} %patch0 -p1 -%patch2 -p0 +%patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 cd .. # README.openSUSE @@ -138,7 +150,7 @@ cp -a grub-%{version} grub-efi-%{version} %ifarch %{efi} cd grub-efi-%{version} # we don't want to let rpm to override *FLAGS by bogus ones -CFLAGS=" " +CFLAGS="-fno-strict-aliasing " CXXFLAGS=" " FFLAGS=" " export CFLAGS CXXFLAGS FFLAGS @@ -162,7 +174,7 @@ cd grub-%{version} #./autogen.sh # we don't want to let rpm to override *FLAGS by bogus ones -CFLAGS=" " +CFLAGS="-fno-strict-aliasing " CXXFLAGS=" " FFLAGS=" " export CFLAGS CXXFLAGS FFLAGS @@ -197,8 +209,10 @@ install -m 755 -d $RPM_BUILD_ROOT/boot/efi/EFI/opensuse/ install -m 755 grub.efi $RPM_BUILD_ROOT/boot/efi/EFI/opensuse/grub.efi # Remove devel files rm $RPM_BUILD_ROOT/%{_libdir}/%{name}-efi/*/*.h +rm $RPM_BUILD_ROOT%{_datadir}/%{name}-efi/*.h cd .. + %endif cd grub-%{version} @@ -214,6 +228,7 @@ ln -s ../boot/%{name}/grub.cfg $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.cfg # Remove devel files rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h +rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h # Defaults install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub @@ -302,6 +317,8 @@ fi %doc grub-%{version}/ChangeLog grub-%{version}/README.openSUSE %{_infodir}/grub-dev.info* %{_infodir}/%{name}.info* +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/*.pf2 %ifarch %{efi} @@ -347,6 +364,8 @@ fi %doc grub-%{version}/README grub-%{version}/THANKS grub-%{version}/TODO %doc grub-%{version}/ChangeLog grub-%{version}/README.openSUSE %exclude %{_mandir} +%dir %{_datadir}/%{name}-efi +%{_datadir}/%{name}-efi/*.pf2 %endif %changelog