Accepting request 155546 from home:duwe:branches:Base:System

- merge internal+external BS changes into superset spec file, 
  remove obsolete dependencies
- merge SLES+openSUSE patches, restrict "grub2-efi" to 12.2 and 12.3
- add efidisk-ahci-workaround (bnc#794674)
- fix unquoted-string-in-class.patch (bnc#788322)

- switch to out of source / subdir build

OBS-URL: https://build.opensuse.org/request/show/155546
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=16
This commit is contained in:
Stephan Kulow 2013-02-15 16:18:37 +00:00 committed by Git OBS Bridge
parent ab7eaab2d6
commit b71db834cc
4 changed files with 262 additions and 112 deletions

60
efidisk-ahci-workaround Normal file
View File

@ -0,0 +1,60 @@
From 61474615b8e177881caa89fc04cae16019cf01b9 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Wed, 15 Aug 2012 14:37:07 -0400
Subject: [PATCH] efidisk: Read chunks in smaller blocks
---
grub-core/disk/efi/efidisk.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
index a432b44..77ab5b0 100644
--- a/grub-core/disk/efi/efidisk.c
+++ b/grub-core/disk/efi/efidisk.c
@@ -546,6 +546,9 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
struct grub_efidisk_data *d;
grub_efi_block_io_t *bio;
grub_efi_status_t status;
+ grub_size_t remaining = size;
+ grub_size_t read = 0;
+ grub_size_t chunk = 0x500;
d = disk->data;
bio = d->block_io;
@@ -554,14 +557,29 @@ grub_efidisk_read (struct grub_disk *disk, grub_disk_addr_t sector,
"reading 0x%lx sectors at the sector 0x%llx from %s\n",
(unsigned long) size, (unsigned long long) sector, disk->name);
+ while (remaining > chunk) {
+ status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
+ (grub_efi_uint64_t) sector + read,
+ (grub_efi_uintn_t) chunk << disk->log_sector_size,
+ buf + (read << disk->log_sector_size));
+ if (status != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_READ_ERROR,
+ N_("failure reading sector 0x%llx from `%s'"),
+ (unsigned long long) sector + read,
+ disk->name);
+ read += chunk;
+ remaining -= chunk;
+ }
+
status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
- (grub_efi_uint64_t) sector,
- (grub_efi_uintn_t) size << disk->log_sector_size,
- buf);
+ (grub_efi_uint64_t) sector + read,
+ (grub_efi_uintn_t) remaining << disk->log_sector_size,
+ buf + (read << disk->log_sector_size));
+
if (status != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_READ_ERROR,
N_("failure reading sector 0x%llx from `%s'"),
- (unsigned long long) sector,
+ (unsigned long long) sector + read,
disk->name);
return GRUB_ERR_NONE;
--
1.7.11.2

View File

