2017-08-14 22:03:55 +00:00
|
|
|
# vim:filetype=spec
|
|
|
|
# Modules always contain just 32-bit code
|
|
|
|
%global _libdir %{_exec_prefix}/lib
|
|
|
|
%global _binaries_in_noarch_packages_terminate_build 0
|
|
|
|
#%%undefine _missing_build_ids_terminate_build
|
|
|
|
%{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}}
|
|
|
|
%{expand:%%{!?_licensedir:%%global license %%%%doc}}
|
|
|
|
|
2017-08-17 16:48:25 +00:00
|
|
|
%global _configure ../configure
|
2017-08-16 21:46:08 +00:00
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%if %{?_with_ccache: 1}%{?!_with_ccache: 0}
|
2022-02-17 16:53:21 +00:00
|
|
|
%global ccpath /usr/%{_lib}/ccache/gcc
|
2017-08-14 22:03:55 +00:00
|
|
|
%else
|
2022-02-17 16:53:21 +00:00
|
|
|
%global ccpath %{__cc}
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
2022-02-17 16:53:21 +00:00
|
|
|
# gnulib actively ignores CFLAGS because it's terrible
|
|
|
|
%global cc_equals "CC=%{ccpath} -fPIE"
|
|
|
|
|
2017-08-16 21:04:58 +00:00
|
|
|
%global cflags_sed \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
sed \\\
|
|
|
|
-e 's/-O. //g' \\\
|
2022-02-25 22:25:36 +00:00
|
|
|
-e 's/-fplugin=annobin//g' \\\
|
|
|
|
-e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
-e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\
|
|
|
|
-e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\
|
|
|
|
-e 's/--param=ssp-buffer-size=4//g' \\\
|
|
|
|
-e 's/-mregparm=3/-mregparm=4/g' \\\
|
|
|
|
-e 's/-fexceptions//g' \\\
|
2021-02-08 18:41:49 +00:00
|
|
|
-e 's/-fcf-protection//g' \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
-e 's/-fasynchronous-unwind-tables//g' \\\
|
2017-08-16 21:04:58 +00:00
|
|
|
-e 's/^/ -fno-strict-aliasing /' \\\
|
|
|
|
%{nil}
|
|
|
|
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
|
|
|
|
%global legacy_host_cflags \\\
|
|
|
|
%{expand:%%(echo %{host_cflags} | \\\
|
2018-07-27 16:52:55 +00:00
|
|
|
%{cflags_sed} \\\
|
|
|
|
-e 's/-m64//g' \\\
|
|
|
|
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
|
|
|
)}
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
|
|
|
|
|
|
|
|
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
|
|
|
|
%global legacy_target_cflags \\\
|
|
|
|
%{expand:%%(echo %{target_cflags} | \\\
|
2017-08-16 21:04:58 +00:00
|
|
|
%{cflags_sed} \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
-e 's/-m64//g' \\\
|
|
|
|
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
2017-08-16 21:04:58 +00:00
|
|
|
)}
|
2018-07-27 16:52:55 +00:00
|
|
|
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
|
|
|
|
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
%global ldflags_sed \\\
|
|
|
|
sed \\\
|
2022-02-25 22:25:36 +00:00
|
|
|
-e 's,-specs=[[:alnum:]/_-]*annobin[[:alnum:]_-]*,,g' \\\
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
-e 's/^$//' \\\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%global host_ldflags %{expand:%%(echo %{build_ldflags} %{?_hardening_ldflags} | %{ldflags_sed})}
|
|
|
|
%global legacy_host_ldflags \\\
|
|
|
|
%{expand:%%(echo %{host_ldflags} | \\\
|
|
|
|
%{ldflags_sed} \\\
|
|
|
|
)}
|
|
|
|
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
|
|
|
|
|
|
|
%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})}
|
|
|
|
%global legacy_target_ldflags \\\
|
|
|
|
%{expand:%%(echo %{target_ldflags} | \\\
|
|
|
|
%{ldflags_sed} \\\
|
|
|
|
)}
|
|
|
|
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%global with_efi_arch 0
|
|
|
|
%global with_alt_efi_arch 0
|
|
|
|
%global with_legacy_arch 0
|
2019-04-30 08:32:46 +00:00
|
|
|
%global with_emu_arch 1
|
|
|
|
%global emuarch %{_arch}
|
2017-08-14 22:03:55 +00:00
|
|
|
%global grubefiarch %{nil}
|
|
|
|
%global grublegacyarch %{nil}
|
|
|
|
|
|
|
|
# sparc is always compiled 64 bit
|
|
|
|
%ifarch %{sparc}
|
|
|
|
%global target_cpu_name sparc64
|
|
|
|
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
|
%global legacy_target_cpu_name %{_arch}
|
|
|
|
%global legacy_package_arch ieee1275
|
|
|
|
%global platform ieee1275
|
|
|
|
%endif
|
|
|
|
# ppc is always compiled 64 bit
|
|
|
|
%ifarch ppc ppc64 ppc64le
|
2019-04-30 08:32:46 +00:00
|
|
|
# GRUB emu fails to build on ppc64le
|
|
|
|
%global with_emu_arch 0
|
2017-08-14 22:03:55 +00:00
|
|
|
%global target_cpu_name %{_arch}
|
|
|
|
%global legacy_target_cpu_name powerpc
|
|
|
|
%global legacy_package_arch %{_arch}
|
|
|
|
%global legacy_grub_dir powerpc-ieee1275
|
|
|
|
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
|
%global platform ieee1275
|
|
|
|
%endif
|
|
|
|
|
2017-08-23 20:50:11 +00:00
|
|
|
|
2019-08-23 20:38:09 +00:00
|
|
|
%global efi_only aarch64 %{arm} riscv64
|
2019-02-04 18:19:28 +00:00
|
|
|
%global efi_arch x86_64 ia64 %{efi_only}
|
2017-08-14 22:03:55 +00:00
|
|
|
%ifarch %{efi_arch}
|
|
|
|
%global with_efi_arch 1
|
|
|
|
%else
|
|
|
|
%global with_efi_arch 0
|
|
|
|
%endif
|
|
|
|
%ifarch %{efi_only}
|
|
|
|
%global with_efi_only 1
|
|
|
|
%else
|
|
|
|
%global with_efi_only 0
|
|
|
|
%endif
|
|
|
|
%{!?with_efi_arch:%global without_efi_arch 0}
|
|
|
|
%{?with_efi_arch:%global without_efi_arch 1}
|
|
|
|
%{!?with_efi_only:%global without_efi_only 0}
|
|
|
|
%{?with_efi_only:%global without_efi_only 1}
|
|
|
|
|
|
|
|
### fixme
|
2019-08-23 20:38:09 +00:00
|
|
|
%ifarch aarch64 %{arm} riscv64
|
2018-07-11 19:52:37 +00:00
|
|
|
%global efi_modules " "
|
2017-08-14 22:03:55 +00:00
|
|
|
%else
|
2022-02-28 19:02:46 +00:00
|
|
|
%global efi_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard connectefi "
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
2019-08-23 20:38:09 +00:00
|
|
|
%ifarch aarch64 %{arm} riscv64
|
2017-09-20 19:27:19 +00:00
|
|
|
%global legacy_provides -l
|
|
|
|
%endif
|
|
|
|
|
2018-01-18 19:03:23 +00:00
|
|
|
%ifarch %{ix86}
|
|
|
|
%global efiarch ia32
|
|
|
|
%global target_cpu_name i386
|
|
|
|
%global grub_target_name i386-efi
|
|
|
|
%global package_arch efi-ia32
|
|
|
|
|
|
|
|
%global legacy_target_cpu_name i386
|
|
|
|
%global legacy_package_arch pc
|
|
|
|
%global platform pc
|
|
|
|
%endif
|
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%ifarch x86_64
|
|
|
|
%global efiarch x64
|
|
|
|
%global target_cpu_name %{_arch}
|
|
|
|
%global grub_target_name %{_arch}-efi
|
|
|
|
%global package_arch efi-x64
|
|
|
|
|
|
|
|
%global legacy_target_cpu_name i386
|
|
|
|
%global legacy_package_arch pc
|
|
|
|
%global platform pc
|
|
|
|
|
|
|
|
%global alt_efi_arch ia32
|
|
|
|
%global alt_target_cpu_name i386
|
|
|
|
%global alt_grub_target_name i386-efi
|
|
|
|
%global alt_platform efi
|
|
|
|
%global alt_package_arch efi-ia32
|
2018-07-27 16:52:55 +00:00
|
|
|
|
|
|
|
%global alt_efi_host_cflags %{expand:%%(echo %{efi_host_cflags})}
|
|
|
|
%global alt_efi_target_cflags \\\
|
|
|
|
%{expand:%%(echo %{target_cflags} | \\\
|
2017-08-16 21:04:58 +00:00
|
|
|
%{cflags_sed} \\\
|
|
|
|
-e 's/-m64//g' \\\
|
|
|
|
)}
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%ifarch aarch64
|
2019-04-30 08:32:46 +00:00
|
|
|
%global emuarch arm64
|
2017-08-14 22:03:55 +00:00
|
|
|
%global efiarch aa64
|
|
|
|
%global target_cpu_name aarch64
|
|
|
|
%global grub_target_name arm64-efi
|
|
|
|
%global package_arch efi-aa64
|
|
|
|
%endif
|
|
|
|
|
2019-08-23 20:38:09 +00:00
|
|
|
%ifarch riscv64
|
|
|
|
%global emuarch riscv64
|
|
|
|
%global efiarch riscv64
|
|
|
|
%global target_cpu_name riscv64
|
|
|
|
%global grub_target_name riscv64-efi
|
|
|
|
%global package_arch efi-riscv64
|
|
|
|
%endif
|
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%ifarch %{arm}
|
|
|
|
%global efiarch arm
|
|
|
|
%global target_cpu_name arm
|
|
|
|
%global grub_target_name arm-efi
|
|
|
|
%global package_arch efi-arm
|
2018-07-27 16:52:55 +00:00
|
|
|
%global efi_target_cflags \\\
|
|
|
|
%{expand:%%(echo %{optflags} | \\\
|
|
|
|
%{cflags_sed} \\\
|
|
|
|
-e 's/-march=armv7-a[[:alnum:]+-]*/&+nofp/g' \\\
|
|
|
|
-e 's/-mfpu=[[:alnum:]-]\\+//g' \\\
|
|
|
|
-e 's/-mfloat-abi=[[:alpha:]]\\+/-mfloat-abi=soft/g' \\\
|
|
|
|
)}
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
|
%global _alt_target_platform %{alt_target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
|
|
|
|
|
%ifarch %{efi_arch}
|
|
|
|
%global with_efi_arch 1
|
|
|
|
%global grubefiname grub%{efiarch}.efi
|
|
|
|
%global grubeficdname gcd%{efiarch}.efi
|
|
|
|
%global grubefiarch %{target_cpu_name}-efi
|
2018-01-18 19:03:23 +00:00
|
|
|
%ifarch %{ix86}
|
|
|
|
%global with_efi_modules 0
|
|
|
|
%global without_efi_modules 1
|
|
|
|
%else
|
|
|
|
%global with_efi_modules 1
|
|
|
|
%global without_efi_modules 0
|
|
|
|
%endif
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%if 0%{?alt_efi_arch:1}
|
|
|
|
%global with_alt_efi_arch 1
|
|
|
|
%global grubaltefiname grub%{alt_efi_arch}.efi
|
|
|
|
%global grubalteficdname gcd%{alt_efi_arch}.efi
|
|
|
|
%global grubaltefiarch %{alt_target_cpu_name}-efi
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%ifnarch %{efi_only}
|
|
|
|
%global with_legacy_arch 1
|
|
|
|
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
|
|
|
|
%global moduledir %{legacy_target_cpu_name}-%{platform}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%global evr %{epoch}:%{version}-%{release}
|
|
|
|
|
2017-08-23 20:50:11 +00:00
|
|
|
%ifarch x86_64
|
2017-08-14 22:03:55 +00:00
|
|
|
%global with_efi_common 1
|
2022-03-31 21:23:48 +00:00
|
|
|
%global with_legacy_modules 1
|
|
|
|
%global with_legacy_common 1
|
2017-08-23 20:50:11 +00:00
|
|
|
%else
|
|
|
|
%global with_efi_common 0
|
|
|
|
%global with_legacy_common 1
|
|
|
|
%global with_legacy_modules 1
|
2017-08-14 22:03:55 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%define define_legacy_variant() \
|
|
|
|
%{expand:%%package %%{1}} \
|
|
|
|
Summary: Bootloader with support for Linux, Multiboot, and more \
|
2017-08-25 17:31:30 +00:00
|
|
|
Provides: %{name} = %{evr} \
|
2017-09-06 22:26:03 +00:00
|
|
|
Obsoletes: %{name} < %{evr} \
|
2017-08-14 22:03:55 +00:00
|
|
|
Requires: %{name}-common = %{evr} \
|
|
|
|
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
|
Requires: %{name}-%{1}-modules = %{evr} \
|
|
|
|
Requires: gettext which file \
|
|
|
|
Requires: %{name}-tools = %{evr} \
|
|
|
|
Requires(pre): dracut \
|
|
|
|
Requires(post): dracut \
|
|
|
|
%{expand:%%description %%{1}} \
|
|
|
|
%{desc} \
|
2018-11-28 00:00:07 +00:00
|
|
|
This subpackage provides support for %{1} systems. \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
|
|
|
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
2017-08-23 20:50:11 +00:00
|
|
|
%{expand:%%if 0%%{with_legacy_modules} \
|
|
|
|
%%package %%{1}-modules \
|
2017-08-14 22:03:55 +00:00
|
|
|
Summary: Modules used to build custom grub images \
|
|
|
|
BuildArch: noarch \
|
2017-08-23 20:50:11 +00:00
|
|
|
Requires: %%{name}-common = %%{evr} \
|
|
|
|
%%description %%{1}-modules \
|
|
|
|
%%{desc} \
|
2017-08-14 22:03:55 +00:00
|
|
|
This subpackage provides support for rebuilding your own grub.efi. \
|
2017-08-23 20:50:11 +00:00
|
|
|
%%endif \
|
|
|
|
} \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
|
|
|
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
|
|
|
%{expand:%%package %%{1}-tools} \
|
|
|
|
Summary: Support tools for GRUB. \
|
|
|
|
Requires: gettext os-prober which file system-logos \
|
|
|
|
Requires: %{name}-common = %{evr} \
|
|
|
|
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
|
Requires: os-prober >= 1.58-11 \
|
|
|
|
Requires: gettext which file \
|
|
|
|
\
|
|
|
|
%{expand:%%description %%{1}-tools} \
|
|
|
|
%{desc} \
|
|
|
|
This subpackage provides tools for support of %%{1} platforms. \
|
|
|
|
%{nil}
|
|
|
|
|
2017-08-25 17:31:30 +00:00
|
|
|
%define define_efi_variant(o) \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%package %{1}} \
|
|
|
|
Summary: GRUB for EFI systems. \
|
2018-07-11 19:52:37 +00:00
|
|
|
Requires: efi-filesystem \
|
2017-08-14 22:03:55 +00:00
|
|
|
Requires: %{name}-common = %{evr} \
|
|
|
|
Requires: %{name}-tools-minimal >= %{evr} \
|
|
|
|
Requires: %{name}-tools = %{evr} \
|
2017-08-25 17:31:30 +00:00
|
|
|
Provides: %{name}-efi = %{evr} \
|
2017-09-20 19:27:19 +00:00
|
|
|
%{?legacy_provides:Provides: %{name} = %{evr}} \
|
2017-08-25 17:31:30 +00:00
|
|
|
%{-o:Obsoletes: %{name}-efi < %{evr}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
|
|
|
%{expand:%%description %{1}} \
|
|
|
|
%{desc} \
|
|
|
|
This subpackage provides support for %{1} systems. \
|
|
|
|
\
|
|
|
|
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
|
2018-01-18 19:03:23 +00:00
|
|
|
%{expand:%if 0%{?with_efi_modules} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%package %{1}-modules} \
|
|
|
|
Summary: Modules used to build custom grub.efi images \
|
|
|
|
BuildArch: noarch \
|
|
|
|
Requires: %{name}-common = %{evr} \
|
2018-01-18 19:03:23 +00:00
|
|
|
Provides: %{name}-efi-modules = %{evr} \
|
|
|
|
Obsoletes: %{name}-efi-modules < %{evr} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%description %{1}-modules} \
|
|
|
|
%{desc} \
|
|
|
|
This subpackage provides support for rebuilding your own grub.efi. \
|
2018-01-18 19:03:23 +00:00
|
|
|
%endif} \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
|
|
|
%{expand:%%package %{1}-cdboot} \
|
|
|
|
Summary: Files used to boot removeable media with EFI \
|
|
|
|
Requires: %{name}-common = %{evr} \
|
2017-08-25 17:31:30 +00:00
|
|
|
Provides: %{name}-efi-cdboot = %{evr} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%description %{1}-cdboot} \
|
|
|
|
%{desc} \
|
|
|
|
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%global do_common_setup() \
|
|
|
|
%setup -q -n grub-%{tarversion} \
|
|
|
|
rm -fv docs/*.info \
|
|
|
|
cp %{SOURCE6} .gitignore \
|
2019-08-15 06:01:31 +00:00
|
|
|
cp %{SOURCE7} bootstrap \
|
|
|
|
cp %{SOURCE8} bootstrap.conf \
|
|
|
|
cp %{SOURCE9} ./grub-core/tests/strtoull_test.c \
|
2019-09-26 16:49:22 +00:00
|
|
|
cp %{SOURCE2} gnulib-%{gnulibversion}.tar.gz \
|
2019-08-15 06:01:31 +00:00
|
|
|
tar -zxf gnulib-%{gnulibversion}.tar.gz \
|
|
|
|
mv gnulib-%{gnulibversion} gnulib \
|
2017-08-14 22:03:55 +00:00
|
|
|
git init \
|
|
|
|
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \
|
|
|
|
echo '!*.[[:digit:]]' > util/.gitignore \
|
|
|
|
echo '!config.h' > include/grub/emu/.gitignore \
|
|
|
|
git config user.email "%{name}-owner@fedoraproject.org" \
|
|
|
|
git config user.name "Fedora Ninjas" \
|
|
|
|
git config gc.auto 0 \
|
2018-07-27 16:40:14 +00:00
|
|
|
rm -f configure \
|
2017-08-14 22:03:55 +00:00
|
|
|
git add . \
|
|
|
|
git commit -a -q -m "%{tarversion} baseline." \
|
2018-07-27 16:57:04 +00:00
|
|
|
git am --whitespace=nowarn %%{patches} </dev/null \
|
2022-02-17 16:53:21 +00:00
|
|
|
rm -r build-aux m4 \
|
2019-08-15 06:01:31 +00:00
|
|
|
./bootstrap \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_efi_configure() \
|
|
|
|
%configure \\\
|
|
|
|
%{cc_equals} \\\
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
HOST_CFLAGS="%{3}" \\\
|
|
|
|
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
|
HOST_LDFLAGS="%{efi_host_ldflags}" \\\
|
|
|
|
TARGET_CFLAGS="%{2}" \\\
|
|
|
|
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
|
TARGET_LDFLAGS="%{efi_target_ldflags}" \\\
|
2018-07-27 16:48:09 +00:00
|
|
|
--with-platform=efi \\\
|
2018-07-27 16:52:55 +00:00
|
|
|
--with-utils=host \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
--target=%{1} \\\
|
|
|
|
--with-grubdir=%{name} \\\
|
2018-07-27 16:48:09 +00:00
|
|
|
--program-transform-name=s,grub,%{name}, \\\
|
2018-06-26 20:01:03 +00:00
|
|
|
--disable-werror || ( cat config.log ; exit 1 ) \
|
2018-07-31 18:39:54 +00:00
|
|
|
git add . \
|
|
|
|
git commit -m "After efi configure" \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_efi_build_modules() \
|
|
|
|
make %{?_smp_mflags} ascii.h widthspec.h \
|
|
|
|
make %{?_smp_mflags} -C grub-core \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_efi_build_all() \
|
|
|
|
make %{?_smp_mflags} \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_efi_link_utils() \
|
|
|
|
for x in grub-mkimage ; do \\\
|
|
|
|
ln ../grub-%{1}-%{tarversion}/${x} ./ ; \\\
|
|
|
|
done \
|
|
|
|
%{nil}
|
|
|
|
|
2020-12-30 18:31:02 +00:00
|
|
|
%define do_install_protected_file() \
|
|
|
|
touch %{1}.conf \
|
|
|
|
echo %{1} > %{1}.conf \
|
|
|
|
install -d -m 755 ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \
|
|
|
|
install -m 644 %{1}.conf ${RPM_BUILD_ROOT}/etc/dnf/protected.d/ \
|
|
|
|
rm -f %{1}.conf \
|
|
|
|
%{nil}
|
|
|
|
|
2019-08-23 20:38:09 +00:00
|
|
|
%ifarch x86_64 aarch64 %{arm} riscv64
|
2017-08-14 22:03:55 +00:00
|
|
|
%define mkimage() \
|
|
|
|
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
|
2021-03-12 21:54:28 +00:00
|
|
|
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \\\
|
|
|
|
--sbat %{4}./sbat.csv \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
|
2021-03-12 21:54:28 +00:00
|
|
|
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \\\
|
|
|
|
--sbat %{4}./sbat.csv \
|
2020-08-10 21:47:38 +00:00
|
|
|
%{expand:%%define ___pesign_client_cert %{?___pesign_client_cert}%{!?___pesign_client_cert:%{__pesign_client_cert}}} \
|
|
|
|
%{?__pesign_client_cert:%{expand:%%define __pesign_client_cert %{___pesign_client_cert}}} \
|
|
|
|
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.onesig -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
|
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.onesig -a %%{5} -c %%{6} -n %%{7}}} \
|
2021-10-07 21:38:20 +00:00
|
|
|
%{expand:%%define __pesign_client_cert grub2-signer} \
|
2020-08-10 21:47:38 +00:00
|
|
|
%{expand:%%{pesign -s -i %%{2}.onesig -o %%{2} -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
|
%{expand:%%{pesign -s -i %%{3}.onesig -o %%{3} -a %%{5} -c %%{6} -n %%{7}}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
%else
|
|
|
|
%define mkimage() \
|
|
|
|
%{4}./grub-mkimage -O %{1} -o %{2} \\\
|
2018-07-11 19:52:37 +00:00
|
|
|
-p /EFI/%{efi_vendor} -d grub-core ${GRUB_MODULES} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{4}./grub-mkimage -O %{1} -o %{3} \\\
|
|
|
|
-p /EFI/BOOT -d grub-core ${GRUB_MODULES} \
|
|
|
|
%{nil}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%define do_efi_build_images() \
|
2018-03-06 19:46:09 +00:00
|
|
|
GRUB_MODULES=" all_video boot blscfg btrfs \\\
|
2019-06-17 01:32:32 +00:00
|
|
|
cat configfile cryptodisk \\\
|
2021-02-09 22:37:58 +00:00
|
|
|
echo efi_netfs efifwsetup efinet ext2 f2fs \\\
|
2019-06-17 01:32:32 +00:00
|
|
|
fat font gcry_rijndael gcry_rsa gcry_serpent \\\
|
|
|
|
gcry_sha256 gcry_twofish gcry_whirlpool \\\
|
2019-08-15 06:01:31 +00:00
|
|
|
gfxmenu gfxterm gzio \\\
|
2018-10-04 21:11:21 +00:00
|
|
|
halt hfsplus http increment iso9660 jpeg \\\
|
2019-06-17 01:32:32 +00:00
|
|
|
loadenv loopback linux lvm lsefi lsefimmap luks \\\
|
2021-06-17 01:24:42 +00:00
|
|
|
luks2 mdraid09 mdraid1x minicmd net \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
normal part_apple part_msdos part_gpt \\\
|
2022-04-13 15:13:22 +00:00
|
|
|
password_pbkdf2 pgp png read reboot \\\
|
2019-08-07 19:57:46 +00:00
|
|
|
regexp search search_fs_uuid search_fs_file \\\
|
2018-07-11 19:52:37 +00:00
|
|
|
search_label serial sleep syslinuxcfg test tftp \\\
|
2020-05-18 08:39:14 +00:00
|
|
|
version video xfs zstd " \
|
2017-08-14 22:03:55 +00:00
|
|
|
GRUB_MODULES+=%{efi_modules} \
|
|
|
|
%{expand:%%{mkimage %{1} %{2} %{3} %{4}}} \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_primary_efi_build() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
2018-07-27 16:52:55 +00:00
|
|
|
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%do_efi_build_all \
|
|
|
|
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./ } \
|
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_alt_efi_build() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
2018-07-27 16:52:55 +00:00
|
|
|
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%do_efi_build_modules \
|
|
|
|
%{expand:%%do_efi_link_utils %{grubefiarch}} \
|
|
|
|
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../grub-%{grubefiarch}-%{tarversion}/ } \
|
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_legacy_build() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
|
|
|
%configure \\\
|
|
|
|
%{cc_equals} \\\
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
HOST_CFLAGS="%{legacy_host_cflags}" \\\
|
|
|
|
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
|
HOST_LDFLAGS="%{legacy_host_ldflags}" \\\
|
|
|
|
TARGET_CFLAGS="%{legacy_target_cflags}" \\\
|
|
|
|
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
|
TARGET_LDFLAGS="%{legacy_target_ldflags}" \\\
|
2018-07-27 16:48:09 +00:00
|
|
|
--with-platform=%{platform} \\\
|
2018-07-27 16:52:55 +00:00
|
|
|
--with-utils=host \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
--target=%{_target_platform} \\\
|
|
|
|
--with-grubdir=%{name} \\\
|
2018-07-27 16:48:09 +00:00
|
|
|
--program-transform-name=s,grub,%{name}, \\\
|
2018-06-26 20:01:03 +00:00
|
|
|
--disable-werror || ( cat config.log ; exit 1 ) \
|
2018-07-31 18:39:54 +00:00
|
|
|
git add . \
|
Fix HOST_LDFLAGS to include the hardening flags.
rpmdiff noticed the following:
Detecting usr/sbin/grub2-ofpathname with not-hardened warnings '
Hardened: grub2-ofpathname: FAIL: Gaps were detected in the annobin coverage. Run with -v to list.
Hardened: grub2-ofpathname: FAIL: Not linked with -Wl,-z,now.
Hardened: grub2-ofpathname: MAYB: The PIC/PIE setting was not recorded.
Hardened: grub2-ofpathname: FAIL: Not linked as a position independent executable (ie need to add '-pie' to link command line).
' on ppc64le
This is because while we made the CFLAGS get some new options, LDFLAGS never
got the same treatement, and we disabled %{_hardened_build} to avoid getting
its options in the TARGET_{C,LD}FLAGS variables.
This patch duplicates the infrastructure for {HOST,TARGET}_CFLAGS into
{HOST,TARGET}_LDFLAGS, and adds the %{_hardening_ldflags} and
%{_hardening_cflags} to both HOST_{C,LD}FLAGS.
Additionally, it fixes the CPPFLAGS definitions, since rpm doesn't define any
CPPFLAGS at all, and makes the -I$(pwd) be there exclusively, not on CFLAGS as
well, since they're always used in concert.
Signed-off-by: Peter Jones <pjones@redhat.com>
2019-05-23 17:51:07 +00:00
|
|
|
git commit -m "After legacy configure" \
|
2017-08-14 22:03:55 +00:00
|
|
|
make %{?_smp_mflags} \
|
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
2019-04-30 08:32:46 +00:00
|
|
|
%define do_emu_build() \
|
|
|
|
cd grub-emu-%{tarversion} \
|
|
|
|
%configure \\\
|
|
|
|
%{cc_equals} \\\
|
2021-03-24 08:19:08 +00:00
|
|
|
HOST_CFLAGS="%{legacy_host_cflags}" \\\
|
|
|
|
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
|
HOST_LDFLAGS="%{legacy_host_ldflags}" \\\
|
2019-04-30 08:32:46 +00:00
|
|
|
--with-platform=emu \\\
|
|
|
|
--with-grubdir=%{name} \\\
|
|
|
|
--program-transform-name=s,grub,%{name}, \\\
|
|
|
|
--disable-werror || ( cat config.log ; exit 1 ) \
|
|
|
|
git add . \
|
|
|
|
git commit -m "After emu configure" \
|
|
|
|
make %{?_smp_mflags} ascii.h widthspec.h \
|
2019-08-15 06:01:31 +00:00
|
|
|
make %{?_smp_mflags} -C grub-core/lib/gnulib \
|
2019-04-30 08:32:46 +00:00
|
|
|
make %{?_smp_mflags} -C grub-core \
|
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%define do_alt_efi_install() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
2018-06-26 15:25:18 +00:00
|
|
|
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
|
2017-08-14 22:03:55 +00:00
|
|
|
find . '(' -iname gdb_grub \\\
|
|
|
|
-o -iname kernel.exec \\\
|
|
|
|
-o -iname kernel.img \\\
|
|
|
|
-o -iname config.h \\\
|
|
|
|
-o -iname gmodule.pl \\\
|
|
|
|
-o -iname modinfo.sh \\\
|
|
|
|
-o -iname '*.lst' \\\
|
|
|
|
-o -iname '*.mod' \\\
|
|
|
|
')' \\\
|
|
|
|
-exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \
|
2017-08-30 14:11:43 +00:00
|
|
|
find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \
|
2018-07-11 19:52:37 +00:00
|
|
|
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
|
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
2020-12-30 18:31:02 +00:00
|
|
|
%{expand:%%do_install_protected_file %{name}-%{alt_package_arch}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_efi_install() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
|
|
|
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
|
fi \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
|
fi \
|
|
|
|
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \
|
2021-02-08 18:50:49 +00:00
|
|
|
ln -s ../boot/%{name}/grub.cfg \\\
|
2017-08-14 22:03:55 +00:00
|
|
|
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \
|
2018-07-11 19:52:37 +00:00
|
|
|
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
|
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
2020-06-05 10:52:02 +00:00
|
|
|
%ifarch %{arm} \
|
|
|
|
install -D -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_boot}/BOOTARM.EFI \
|
|
|
|
%endif \
|
2018-06-26 15:25:18 +00:00
|
|
|
install -D -m 700 unicode.pf2 \\\
|
2021-06-29 13:43:43 +00:00
|
|
|
${RPM_BUILD_ROOT}/boot/%{name}/fonts/unicode.pf2 \
|
2018-07-11 19:52:37 +00:00
|
|
|
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
2021-02-08 18:50:49 +00:00
|
|
|
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
|
2020-12-30 18:31:02 +00:00
|
|
|
%{expand:%%do_install_protected_file %{name}-%{package_arch}} \
|
2017-08-14 22:03:55 +00:00
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define do_legacy_install() \
|
|
|
|
cd grub-%{1}-%{tarversion} \
|
|
|
|
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
|
fi \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
|
fi \
|
2021-10-07 21:38:20 +00:00
|
|
|
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
|
|
|
|
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
|
|
|
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
2017-08-14 22:03:55 +00:00
|
|
|
fi \
|
2018-07-11 19:52:37 +00:00
|
|
|
if [ %{3} -eq 0 ]; then \
|
|
|
|
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
|
|
|
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
|
|
|
|
fi \
|
2020-12-30 18:31:02 +00:00
|
|
|
%{expand:%%do_install_protected_file %{name}-%{legacy_package_arch}} \
|
2017-08-16 21:04:58 +00:00
|
|
|
cd .. \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
|
2019-04-30 08:32:46 +00:00
|
|
|
%define do_emu_install() \
|
|
|
|
cd grub-emu-%{tarversion} \
|
|
|
|
make DESTDIR=$RPM_BUILD_ROOT install -C grub-core \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
|
fi \
|
|
|
|
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
|
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
|
fi \
|
2021-10-07 21:38:20 +00:00
|
|
|
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
|
|
|
|
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
2019-04-30 08:32:46 +00:00
|
|
|
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
|
|
|
fi \
|
|
|
|
cd .. \
|
|
|
|
%{nil}
|
|
|
|
|
2017-08-14 22:03:55 +00:00
|
|
|
%define do_common_install() \
|
|
|
|
install -d -m 0755 \\\
|
|
|
|
$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
|
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \\\
|
|
|
|
$RPM_BUILD_ROOT%{_infodir}/ \
|
|
|
|
cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
|
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \
|
|
|
|
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
|
|
|
|
cp docs/grub-dev.info \\\
|
|
|
|
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
|
2018-07-11 19:52:37 +00:00
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
|
2021-10-07 21:38:20 +00:00
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
|
2018-07-17 20:46:37 +00:00
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \
|
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
|
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
|
|
|
|
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
|
2017-08-14 22:03:55 +00:00
|
|
|
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \
|
|
|
|
ln -sf ../default/grub \\\
|
|
|
|
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
|
|
|
|
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
|
2021-02-08 18:50:49 +00:00
|
|
|
ln -s ../boot/%{name}/grub.cfg \\\
|
2021-10-07 21:38:20 +00:00
|
|
|
${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define define_legacy_variant_files() \
|
|
|
|
%{expand:%%files %{1}} \
|
|
|
|
%defattr(-,root,root,-) \
|
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}.cfg \
|
|
|
|
%ghost %config(noreplace) /boot/%{name}/grub.cfg \
|
2018-04-03 17:41:24 +00:00
|
|
|
%dir %attr(0700,root,root)/boot/loader/entries \
|
2020-12-30 18:31:02 +00:00
|
|
|
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
2017-08-23 20:50:11 +00:00
|
|
|
%{expand:%if 0%{?with_legacy_modules} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%files %{1}-modules} \
|
|
|
|
%defattr(-,root,root) \
|
|
|
|
%dir %{_libdir}/grub/%{2}/ \
|
|
|
|
%{_libdir}/grub/%{2}/* \
|
|
|
|
%exclude %{_libdir}/grub/%{2}/*.module \
|
2017-08-18 21:34:33 +00:00
|
|
|
%exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \
|
2017-08-14 22:03:55 +00:00
|
|
|
%exclude %{_libdir}/grub/%{2}/*.o \
|
2017-08-23 20:50:11 +00:00
|
|
|
%else \
|
|
|
|
%%exclude %%{_libdir}/grub/%%{grublegacyarch}/* \
|
|
|
|
%endif} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|
|
|
|
|
|
|
|
%define define_efi_variant_files() \
|
|
|
|
%{expand:%%files %{1}} \
|
2021-06-29 14:07:43 +00:00
|
|
|
%defattr(-,root,root,-) \
|
2021-02-08 18:50:49 +00:00
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}.cfg \
|
2017-08-14 22:03:55 +00:00
|
|
|
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \
|
2018-07-11 19:52:37 +00:00
|
|
|
%attr(0700,root,root)%{efi_esp_dir}/%{2} \
|
2020-06-05 10:52:02 +00:00
|
|
|
%ifarch %{arm} \
|
|
|
|
%attr(0700,root,root)%{efi_esp_boot}/BOOTARM.EFI \
|
|
|
|
%endif \
|
2021-06-29 13:43:43 +00:00
|
|
|
%attr(0700,root,root)/boot/%{name}/fonts \
|
2018-07-17 20:46:37 +00:00
|
|
|
%dir %attr(0700,root,root)/boot/loader/entries \
|
2021-02-08 18:50:49 +00:00
|
|
|
%ghost %config(noreplace) /boot/%{name}/grub.cfg \
|
2018-07-11 19:52:37 +00:00
|
|
|
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
|
2021-10-07 21:38:20 +00:00
|
|
|
%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \
|
2020-12-30 18:31:02 +00:00
|
|
|
%attr(0644,root,root) %config(noreplace) /etc/dnf/protected.d/%{name}-%{1}.conf \
|
2018-01-18 19:03:23 +00:00
|
|
|
%{expand:%if 0%{?without_efi_modules} \
|
|
|
|
%exclude %{_libdir}/grub/%{6} \
|
|
|
|
%exclude %{_libdir}/grub/%{6}/* \
|
|
|
|
%endif} \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
2018-01-18 19:03:23 +00:00
|
|
|
%{expand:%if 0%{?with_efi_modules} \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{expand:%%files %{1}-modules} \
|
|
|
|
%defattr(-,root,root,-) \
|
|
|
|
%dir %{_libdir}/grub/%{6}/ \
|
|
|
|
%{_libdir}/grub/%{6}/* \
|
|
|
|
%exclude %{_libdir}/grub/%{6}/*.module \
|
2018-01-18 19:03:23 +00:00
|
|
|
%endif} \
|
2017-08-14 22:03:55 +00:00
|
|
|
\
|
|
|
|
%{expand:%%files %{1}-cdboot} \
|
2021-06-29 14:07:43 +00:00
|
|
|
%defattr(-,root,root,-) \
|
2018-08-07 15:19:35 +00:00
|
|
|
%attr(0700,root,root)%{efi_esp_dir}/%{3} \
|
2021-06-29 13:43:43 +00:00
|
|
|
%attr(0700,root,root)/boot/%{name}/fonts \
|
2017-08-14 22:03:55 +00:00
|
|
|
%{nil}
|