From 32e67a5dbae8dc35a61e51ea73473a213ce5417f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 23 Aug 2017 16:50:11 -0400 Subject: [PATCH] Various fixups - Put grub2-mkimage in -tools, not -tools-extra. - Fix i686 building - Fix ppc HFS+ usage due to /boot/efi's presence. Signed-off-by: Peter Jones --- ...e-libgrub.pp-depend-on-config-util.h.patch | 48 +++++++++++++++++++ ...-efi-as-HFS-on-ppc-machines-in-grub-.patch | 44 +++++++++++++++++ grub.macros | 32 +++++++++---- grub.patches | 2 + grub2.spec | 6 ++- 5 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 0193-Make-libgrub.pp-depend-on-config-util.h.patch create mode 100644 0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/0193-Make-libgrub.pp-depend-on-config-util.h.patch b/0193-Make-libgrub.pp-depend-on-config-util.h.patch new file mode 100644 index 0000000..332fb06 --- /dev/null +++ b/0193-Make-libgrub.pp-depend-on-config-util.h.patch @@ -0,0 +1,48 @@ +From 270c98a14f04ec48e93a67b32a66442773689ff4 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 23 Aug 2017 10:37:27 -0400 +Subject: [PATCH] Make libgrub.pp depend on config-util.h + +If you build with "make -j48" a lot, sometimes you see: + +gcc -E -DHAVE_CONFIG_H -I. -I.. -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I../grub-core/lib/minilzo -I../grub-core/lib/xzembed -DMINILZO_HAVE_CONFIG_H -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub_script.tab.h\" -I. -I.. -I. -I.. -I../include -I./include -I../grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I../grub-core/gnulib -I/builddir/build/BUILD/grub-2.02/grub-aarch64-efi-2.02 -D_FILE_OFFSET_BITS=64 \ + -D'GRUB_MOD_INIT(x)=@MARKER@x@' grub_script.tab.h grub_script.yy.h ../grub-core/commands/blocklist.c ../grub-core/commands/macbless.c ../grub-core/commands/xnu_uuid.c ../grub-core/commands/testload.c ../grub-core/commands/ls.c ../grub-core/disk/dmraid_nvidia.c ../grub-core/disk/loopback.c ../grub-core/disk/lvm.c ../grub-core/disk/mdraid_linux.c ../grub-core/disk/mdraid_linux_be.c ../grub-core/disk/mdraid1x_linux.c ../grub-core/disk/raid5_recover.c ../grub-core/disk/raid6_recover.c ../grub-core/font/font.c ../grub-core/gfxmenu/font.c ../grub-core/normal/charset.c ../grub-core/video/fb/fbblit.c ../grub-core/video/fb/fbutil.c ../grub-core/video/fb/fbfill.c ../grub-core/video/fb/video_fb.c ../grub-core/video/video.c ../grub-core/video/capture.c ../grub-core/video/colors.c ../grub-core/unidata.c ../grub-core/io/bufio.c ../grub-core/fs/affs.c ../grub-core/fs/afs.c ../grub-core/fs/bfs.c ../grub-core/fs/btrfs.c ../grub-core/fs/cbfs.c ../grub-core/fs/cpio.c ../grub-core/fs/cpio_be.c ../grub-core/fs/odc.c ../grub-core/fs/newc.c ../grub-core/fs/ext2.c ../grub-core/fs/fat.c ../grub-core/fs/exfat.c ../grub-core/fs/fshelp.c ../grub-core/fs/hfs.c ../grub-core/fs/hfsplus.c ../grub-core/fs/hfspluscomp.c ../grub-core/fs/iso9660.c ../grub-core/fs/jfs.c ../grub-core/fs/minix.c ../grub-core/fs/minix2.c ../grub-core/fs/minix3.c ../grub-core/fs/minix_be.c ../grub-core/fs/minix2_be.c ../grub-core/fs/minix3_be.c ../grub-core/fs/nilfs2.c ../grub-core/fs/ntfs.c ../grub-core/fs/ntfscomp.c ../grub-core/fs/reiserfs.c ../grub-core/fs/romfs.c ../grub-core/fs/sfs.c ../grub-core/fs/squash4.c ../grub-core/fs/tar.c ../grub-core/fs/udf.c ../grub-core/fs/ufs2.c ../grub-core/fs/ufs.c ../grub-core/fs/ufs_be.c ../grub-core/fs/xfs.c ../grub-core/fs/zfs/zfscrypt.c ../grub-core/fs/zfs/zfs.c ../grub-core/fs/zfs/zfsinfo.c ../grub-core/fs/zfs/zfs_lzjb.c ../grub-core/fs/zfs/zfs_lz4.c ../grub-core/fs/zfs/zfs_sha256.c ../grub-core/fs/zfs/zfs_fletcher.c ../grub-core/lib/envblk.c ../grub-core/lib/hexdump.c ../grub-core/lib/LzFind.c ../grub-core/lib/LzmaEnc.c ../grub-core/lib/crc.c ../grub-core/lib/adler32.c ../grub-core/lib/crc64.c ../grub-core/normal/datetime.c ../grub-core/normal/misc.c ../grub-core/partmap/acorn.c ../grub-core/partmap/amiga.c ../grub-core/partmap/apple.c ../grub-core/partmap/sun.c ../grub-core/partmap/plan.c ../grub-core/partmap/dvh.c ../grub-core/partmap/sunpc.c ../grub-core/partmap/bsdlabel.c ../grub-core/partmap/dfly.c ../grub-core/script/function.c ../grub-core/script/lexer.c ../grub-core/script/main.c ../grub-core/script/script.c ../grub-core/script/argv.c ../grub-core/io/gzio.c ../grub-core/io/xzio.c ../grub-core/io/lzopio.c ../grub-core/kern/ia64/dl_helper.c ../grub-core/kern/arm/dl_helper.c ../grub-core/kern/arm64/dl_helper.c ../grub-core/lib/minilzo/minilzo.c ../grub-core/lib/xzembed/xz_dec_bcj.c ../grub-core/lib/xzembed/xz_dec_lzma2.c ../grub-core/lib/xzembed/xz_dec_stream.c ../util/misc.c ../grub-core/kern/command.c ../grub-core/kern/device.c ../grub-core/kern/disk.c ../grub-core/lib/disk.c ../util/getroot.c ../grub-core/osdep/unix/getroot.c ../grub-core/osdep/getroot.c ../grub-core/osdep/devmapper/getroot.c ../grub-core/osdep/relpath.c ../grub-core/kern/emu/hostdisk.c ../grub-core/osdep/devmapper/hostdisk.c ../grub-core/osdep/hostdisk.c ../grub-core/osdep/unix/hostdisk.c ../grub-core/osdep/exec.c ../grub-core/osdep/sleep.c ../grub-core/osdep/password.c ../grub-core/kern/emu/misc.c ../grub-core/kern/emu/mm.c ../grub-core/kern/env.c ../grub-core/kern/err.c ../grub-core/kern/file.c ../grub-core/kern/fs.c ../grub-core/kern/list.c ../grub-core/kern/misc.c ../grub-core/kern/partition.c ../grub-core/lib/crypto.c ../grub-core/disk/luks.c ../grub-core/disk/geli.c ../grub-core/disk/cryptodisk.c ../grub-core/disk/AFSplitter.c ../grub-core/lib/pbkdf2.c ../grub-core/commands/extcmd.c ../grub-core/lib/arg.c ../grub-core/disk/ldm.c ../grub-core/disk/diskfilter.c ../grub-core/partmap/gpt.c ../grub-core/partmap/msdos.c ../grub-core/fs/proc.c ../grub-core/fs/archelp.c > libgrub.pp || (rm -f libgrub.pp; exit 1) +rm -f stamp-h1 +touch ../config-util.h.in +cd . && /bin/sh ./config.status config-util.h +config.status: creating config-util.h +In file included from ../include/grub/mm.h:25:0, + from ../include/grub/disk.h:29, + from ../include/grub/file.h:26, + from ../grub-core/fs/btrfs.c:21: +./config.h:38:10: fatal error: ./config-util.h: No such file or directory + #include + ^~~~~~~~~~~~~~~ +compilation terminated. +make: *** [Makefile:13098: libgrub.pp] Error 1 + +This is because libgrub.pp is built with -DGRUB_UTIL=1, which means +it'll try to include config-util.h, but a parallel make is actually +building that file. I think. + +Signed-off-by: Peter Jones +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 7795baeb6..c7b0e6a9c 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -37,7 +37,7 @@ grub_script.yy.c: grub_script.yy.h + CLEANFILES += grub_script.yy.c grub_script.yy.h + + # For libgrub.a +-libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES) ++libgrub.pp: config-util.h grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \ + -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) + CLEANFILES += libgrub.pp +-- +2.13.5 + diff --git a/0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch b/0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch new file mode 100644 index 0000000..fcf0496 --- /dev/null +++ b/0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch @@ -0,0 +1,44 @@ +From fafbdc268d3ea0fbebd2589083088adc1a3e8004 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 20 Apr 2017 13:29:06 -0400 +Subject: [PATCH] Don't guess /boot/efi/ as HFS+ on ppc machines in + grub-install + +This should never be trying this, and since we've consolidated the +grubenv to always be on /boot/efi/EFI/fedora/, this code causes it to +always make the wrong decision. + +Resolves: rhbz#1484474 + +Signed-off-by: Peter Jones +--- + util/grub-install.c | 12 +----------- + 1 file changed, 1 insertion(+), 11 deletions(-) + +diff --git a/util/grub-install.c b/util/grub-install.c +index cd84a72b9..48f2abc3e 100644 +--- a/util/grub-install.c ++++ b/util/grub-install.c +@@ -1159,18 +1159,8 @@ main (int argc, char *argv[]) + char *d; + + is_guess = 1; +- d = grub_util_path_concat (2, bootdir, "macppc"); +- if (!grub_util_is_directory (d)) +- { +- free (d); +- d = grub_util_path_concat (2, bootdir, "efi"); +- } + /* Find the Mac HFS(+) System Partition. */ +- if (!grub_util_is_directory (d)) +- { +- free (d); +- d = grub_util_path_concat (2, bootdir, "EFI"); +- } ++ d = grub_util_path_concat (2, bootdir, "macppc"); + if (!grub_util_is_directory (d)) + { + free (d); +-- +2.13.5 + diff --git a/grub.macros b/grub.macros index f23cf78..f190f48 100644 --- a/grub.macros +++ b/grub.macros @@ -61,6 +61,13 @@ %global platform ieee1275 %endif +%ifarch %{ix86} +%global target_cpu_name %{_arch} +%global legacy_target_cpu_name i386 +%global legacy_package_arch pc +%global platform pc +%endif + %global efi_only aarch64 %{arm} %global efi_arch x86_64 ia64 %{efi_only} %ifarch %{efi_arch} @@ -149,12 +156,14 @@ %global evr %{epoch}:%{version}-%{release} -%if %{with_legacy_arch} +%ifarch x86_64 +%global with_efi_common 1 +%global with_legacy_modules 0 +%global with_legacy_common 0 +%else %global with_efi_common 0 %global with_legacy_common 1 -%else -%global with_efi_common 1 -%global with_legacy_common 0 +%global with_legacy_modules 1 %endif %define define_legacy_variant() \ @@ -174,14 +183,17 @@ Requires(post): dracut \ This subpackage provides support for %%{1} systems. \ \ %{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ -%{expand:%%package %%{1}-modules} \ +%{expand:%%if 0%%{with_legacy_modules} \ +%%package %%{1}-modules \ Summary: Modules used to build custom grub images \ Group: System Environment/Base \ BuildArch: noarch \ -Requires: %{name}-common = %{evr} \ -%{expand:%%description %%{1}-modules} \ -%{desc} \ +Requires: %%{name}-common = %%{evr} \ +%%description %%{1}-modules \ +%%{desc} \ This subpackage provides support for rebuilding your own grub.efi. \ +%%endif \ +} \ \ %{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ %{expand:%%package %%{1}-tools} \ @@ -437,6 +449,7 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %config(noreplace) %{_sysconfdir}/%{name}.cfg \ %ghost %config(noreplace) /boot/%{name}/grub.cfg \ \ +%{expand:%if 0%{?with_legacy_modules} \ %{expand:%%files %{1}-modules} \ %defattr(-,root,root) \ %dir %{_libdir}/grub/%{2}/ \ @@ -444,6 +457,9 @@ touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \ %exclude %{_libdir}/grub/%{2}/*.module \ %exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \ %exclude %{_libdir}/grub/%{2}/*.o \ +%else \ +%%exclude %%{_libdir}/grub/%%{grublegacyarch}/* \ +%endif} \ %{nil} %define define_efi_variant_files() \ diff --git a/grub.patches b/grub.patches index f3ee6e1..aac5386 100644 --- a/grub.patches +++ b/grub.patches @@ -190,3 +190,5 @@ Patch0189: 0189-don-t-use-int-for-efi-status.patch Patch0190: 0190-make-GRUB_MOD_INIT-declare-its-function-prototypes.patch Patch0191: 0191-Clean-up-some-errors-in-the-linuxefi-loader.patch Patch0192: 0192-editenv-handle-relative-symlinks.patch +Patch0193: 0193-Make-libgrub.pp-depend-on-config-util.h.patch +Patch0194: 0194-Don-t-guess-boot-efi-as-HFS-on-ppc-machines-in-grub-.patch diff --git a/grub2.spec b/grub2.spec index c9a24db..ae52d6c 100644 --- a/grub2.spec +++ b/grub2.spec @@ -54,7 +54,7 @@ BuildRequires: pesign >= 0.99-8 BuildRequires: ccache %endif -ExcludeArch: s390 s390x %{arm} %{?ix86} +ExcludeArch: s390 s390x %{arm} Obsoletes: %{name} <= %{evr} %if 0%{with_legacy_arch} @@ -490,8 +490,10 @@ fi %endif %changelog -* Tue Aug 22 2017 Peter Jones - 2.02-11 +* Wed Aug 23 2017 Peter Jones - 2.02-11 - Put grub2-mkimage in -tools, not -tools-extra. +- Fix i686 building +- Fix ppc HFS+ usage due to /boot/efi's presence. * Fri Aug 18 2017 Peter Jones - 2.02-10 - Add the .img files into grub2-pc-modules (and all legacy variants)