@ -20,58 +20,55 @@ script parser. The fix is to add single quote to the string.
util/grub.d/20_linux_xen.in | 2 +- util/grub.d/20_linux_xen.in | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-) 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in Index: grub-2.00/util/grub.d/10_hurd.in
index 45f0ad3..5afc079 100644 ===================================================================
--- a/util/grub.d/10_hurd.in --- grub-2.00.orig/util/grub.d/10_hurd.in
+++ b/util/grub.d/10_hurd.in +++ grub-2.00/util/grub.d/10_hurd.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then @@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
OS=GNU OS=GNU
else else
OS="${GRUB_DISTRIBUTOR} GNU/Hurd" OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}" + CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
fi fi
at_least_one=false at_least_one=false
diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in Index: grub-2.00/util/grub.d/10_kfreebsd.in
index b0e84e2..4ec8d96 100644 ===================================================================
--- a/util/grub.d/10_kfreebsd.in --- grub-2.00.orig/util/grub.d/10_kfreebsd.in
+++ b/util/grub.d/10_kfreebsd.in +++ grub-2.00/util/grub.d/10_kfreebsd.in
@@ -30,7 +30,7 @@ CLASS="--class os" @@ -30,7 +30,7 @@ CLASS="--class os"
case "${GRUB_DISTRIBUTOR}" in case "${GRUB_DISTRIBUTOR}" in
Debian) Debian)
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) --class gnu-kfreebsd --class gnu ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' --class gnu-kfreebsd --class gnu ${CLASS}" + CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' --class gnu-kfreebsd --class gnu ${CLASS}"
;; ;;
*) *)
OS="FreeBSD" OS="FreeBSD"
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in Index: grub-2.00/util/grub.d/10_linux.in
index b2f65c0..40f8651 100644 ===================================================================
--- a/util/grub.d/10_linux.in --- grub-2.00.orig/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in +++ grub-2.00/util/grub.d/10_linux.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then @@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
OS=GNU/Linux OS=GNU/Linux
else else
OS="${GRUB_DISTRIBUTOR}" OS="${GRUB_DISTRIBUTOR}"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}" + CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
fi fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but # loop-AES arranges things so that /dev/loop/X can be our root device, but
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in Index: grub-2.00/util/grub.d/20_linux_xen.in
index 29184c2..f1ce61e 100644 ===================================================================
--- a/util/grub.d/20_linux_xen.in --- grub-2.00.orig/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in +++ grub-2.00/util/grub.d/20_linux_xen.in
@@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then @@ -32,7 +32,7 @@ if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; th
OS=GNU/Linux OS=GNU/Linux
else else
OS="${GRUB_DISTRIBUTOR} GNU/Linux" OS="${GRUB_DISTRIBUTOR} GNU/Linux"
- CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}"
+ CLASS="--class '$(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1)' ${CLASS}" + CLASS="--class '$(echo -n "${GRUB_DISTRIBUTOR}" | sed -r 's/[^[:alnum:]]+/-/g; s/(^-|-$)//g' | tr 'A-Z' 'a-z')' ${CLASS}"
fi fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but # loop-AES arranges things so that /dev/loop/X can be our root device, but
--
1.7.3.4

View File

@ -1,8 +1,27 @@
-------------------------------------------------------------------
Thu Feb 14 11:42:40 UTC 2013 - duwe@suse.com
- merge internal+external BS changes into superset spec file,
remove obsolete dependencies
- merge SLES+openSUSE patches, restrict "grub-efi" to 12.2
- add efidisk-ahci-workaround (bnc#794674)
- fix unquoted-string-in-class.patch (bnc#788322)
-------------------------------------------------------------------
Fri Feb 8 01:58:22 UTC 2013 - mchang@suse.com
- adapt to pesign-obs-integration changes
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 7 10:38:42 UTC 2013 - mchang@suse.com Thu Feb 7 10:38:42 UTC 2013 - mchang@suse.com
- grub.efi signing on build server. - grub.efi signing on build server.
-------------------------------------------------------------------
Thu Jan 31 16:18:56 UTC 2013 - duwe@suse.com
- switch to out of source / subdir build
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 30 07:29:29 UTC 2013 - mchang@suse.com Wed Jan 30 07:29:29 UTC 2013 - mchang@suse.com
@ -21,6 +40,19 @@ Wed Jan 30 04:36:45 UTC 2013 - arvidjaar@gmail.com
from grub2-once from grub2-once
- add GRUB_SAVEDFAULT description to /etc/default/grub - add GRUB_SAVEDFAULT description to /etc/default/grub
-------------------------------------------------------------------
Tue Jan 29 02:42:28 UTC 2013 - mchang@suse.com
- set empty prefix to grub.efi for looking up in current directory
- remove grubcd.efi, as grub.efi can now be used for cdrom booting
-------------------------------------------------------------------
Mon Jan 28 08:05:52 CET 2013 - snwint@suse.de
- add fat module to grubcd
- explicitly set empty prefix to get grub to set $prefix to the currrent
directory
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 18 07:39:18 UTC 2013 - mchang@suse.com Fri Jan 18 07:39:18 UTC 2013 - mchang@suse.com
@ -28,6 +60,16 @@ Fri Jan 18 07:39:18 UTC 2013 - mchang@suse.com
- add grub2-secureboot-chainloader.patch, which expands the efi - add grub2-secureboot-chainloader.patch, which expands the efi
chainloader to be able to verify images via shim lock protocol. chainloader to be able to verify images via shim lock protocol.
-------------------------------------------------------------------
Fri Jan 18 06:24:57 UTC 2013 - mchang@suse.com
- ship a Secure Boot UEFI compatible bootloader (fate#314485).
- update for cdrom boot support.
- grub2-cdpath.patch: fix the grub.cfg not found when booting from
optical disk.
- grubcd.efi: the efi image used for optial disk booting, with
reduced size and $prefix set to /EFI/BOOT.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jan 8 08:09:01 UTC 2013 - mchang@suse.com Tue Jan 8 08:09:01 UTC 2013 - mchang@suse.com
@ -50,6 +92,26 @@ Fri Jan 4 10:29:58 UTC 2013 - arvidjaar@gmail.com
- add support for chainloading another UEFI bootloader to - add support for chainloading another UEFI bootloader to
30_os-prober (bnc#775610) 30_os-prober (bnc#775610)
-------------------------------------------------------------------
Fri Dec 21 04:18:06 UTC 2012 - mchang@suse.com
- put 32-bit grub2 modules to /usr/lib/grub2
- put 64-bit grub2 modules to /usr/lib64/grub2 (x86_64-efi)
- put grub.efi to /usr/lib64/efi(x86_64) or /usr/lib/efi(i586)
-------------------------------------------------------------------
Tue Dec 18 03:43:38 UTC 2012 - mchang@suse.com
- ship a Secure Boot UEFI compatible bootloader (fate#314485)
- add grub2-secureboot-chainloader.patch, which expands the efi
chainloader to be able to verify images via shim lock protocol.
-------------------------------------------------------------------
Fri Nov 30 06:39:15 UTC 2012 - mchang@suse.com
- replace %{sles_version} by %{suse_version}
- use correct product name
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 26 08:26:10 UTC 2012 - mchang@suse.com Mon Nov 26 08:26:10 UTC 2012 - mchang@suse.com

View File

@ -15,6 +15,7 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
# needssslcertforbuild # needssslcertforbuild
Name: grub2 Name: grub2
@ -43,13 +44,9 @@ BuildRequires: makeinfo
BuildRequires: texinfo BuildRequires: texinfo
%endif %endif
BuildRequires: python BuildRequires: python
BuildRequires: ruby
BuildRequires: xz-devel BuildRequires: xz-devel
%if 0%{?suse_version} == 1210
BuildRequires: guile
%endif
%ifarch x86_64 %ifarch x86_64
%if 0%{?suse_version} >= 1230 %if 0%{?suse_version} >= 1230 || 0%{?sles_version} >= 11
BuildRequires: pesign-obs-integration BuildRequires: pesign-obs-integration
%endif %endif
%endif %endif
@ -57,6 +54,13 @@ BuildRequires: pesign-obs-integration
# Modules always contain just 32-bit code # Modules always contain just 32-bit code
%define _libdir %{_exec_prefix}/lib %define _libdir %{_exec_prefix}/lib
%ifarch x86_64
# x86_64-efi is 64-bit code, though ..
%define efi_libdir %{_exec_prefix}/lib64
%else
%define efi_libdir %{_libdir}
%endif
%ifarch ppc ppc64 %ifarch ppc ppc64
%define grubcpu powerpc %define grubcpu powerpc
%define platform ieee1275 %define platform ieee1275
@ -82,7 +86,7 @@ BuildRequires: pesign-obs-integration
%endif %endif
%endif %endif
%if 0%{?sles_version} == 11 %if 0%{?suse_version} == 1110 || 0%{?sles_version} == 11
%define only_efi %{nil} %define only_efi %{nil}
%define only_x86_64 %{nil} %define only_x86_64 %{nil}
%endif %endif
@ -135,6 +139,7 @@ Patch27: grub2-add-device-to-os_prober-linux-menuentry.patch
Patch28: grub2-fix-unquoted-string-in-class.patch Patch28: grub2-fix-unquoted-string-in-class.patch
Patch29: grub2-secureboot-chainloader.patch Patch29: grub2-secureboot-chainloader.patch
Patch30: grub2-cdpath.patch Patch30: grub2-cdpath.patch
Patch31: efidisk-ahci-workaround
PreReq: perl-Bootloader PreReq: perl-Bootloader
Requires: gettext-runtime Requires: gettext-runtime
%if 0%{?suse_version} >= 1140 %if 0%{?suse_version} >= 1140
@ -155,20 +160,26 @@ ExclusiveArch: %{ix86} x86_64 ppc ppc64
%endif %endif
%description %description
This is the second version of the GRUB (Grand Unified Bootloader), This is the second version of the GRUB (Grand Unified Bootloader), a
a highly configurable and customizable bootloader with modular highly configurable and customizable bootloader with modular
architecture. It supports rich scale of kernel formats, file systems, architecture. It support rich scale of kernel formats, file systems,
computer architectures and hardware devices. computer architectures and hardware devices.
PLEASE NOTE: This is a development snapshot, and as such will not
replace grub if you install it, but will be merely added as another
kernel to your existing GRUB menu. Do not replace GRUB (grub package) Authors:
with it unless you know what are you doing. Refer to README.openSUSE --------
file that is part of this package's documentation for more information. Gordon Matzigkeit
Yoshinori K. Okuji
Colin Watson
Colin D. Bennett
Vesa Jääskeläinen
Robert Millan
Carles Pina
%package %{grubarch} %package %{grubarch}
Summary: GRUB2 for %{platform} systems Summary: Bootloader with support for Linux, Multiboot and more
Group: System/Boot Group: System/Boot
%description %{grubarch} %description %{grubarch}
@ -178,23 +189,36 @@ file systems, computer architectures and hardware devices. This subpackage
provides support for %{platform} systems. provides support for %{platform} systems.
%ifarch %{efi} %ifarch %{efi}
%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230
%package efi %package efi
Summary: GRUB2 for EFI systems Summary: Bootloader with support for Linux, Multiboot and more
Group: System/Boot Group: System/Boot
PreReq: %{name} = %{version}-%{release} PreReq: %{name} = %{version}-%{release}
PreReq: %{name}-%{grubefiarch} = %{version}-%{release} PreReq: %{name}-%{grubefiarch} = %{version}-%{release}
%description efi %description efi
The GRand Unified Bootloader (GRUB) is a highly configurable and customizable This is the second version of the GRUB (Grand Unified Bootloader), a
bootloader with modular architecture. It supports rich variety of kernel formats, highly configurable and customizable bootloader with modular
file systems, computer architectures and hardware devices. This subpackage architecture. It support rich scale of kernel formats, file systems,
provides compatibility to old package and install new required one. computer architectures and hardware devices.
Authors:
--------
Gordon Matzigkeit
Yoshinori K. Okuji
Colin Watson
Colin D. Bennett
Vesa Jääskeläinen
Robert Millan
Carles Pina
%endif
%package %{grubefiarch} %package %{grubefiarch}
Summary: GRUB2 for EFI systems Summary: Bootloader with support for Linux, Multiboot and more
Group: System/Boot Group: System/Boot
%ifarch ia64 x86_64 %ifarch ia64 x86_64
#Package is available on ia64 and x86_64 only and not necessarily needed #Package is available on ia64 and x86_64 only and not necessarily needed
@ -211,14 +235,12 @@ provides support for EFI systems.
%prep %prep
# We create (if we build for efi) two copies of the sources in the Builddir # We create (if we build for efi) two copies of the sources in the Builddir
%setup -q -T -c -n grub-%{version} -a 0 -a 5 %setup -q -n grub-%{version} -a 5
cp -r po grub-%{version}/
cd grub-%{version}
(cd po && ls *.po | cut -d. -f1 | xargs) >po/LINGUAS (cd po && ls *.po | cut -d. -f1 | xargs) >po/LINGUAS
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
# Workaround SLE11's patch utility did not rename the file for us # Workaround SLE11's patch utility did not rename the file for us
%if 0%{?sles_version} == 11 %if 0%{?suse_version} == 1110 || 0%{?sles_version} == 11
mv docs/grub.texi docs/grub2.texi mv docs/grub.texi docs/grub2.texi
%endif %endif
%patch2 -p1 %patch2 -p1
@ -252,28 +274,38 @@ mv docs/grub.texi docs/grub2.texi
%patch28 -p1 %patch28 -p1
%patch29 -p1 %patch29 -p1
%patch30 -p1 %patch30 -p1
cd .. %patch31 -p1
# README.openSUSE # README.openSUSE
cp %{SOURCE3} grub-%{version}/ cp %{SOURCE3} .
cp %{SOURCE8} grub-%{version}/ cp %{SOURCE8} .
cp %{SOURCE9} grub-%{version}/grub-core/ cp %{SOURCE9} grub-core/.
mkdir build
%ifarch %{efi} %ifarch %{efi}
(cp -a grub-%{version} grub-efi-%{version}) mkdir build-efi
%endif %endif
%build %build
%ifarch %{efi}
cd grub-efi-%{version}
autoreconf -vi autoreconf -vi
# we don't want to let rpm to override *FLAGS by bogus ones # Not yet:
%define common_conf_options TARGET_LDFLAGS=-static --program-transform-name=s,grub,%{name},
# This does NOT work on SLE11:
%define _configure ../configure
# We don't want to let rpm override *FLAGS with default a.k.a bogus values.
CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once " CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "
CXXFLAGS=" " CXXFLAGS=" "
FFLAGS=" " FFLAGS=" "
export CFLAGS CXXFLAGS FFLAGS export CFLAGS CXXFLAGS FFLAGS
%configure \
%ifarch %{efi}
cd build-efi
../configure \
TARGET_LDFLAGS=-static \ TARGET_LDFLAGS=-static \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \ --target=%{_target_platform} \
--libdir=%{efi_libdir} \
--with-platform=efi \ --with-platform=efi \
--program-transform-name=s,grub,%{name}, --program-transform-name=s,grub,%{name},
make %{?_smp_mflags} make %{?_smp_mflags}
@ -282,10 +314,10 @@ make %{?_smp_mflags}
FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs" FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs"
CD_MODULES=" all_video boot cat chain configfile echo \ CD_MODULES=" all_video boot cat chain configfile echo \
efinet fat font gfxmenu gfxterm gzio halt iso9660 \ efinet font gfxmenu gfxterm gzio halt iso9660 \
jpeg minicmd normal part_apple part_msdos part_gpt \ jpeg minicmd normal part_apple part_msdos part_gpt \
password_pbkdf2 png reboot search search_fs_uuid \ password_pbkdf2 png reboot search search_fs_uuid \
search_fs_file search_label sleep test video" search_fs_file search_label sleep test video fat"
%ifarch x86_64 %ifarch x86_64
CD_MODULES="${CD_MODULES} linuxefi" CD_MODULES="${CD_MODULES} linuxefi"
@ -303,14 +335,7 @@ cd ..
%endif %endif
%if ! 0%{?only_efi:1} %if ! 0%{?only_efi:1}
cd grub-%{version} cd build
autoreconf -vi
# we don't want to let rpm to override *FLAGS by bogus ones
CFLAGS="-fno-strict-aliasing -fno-inline-functions-called-once "
CXXFLAGS=" "
FFLAGS=" "
export CFLAGS CXXFLAGS FFLAGS
# 64-bit x86-64 machines use 32-bit boot loader # 64-bit x86-64 machines use 32-bit boot loader
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then) # (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then)
@ -324,45 +349,36 @@ export CFLAGS CXXFLAGS FFLAGS
# -static is needed so that autoconf script is able to link # -static is needed so that autoconf script is able to link
# test that looks for _start symbol on 64 bit platforms # test that looks for _start symbol on 64 bit platforms
%configure TARGET_LDFLAGS=-static \ ../configure TARGET_LDFLAGS=-static \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--target=%{_target_platform} \ --target=%{_target_platform} \
--with-platform=%{platform} \ --with-platform=%{platform} \
%{extraconfigure} \ %{extraconfigure} \
--program-transform-name=s,grub,%{name}, --program-transform-name=s,grub,%{name},
make %{?_smp_mflags} make %{?_smp_mflags}
%endif %endif
%install %install
%ifarch %{efi} %ifarch %{efi}
cd grub-efi-%{version} %ifarch x86_64
%if 0%{?suse_version} >= 1230 || 0%{?sles_version} >= 11
export BRP_PESIGN_FILES="%{efi_libdir}/efi/grub.efi"
%endif
%endif
cd build-efi
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
install -m 644 grub.efi $RPM_BUILD_ROOT%{_libdir}/%{name}/%{grubefiarch}/grub.efi install -m 755 -d $RPM_BUILD_ROOT%{efi_libdir}/efi
%ifarch x86_64 install -m 644 grub.efi $RPM_BUILD_ROOT%{efi_libdir}/efi/grub.efi
%if 0%{?suse_version} >= 1230
export BRP_PESIGN_FILES="%{_libdir}/%{name}/%{grubefiarch}/grub.efi"
%endif
%endif
# 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 .. cd ..
%endif %endif
%if ! 0%{?only_efi:1} %if ! 0%{?only_efi:1}
cd grub-%{version} cd build
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
%else %else
cd grub-efi-%{version} cd build-efi
%endif %endif
# Script that makes part of grub.cfg persist across updates # Script that makes part of grub.cfg persist across updates
@ -376,12 +392,20 @@ install -d $RPM_BUILD_ROOT/boot/%{name}
touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
# Remove devel files # Remove devel files
%ifarch x86_64
%if ! 0%{?only_efi:1}
rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h
%endif
rm $RPM_BUILD_ROOT/%{efi_libdir}/%{name}/*/*.h
%else
rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h
%endif
%if 0%{?suse_version} >= 1140 %if 0%{?suse_version} >= 1140
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h
%endif %endif
%ifarch %{efi} %ifarch %{efi}
%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230
# grub2-efi compatibility links until other packages are fixed # grub2-efi compatibility links until other packages are fixed
ln -sf %{name}-editenv $RPM_BUILD_ROOT%{_bindir}/%{name}-efi-editenv ln -sf %{name}-editenv $RPM_BUILD_ROOT%{_bindir}/%{name}-efi-editenv
ln -sf %{name}-set-default $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-set-default ln -sf %{name}-set-default $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-set-default
@ -389,6 +413,7 @@ ln -sf %{name}-mkconfig $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-mkconfig
ln -sf %{name}-install $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-install ln -sf %{name}-install $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-install
ln -sf %{name} $RPM_BUILD_ROOT/boot/%{name}-efi ln -sf %{name} $RPM_BUILD_ROOT/boot/%{name}-efi
%endif %endif
%endif
# Defaults # Defaults
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub
@ -441,6 +466,7 @@ fi
%endif %endif
%ifarch %{efi} %ifarch %{efi}
%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230
%triggerpostun -- %{name}-efi %triggerpostun -- %{name}-efi
@ -506,6 +532,7 @@ else
fi fi
exit 0 exit 0
%endif %endif
%endif
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -543,16 +570,16 @@ if [ $1 = 0 ]; then
%endif %endif
fi fi
%if 0%{?only_efi:1} %if 0%{?only_efi:1}
%define source_dir grub-efi-%{version} %define source_dir build-efi
%else %else
%define source_dir grub-%{version} %define source_dir build
%endif %endif
%files -f %{source_dir}/%{name}.lang %files -f %{source_dir}/%{name}.lang
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc %{source_dir}/COPYING %{source_dir}/NEWS %{source_dir}/README %doc COPYING NEWS README
%doc %{source_dir}/THANKS %{source_dir}/TODO %{source_dir}/ChangeLog %doc THANKS TODO ChangeLog
%doc %{source_dir}/README.openSUSE %doc README.openSUSE
%dir /boot/%{name} %dir /boot/%{name}
%ghost /boot/%{name}/grub.cfg %ghost /boot/%{name}/grub.cfg
%{_sysconfdir}/bash_completion.d/grub %{_sysconfdir}/bash_completion.d/grub
@ -583,7 +610,6 @@ fi
%{_bindir}/%{name}-mkstandalone %{_bindir}/%{name}-mkstandalone
%{_bindir}/%{name}-mount %{_bindir}/%{name}-mount
%{_bindir}/%{name}-script-check %{_bindir}/%{name}-script-check
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%if 0%{?suse_version} >= 1140 %if 0%{?suse_version} >= 1140
%{_datadir}/%{name}/*.pf2 %{_datadir}/%{name}/*.pf2
@ -593,8 +619,10 @@ fi
%{_infodir}/%{name}.info* %{_infodir}/%{name}.info*
%if ! 0%{?only_efi:1} %if ! 0%{?only_efi:1}
%files %{grubarch} %files %{grubarch}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{grubarch} %dir %{_libdir}/%{name}/%{grubarch}
%ifnarch ppc ppc64 %ifnarch ppc ppc64
%{_libdir}/%{name}/%{grubarch}/*.image %{_libdir}/%{name}/%{grubarch}/*.image
@ -613,29 +641,32 @@ fi
%endif %endif
%ifarch %{efi} %ifarch %{efi}
%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230
%files efi %files efi
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc %{source_dir}/README %doc README
%ghost /boot/grub2-efi %ghost /boot/grub2-efi
%{_sbindir}/grub2-efi-install %{_sbindir}/grub2-efi-install
%{_sbindir}/grub2-efi-mkconfig %{_sbindir}/grub2-efi-mkconfig
%{_sbindir}/grub2-efi-set-default %{_sbindir}/grub2-efi-set-default
%{_bindir}/grub2-efi-editenv %{_bindir}/grub2-efi-editenv
%endif
%files %{grubefiarch} %files %{grubefiarch}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir %{_libdir}/%{name}/%{grubefiarch} %dir %{efi_libdir}/efi
%{_libdir}/%{name}/%{grubefiarch}/grub.efi %dir %{efi_libdir}/%{name}
%{_libdir}/%{name}/%{grubefiarch}/*.img %dir %{efi_libdir}/%{name}/%{grubefiarch}
%{_libdir}/%{name}/%{grubefiarch}/*.lst %{efi_libdir}/efi/grub.efi
%{_libdir}/%{name}/%{grubefiarch}/*.mod %{efi_libdir}/%{name}/%{grubefiarch}/*.img
%{_libdir}/%{name}/%{grubefiarch}/*.module %{efi_libdir}/%{name}/%{grubefiarch}/*.lst
%{_libdir}/%{name}/%{grubefiarch}/gdb_grub2 %{efi_libdir}/%{name}/%{grubefiarch}/*.mod
%{_libdir}/%{name}/%{grubefiarch}/gmodule.pl %{efi_libdir}/%{name}/%{grubefiarch}/*.module
%{_libdir}/%{name}/%{grubefiarch}/kernel.exec %{efi_libdir}/%{name}/%{grubefiarch}/gdb_grub2
%{_libdir}/%{name}/%{grubefiarch}/modinfo.sh %{efi_libdir}/%{name}/%{grubefiarch}/gmodule.pl
%dir %{sysefidir} %{efi_libdir}/%{name}/%{grubefiarch}/kernel.exec
%{sysefidir}/grub.efi %{efi_libdir}/%{name}/%{grubefiarch}/modinfo.sh
%endif %endif
%changelog %changelog