|
|
8631a2 |
# vim:filetype=spec
|
|
|
8631a2 |
# Modules always contain just 32-bit code
|
|
|
8631a2 |
%global _libdir %{_exec_prefix}/lib
|
|
|
8631a2 |
%global _binaries_in_noarch_packages_terminate_build 0
|
|
|
8631a2 |
#%%undefine _missing_build_ids_terminate_build
|
|
|
8631a2 |
%{expand:%%{!?buildsubdir:%%global buildsubdir grub-%{tarversion}}}
|
|
|
8631a2 |
%{expand:%%{!?_licensedir:%%global license %%%%doc}}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global _configure ../configure
|
|
|
8631a2 |
|
|
|
8631a2 |
%if %{?_with_ccache: 1}%{?!_with_ccache: 0}
|
|
|
8631a2 |
%global cc_equals CC=/usr/%{_lib}/ccache/gcc
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global cc_equals %{nil}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global cflags_sed \\\
|
|
|
8631a2 |
sed \\\
|
|
|
8631a2 |
-e 's/-O. //g' \\\
|
|
|
8631a2 |
-e 's/-fplugin=annobin //g' \\\
|
|
|
8631a2 |
-e 's,-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ,,g' \\\
|
|
|
8631a2 |
-e 's/-fstack-protector[[:alpha:]-]\\+//g' \\\
|
|
|
8631a2 |
-e 's/-Wp,-D_FORTIFY_SOURCE=[[:digit:]]\\+//g' \\\
|
|
|
8631a2 |
-e 's/--param=ssp-buffer-size=4//g' \\\
|
|
|
8631a2 |
-e 's/-mregparm=3/-mregparm=4/g' \\\
|
|
|
8631a2 |
-e 's/-fexceptions//g' \\\
|
|
|
8631a2 |
-e 's/-fasynchronous-unwind-tables//g' \\\
|
|
|
8631a2 |
-e 's/^/ -fno-strict-aliasing /' \\\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
|
|
|
8631a2 |
%global host_cflags %{expand:%%(echo %{build_cflags} %{?_hardening_cflags} | %{cflags_sed})}
|
|
|
8631a2 |
%global legacy_host_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{host_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
|
|
|
8631a2 |
%global legacy_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global ldflags_sed \\\
|
|
|
8631a2 |
sed \\\
|
|
|
8631a2 |
-e 's/^$//' \\\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global host_ldflags %{expand:%%(echo %{build_ldflags} %{?_hardening_ldflags} | %{ldflags_sed})}
|
|
|
8631a2 |
%global legacy_host_ldflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{host_ldflags} | \\\
|
|
|
8631a2 |
%{ldflags_sed} \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global target_ldflags %{expand:%%(echo %{build_ldflags} -static | %{ldflags_sed})}
|
|
|
8631a2 |
%global legacy_target_ldflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_ldflags} | \\\
|
|
|
8631a2 |
%{ldflags_sed} \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global with_efi_arch 0
|
|
|
8631a2 |
%global with_alt_efi_arch 0
|
|
|
8631a2 |
%global with_legacy_arch 0
|
|
|
8631a2 |
%global grubefiarch %{nil}
|
|
|
8631a2 |
%global grublegacyarch %{nil}
|
|
|
4e7deb |
%global grubelfname %{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
# sparc is always compiled 64 bit
|
|
|
8631a2 |
%ifarch %{sparc}
|
|
|
8631a2 |
%global target_cpu_name sparc64
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global legacy_target_cpu_name %{_arch}
|
|
|
8631a2 |
%global legacy_package_arch ieee1275
|
|
|
8631a2 |
%global platform ieee1275
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
# ppc is always compiled 64 bit
|
|
|
8631a2 |
%ifarch ppc ppc64 ppc64le
|
|
|
8631a2 |
%global target_cpu_name %{_arch}
|
|
|
8631a2 |
%global legacy_target_cpu_name powerpc
|
|
|
8631a2 |
%global legacy_package_arch %{_arch}
|
|
|
8631a2 |
%global legacy_grub_dir powerpc-ieee1275
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global platform ieee1275
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
|
|
|
8631a2 |
%global efi_only aarch64 %{arm}
|
|
|
8631a2 |
%global efi_arch x86_64 ia64 %{efi_only}
|
|
|
8631a2 |
%ifarch %{efi_arch}
|
|
|
8631a2 |
%global with_efi_arch 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_arch 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%ifarch %{efi_only}
|
|
|
8631a2 |
%global with_efi_only 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_only 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%{!?with_efi_arch:%global without_efi_arch 0}
|
|
|
8631a2 |
%{?with_efi_arch:%global without_efi_arch 1}
|
|
|
8631a2 |
%{!?with_efi_only:%global without_efi_only 0}
|
|
|
8631a2 |
%{?with_efi_only:%global without_efi_only 1}
|
|
|
8631a2 |
|
|
|
4e7deb |
|
|
|
4e7deb |
%ifarch %{efi_arch}
|
|
|
7b86f2 |
%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi "
|
|
|
4e7deb |
%endif
|
|
|
4e7deb |
|
|
|
09e3cc |
%ifarch x86_64 %{ix86}
|
|
|
09e3cc |
%global platform_modules " backtrace chain usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard "
|
|
|
09e3cc |
%endif
|
|
|
09e3cc |
|
|
|
09e3cc |
%ifarch ppc64le
|
|
|
09e3cc |
%global platform_modules " appendedsig "
|
|
|
09e3cc |
%endif
|
|
|
09e3cc |
|
|
|
8631a2 |
%ifarch aarch64 %{arm}
|
|
|
8631a2 |
%global platform_modules " "
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
4e7deb |
|
|
|
8631a2 |
%ifarch aarch64 %{arm}
|
|
|
8631a2 |
%global legacy_provides -l
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{ix86}
|
|
|
8631a2 |
%global efiarch ia32
|
|
|
8631a2 |
%global target_cpu_name i386
|
|
|
8631a2 |
%global grub_target_name i386-efi
|
|
|
8631a2 |
%global package_arch efi-ia32
|
|
|
8631a2 |
|
|
|
8631a2 |
%global legacy_target_cpu_name i386
|
|
|
8631a2 |
%global legacy_package_arch pc
|
|
|
8631a2 |
%global platform pc
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch x86_64
|
|
|
8631a2 |
%global efiarch x64
|
|
|
8631a2 |
%global target_cpu_name %{_arch}
|
|
|
8631a2 |
%global grub_target_name %{_arch}-efi
|
|
|
8631a2 |
%global package_arch efi-x64
|
|
|
8631a2 |
|
|
|
8631a2 |
%global legacy_target_cpu_name i386
|
|
|
8631a2 |
%global legacy_package_arch pc
|
|
|
8631a2 |
%global platform pc
|
|
|
8631a2 |
|
|
|
8631a2 |
%global alt_efi_arch ia32
|
|
|
8631a2 |
%global alt_target_cpu_name i386
|
|
|
8631a2 |
%global alt_grub_target_name i386-efi
|
|
|
8631a2 |
%global alt_platform efi
|
|
|
8631a2 |
%global alt_package_arch efi-ia32
|
|
|
8631a2 |
|
|
|
8631a2 |
%global alt_efi_host_cflags %{expand:%%(echo %{efi_host_cflags})}
|
|
|
8631a2 |
%global alt_efi_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{target_cflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-m64//g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch aarch64
|
|
|
8631a2 |
%global efiarch aa64
|
|
|
8631a2 |
%global target_cpu_name aarch64
|
|
|
8631a2 |
%global grub_target_name arm64-efi
|
|
|
8631a2 |
%global package_arch efi-aa64
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{arm}
|
|
|
8631a2 |
%global efiarch arm
|
|
|
8631a2 |
%global target_cpu_name arm
|
|
|
8631a2 |
%global grub_target_name arm-efi
|
|
|
8631a2 |
%global package_arch efi-arm
|
|
|
8631a2 |
%global efi_target_cflags \\\
|
|
|
8631a2 |
%{expand:%%(echo %{optflags} | \\\
|
|
|
8631a2 |
%{cflags_sed} \\\
|
|
|
8631a2 |
-e 's/-march=armv7-a[[:alnum:]+-]*/&+nofp/g' \\\
|
|
|
8631a2 |
-e 's/-mfpu=[[:alnum:]-]\\+//g' \\\
|
|
|
8631a2 |
-e 's/-mfloat-abi=[[:alpha:]]\\+/-mfloat-abi=soft/g' \\\
|
|
|
8631a2 |
)}
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global _target_platform %{target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
%global _alt_target_platform %{alt_target_cpu_name}-%{_vendor}-%{_target_os}%{?_gnu}
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch %{efi_arch}
|
|
|
8631a2 |
%global with_efi_arch 1
|
|
|
8631a2 |
%global grubefiname grub%{efiarch}.efi
|
|
|
8631a2 |
%global grubeficdname gcd%{efiarch}.efi
|
|
|
8631a2 |
%global grubefiarch %{target_cpu_name}-efi
|
|
|
8631a2 |
%ifarch %{ix86}
|
|
|
8631a2 |
%global with_efi_modules 0
|
|
|
8631a2 |
%global without_efi_modules 1
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_modules 1
|
|
|
8631a2 |
%global without_efi_modules 0
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%if 0%{?alt_efi_arch:1}
|
|
|
8631a2 |
%global with_alt_efi_arch 1
|
|
|
8631a2 |
%global grubaltefiname grub%{alt_efi_arch}.efi
|
|
|
8631a2 |
%global grubalteficdname gcd%{alt_efi_arch}.efi
|
|
|
8631a2 |
%global grubaltefiarch %{alt_target_cpu_name}-efi
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifnarch %{efi_only}
|
|
|
8631a2 |
%global with_legacy_arch 1
|
|
|
8631a2 |
%global grublegacyarch %{legacy_target_cpu_name}-%{platform}
|
|
|
8631a2 |
%global moduledir %{legacy_target_cpu_name}-%{platform}
|
|
|
4e7deb |
%global grubelfname core.elf
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%global evr %{epoch}:%{version}-%{release}
|
|
|
8631a2 |
|
|
|
8631a2 |
%ifarch x86_64
|
|
|
8631a2 |
%global with_efi_common 1
|
|
|
8631a2 |
%global with_legacy_modules 0
|
|
|
8631a2 |
%global with_legacy_common 0
|
|
|
8631a2 |
%else
|
|
|
8631a2 |
%global with_efi_common 0
|
|
|
8631a2 |
%global with_legacy_common 1
|
|
|
8631a2 |
%global with_legacy_modules 1
|
|
|
8631a2 |
%endif
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_legacy_variant() \
|
|
|
8631a2 |
%{expand:%%package %%{1}} \
|
|
|
8631a2 |
Summary: Bootloader with support for Linux, Multiboot, and more \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Provides: %{name} = %{evr} \
|
|
|
8631a2 |
Obsoletes: %{name} < %{evr} \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-%{1}-modules = %{evr} \
|
|
|
8631a2 |
Requires: gettext which file \
|
|
|
8631a2 |
Requires: %{name}-tools-extra = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools = %{evr} \
|
|
|
8631a2 |
Requires(pre): dracut \
|
|
|
8631a2 |
Requires(post): dracut \
|
|
|
8631a2 |
%{expand:%%description %%{1}} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for %%{1} systems. \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%%if 0%%{with_legacy_modules} \
|
|
|
8631a2 |
%%package %%{1}-modules \
|
|
|
8631a2 |
Summary: Modules used to build custom grub images \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
BuildArch: noarch \
|
|
|
8631a2 |
Requires: %%{name}-common = %%{evr} \
|
|
|
8631a2 |
%%description %%{1}-modules \
|
|
|
8631a2 |
%%{desc} \
|
|
|
8631a2 |
This subpackage provides support for rebuilding your own grub.efi. \
|
|
|
8631a2 |
%%endif \
|
|
|
8631a2 |
} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%%package %%{1}-tools} \
|
|
|
8631a2 |
Summary: Support tools for GRUB. \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: gettext os-prober which file system-logos \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal = %{evr} \
|
|
|
8631a2 |
Requires: os-prober >= 1.58-11 \
|
|
|
8631a2 |
Requires: gettext which file \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%description %%{1}-tools} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides tools for support of %%{1} platforms. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_efi_variant(o) \
|
|
|
8631a2 |
%{expand:%%package %{1}} \
|
|
|
8631a2 |
Summary: GRUB for EFI systems. \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: efi-filesystem \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-minimal >= %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools-extra = %{evr} \
|
|
|
8631a2 |
Requires: %{name}-tools = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi = %{evr} \
|
|
|
8631a2 |
%{?legacy_provides:Provides: %{name} = %{evr}} \
|
|
|
8631a2 |
%{-o:Obsoletes: %{name}-efi < %{evr}} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%description %{1}} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for %{1} systems. \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
|
|
|
8631a2 |
%{expand:%if 0%{?with_efi_modules} \
|
|
|
8631a2 |
%{expand:%%package %{1}-modules} \
|
|
|
8631a2 |
Summary: Modules used to build custom grub.efi images \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
BuildArch: noarch \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi-modules = %{evr} \
|
|
|
8631a2 |
Obsoletes: %{name}-efi-modules < %{evr} \
|
|
|
8631a2 |
%{expand:%%description %{1}-modules} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides support for rebuilding your own grub.efi. \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%package %{1}-cdboot} \
|
|
|
8631a2 |
Summary: Files used to boot removeable media with EFI \
|
|
|
8631a2 |
Group: System Environment/Base \
|
|
|
8631a2 |
Requires: %{name}-common = %{evr} \
|
|
|
8631a2 |
Provides: %{name}-efi-cdboot = %{evr} \
|
|
|
8631a2 |
%{expand:%%description %{1}-cdboot} \
|
|
|
8631a2 |
%{desc} \
|
|
|
8631a2 |
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%global do_common_setup() \
|
|
|
8631a2 |
%setup -q -n grub-%{tarversion} \
|
|
|
8631a2 |
rm -fv docs/*.info \
|
|
|
8631a2 |
cp %{SOURCE6} .gitignore \
|
|
|
8631a2 |
cp %{SOURCE8} ./grub-core/tests/strtoull_test.c \
|
|
|
8631a2 |
git init \
|
|
|
8631a2 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore \
|
|
|
8631a2 |
echo '!*.[[:digit:]]' > util/.gitignore \
|
|
|
8631a2 |
echo '!config.h' > include/grub/emu/.gitignore \
|
|
|
8631a2 |
git config user.email "%{name}-owner@fedoraproject.org" \
|
|
|
8631a2 |
git config user.name "Fedora Ninjas" \
|
|
|
8631a2 |
git config gc.auto 0 \
|
|
|
8631a2 |
rm -f configure \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -a -q -m "%{tarversion} baseline." \
|
|
|
8631a2 |
git apply --index --whitespace=nowarn %{SOURCE3} \
|
|
|
8631a2 |
git commit -a -q -m "%{tarversion} master." \
|
|
|
8631a2 |
git am --whitespace=nowarn %%{patches}
|
|
|
8631a2 |
autoreconf -vi \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -a -q -m "autoreconf" \
|
|
|
8631a2 |
autoconf \
|
|
|
8631a2 |
PYTHON=python3 ./autogen.sh \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_configure() \
|
|
|
8631a2 |
%configure \\\
|
|
|
8631a2 |
%{cc_equals} \\\
|
|
|
8631a2 |
HOST_CFLAGS="%{3}" \\\
|
|
|
8631a2 |
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
HOST_LDFLAGS="%{efi_host_ldflags}" \\\
|
|
|
8631a2 |
TARGET_CFLAGS="%{2}" \\\
|
|
|
8631a2 |
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
TARGET_LDFLAGS="%{efi_target_ldflags}" \\\
|
|
|
8631a2 |
--with-platform=efi \\\
|
|
|
8631a2 |
--with-utils=host \\\
|
|
|
8631a2 |
--target=%{1} \\\
|
|
|
8631a2 |
--with-grubdir=%{name} \\\
|
|
|
8631a2 |
--program-transform-name=s,grub,%{name}, \\\
|
|
|
8631a2 |
--disable-grub-mount \\\
|
|
|
dbe756 |
--with-debug-timestamps \\\
|
|
|
dbe756 |
--enable-boot-time \\\
|
|
|
8631a2 |
--disable-werror || ( cat config.log ; exit 1 ) \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -m "After efi configure" \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_build_modules() \
|
|
|
8631a2 |
make %{?_smp_mflags} ascii.h widthspec.h \
|
|
|
8631a2 |
make %{?_smp_mflags} -C grub-core \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_build_all() \
|
|
|
8631a2 |
make %{?_smp_mflags} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_link_utils() \
|
|
|
8631a2 |
for x in grub-mkimage ; do \\\
|
|
|
8631a2 |
ln ../grub-%{1}-%{tarversion}/${x} ./ ; \\\
|
|
|
8631a2 |
done \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
4e7deb |
%global grub_modules " all_video boot blscfg btrfs \\\
|
|
|
4e7deb |
cat configfile cryptodisk echo ext2 \\\
|
|
|
4e7deb |
fat font gcry_rijndael gcry_rsa gcry_serpent \\\
|
|
|
4e7deb |
gcry_sha256 gcry_twofish gcry_whirlpool \\\
|
|
|
4e7deb |
gfxmenu gfxterm gzio halt hfsplus http \\\
|
|
|
4e7deb |
increment iso9660 jpeg loadenv loopback linux \\\
|
|
|
4e7deb |
lvm luks mdraid09 mdraid1x minicmd net \\\
|
|
|
4e7deb |
normal part_apple part_msdos part_gpt \\\
|
|
|
4e7deb |
password_pbkdf2 png reboot regexp search \\\
|
|
|
4e7deb |
search_fs_uuid search_fs_file search_label \\\
|
|
|
4e7deb |
serial sleep syslinuxcfg test tftp video xfs" \
|
|
|
4e7deb |
|
|
|
8631a2 |
%ifarch x86_64 aarch64 %{arm}
|
|
|
4e7deb |
%define efi_mkimage() \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{2}.orig \\\
|
|
|
4e7deb |
-p /EFI/%{efi_vendor} -d grub-core \\\
|
|
|
4e7deb |
--sbat %{4}./sbat.csv \\\
|
|
|
4e7deb |
${GRUB_MODULES} \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{3}.orig \\\
|
|
|
4e7deb |
-p /EFI/BOOT -d grub-core \\\
|
|
|
4e7deb |
--sbat %{4}./sbat.csv \\\
|
|
|
4e7deb |
${GRUB_MODULES} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{2}.orig -o %%{2}.one -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{3}.orig -o %%{3}.one -a %%{5} -c %%{6} -n %%{7}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{2}.one -o %%{2} -a %%{8} -c %%{9} -n %%{10}}} \
|
|
|
a4d572 |
%{expand:%%{pesign -s -i %%{3}.one -o %%{3} -a %%{8} -c %%{9} -n %%{10}}} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
%else
|
|
|
4e7deb |
%define efi_mkimage() \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{2} \\\
|
|
|
4e7deb |
-p /EFI/%{efi_vendor} -d grub-core \\\
|
|
|
4e7deb |
${GRUB_MODULES} \
|
|
|
8631a2 |
%{4}./grub-mkimage -O %{1} -o %{3} \\\
|
|
|
4e7deb |
-p /EFI/BOOT -d grub-core \\\
|
|
|
4e7deb |
${GRUB_MODULES} \
|
|
|
4e7deb |
%{nil}
|
|
|
4e7deb |
%endif
|
|
|
4e7deb |
|
|
|
09e3cc |
%ifarch ppc64le
|
|
|
09e3cc |
%define ieee1275_mkimage() \
|
|
|
09e3cc |
APPENDED_SIG_SIZE=0 \
|
|
|
09e3cc |
if [ -x /usr/bin/rpm-sign ]; then \
|
|
|
09e3cc |
touch empty.unsigned \
|
|
|
09e3cc |
rpm-sign --key %{5} \\\
|
|
|
09e3cc |
--lkmsign empty.unsigned \\\
|
|
|
09e3cc |
--output empty.signed \
|
|
|
09e3cc |
APPENDED_SIG_SIZE="$(stat -c '%s' empty.signed)" \
|
|
|
09e3cc |
rm empty.{un,}signed \
|
|
|
09e3cc |
fi \
|
|
|
09e3cc |
# FIXME: using this prefix is fragile, must be done properly \
|
|
|
09e3cc |
./grub-mkimage -O %{1} -o %{2}.orig \\\
|
|
|
09e3cc |
-p '/grub2' -d grub-core \\\
|
|
|
09e3cc |
-x %{3} -x %{4} \\\
|
|
|
09e3cc |
--appended-signature-size ${APPENDED_SIG_SIZE} \\\
|
|
|
09e3cc |
${GRUB_MODULES} \
|
|
|
09e3cc |
if [ -x /usr/bin/rpm-sign ]; then \
|
|
|
09e3cc |
truncate -s -${APPENDED_SIG_SIZE} %{2}.orig \
|
|
|
09e3cc |
rpm-sign --key %{5} \\\
|
|
|
09e3cc |
--lkmsign %{2}.orig \\\
|
|
|
09e3cc |
--output %{2} \
|
|
|
09e3cc |
else \
|
|
|
09e3cc |
mv %{2}.orig %{2} \
|
|
|
09e3cc |
fi \
|
|
|
09e3cc |
%{nil}
|
|
|
09e3cc |
%endif
|
|
|
09e3cc |
|
|
|
8631a2 |
%define do_efi_build_images() \
|
|
|
4e7deb |
GRUB_MODULES+=%{grub_modules} \
|
|
|
4e7deb |
GRUB_MODULES+=%{efi_modules} \
|
|
|
8631a2 |
GRUB_MODULES+=%{platform_modules} \
|
|
|
4e7deb |
%{expand:%%{efi_mkimage %{1} %{2} %{3} %{4} %{5} %{6} %{7} %{8} %{9} %{10}}} \
|
|
|
4e7deb |
%{nil}
|
|
|
4e7deb |
|
|
|
09e3cc |
%define do_ieee1275_build_images() \
|
|
|
09e3cc |
GRUB_MODULES+=%{grub_modules} \
|
|
|
09e3cc |
GRUB_MODULES+=%{platform_modules} \
|
|
|
09e3cc |
cd grub-%{1}-%{tarversion} \
|
|
|
09e3cc |
%{expand:%%ieee1275_mkimage %%{1} %%{2} %%{3} %%{4} %%{5}} \
|
|
|
09e3cc |
cd .. \
|
|
|
09e3cc |
%{nil}
|
|
|
09e3cc |
|
|
|
8631a2 |
%define do_primary_efi_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
|
|
8631a2 |
%do_efi_build_all \
|
|
|
a4d572 |
%{expand:%%do_efi_build_images %{grub_target_name} %{2} %{3} ./ %{7} %{8} %{9} %{10} %{11} %{12}} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_alt_efi_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%{expand:%%do_efi_configure %%{4} %%{5} %%{6}} \
|
|
|
8631a2 |
%do_efi_build_modules \
|
|
|
8631a2 |
%{expand:%%do_efi_link_utils %{grubefiarch}} \
|
|
|
a4d572 |
%{expand:%%do_efi_build_images %{alt_grub_target_name} %{2} %{3} ../grub-%{grubefiarch}-%{tarversion}/ %{7} %{8} %{9} %{10} %{11} %{12}} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_legacy_build() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
%configure \\\
|
|
|
8631a2 |
%{cc_equals} \\\
|
|
|
8631a2 |
HOST_CFLAGS="%{legacy_host_cflags}" \\\
|
|
|
8631a2 |
HOST_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
HOST_LDFLAGS="%{legacy_host_ldflags}" \\\
|
|
|
8631a2 |
TARGET_CFLAGS="%{legacy_target_cflags}" \\\
|
|
|
8631a2 |
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
|
|
8631a2 |
TARGET_LDFLAGS="%{legacy_target_ldflags}" \\\
|
|
|
8631a2 |
--with-platform=%{platform} \\\
|
|
|
8631a2 |
--with-utils=host \\\
|
|
|
8631a2 |
--target=%{_target_platform} \\\
|
|
|
8631a2 |
--with-grubdir=%{name} \\\
|
|
|
8631a2 |
--program-transform-name=s,grub,%{name}, \\\
|
|
|
8631a2 |
--disable-grub-mount \\\
|
|
|
dbe756 |
--with-debug-timestamps \\\
|
|
|
dbe756 |
--enable-boot-time \\\
|
|
|
8631a2 |
--disable-werror || ( cat config.log ; exit 1 ) \
|
|
|
8631a2 |
git add . \
|
|
|
8631a2 |
git commit -m "After legacy configure" \
|
|
|
8631a2 |
make %{?_smp_mflags} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_alt_efi_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
|
|
|
8631a2 |
find . '(' -iname gdb_grub \\\
|
|
|
8631a2 |
-o -iname kernel.exec \\\
|
|
|
8631a2 |
-o -iname kernel.img \\\
|
|
|
8631a2 |
-o -iname config.h \\\
|
|
|
8631a2 |
-o -iname gmodule.pl \\\
|
|
|
8631a2 |
-o -iname modinfo.sh \\\
|
|
|
8631a2 |
-o -iname '*.lst' \\\
|
|
|
8631a2 |
-o -iname '*.mod' \\\
|
|
|
8631a2 |
')' \\\
|
|
|
8631a2 |
-exec cp {} $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \\\; \
|
|
|
8631a2 |
find $RPM_BUILD_ROOT -type f -iname "*.mod*" -exec chmod a-x {} '\;' \
|
|
|
8631a2 |
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_efi_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
find $RPM_BUILD_ROOT -iname "*.module" -exec chmod a-x {} '\;' \
|
|
|
8631a2 |
touch $RPM_BUILD_ROOT%{efi_esp_dir}/grub.cfg \
|
|
|
8631a2 |
ln -sf ..%{efi_esp_dir}/grub.cfg \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}-efi.cfg \
|
|
|
8631a2 |
install -m 700 %{2} $RPM_BUILD_ROOT%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
install -m 700 %{3} $RPM_BUILD_ROOT%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
install -D -m 700 unicode.pf2 \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{efi_esp_dir}/fonts/unicode.pf2 \
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{efi_esp_dir}/grubenv create \
|
|
|
8631a2 |
ln -sf ../efi/EFI/%{efi_vendor}/grubenv \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT/boot/grub2/grubenv \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_legacy_install() \
|
|
|
8631a2 |
cd grub-%{1}-%{tarversion} \
|
|
|
8631a2 |
make DESTDIR=$RPM_BUILD_ROOT install \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub.info \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info ]; then \
|
|
|
8631a2 |
rm -f $RPM_BUILD_ROOT%{_infodir}/grub-dev.info \
|
|
|
8631a2 |
fi \
|
|
|
09e3cc |
%{expand:%ifarch ppc64le \
|
|
|
09e3cc |
install -m 700 %{grubelfname} $RPM_BUILD_ROOT/%{_libdir}/grub/%{1} \
|
|
|
09e3cc |
%endif} \
|
|
|
8631a2 |
ln -s ../boot/%{name}/grub.cfg \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{_sysconfdir}/grub2.cfg \
|
|
|
8631a2 |
if [ -f $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp ]; then \
|
|
|
8631a2 |
mv $RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub2.chrp \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT/%{_libdir}/grub/%{1}/grub.chrp \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
if [ %{3} -eq 0 ]; then \
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/%{_bindir}/%{name}-editenv \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}/boot/%{name}/grubenv create \
|
|
|
8631a2 |
fi \
|
|
|
8631a2 |
cd .. \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define do_common_install() \
|
|
|
8631a2 |
install -d -m 0755 \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_infodir}/ \
|
|
|
8631a2 |
cp -a $RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_datarootdir}/locale/en \
|
|
|
8631a2 |
cp docs/grub.info $RPM_BUILD_ROOT%{_infodir}/%{name}.info \
|
|
|
8631a2 |
cp docs/grub-dev.info \\\
|
|
|
8631a2 |
$RPM_BUILD_ROOT%{_infodir}/%{name}-dev.info \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{efi_esp_dir}/ \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/grub2/ \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/loader/entries \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}/boot/%{name}/themes/system \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/default \
|
|
|
8631a2 |
install -d -m 0700 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig \
|
|
|
8631a2 |
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/default/grub \
|
|
|
8631a2 |
ln -sf ../default/grub \\\
|
|
|
8631a2 |
${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/grub \
|
|
|
8631a2 |
touch ${RPM_BUILD_ROOT}/boot/%{name}/grub.cfg \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_legacy_variant_files() \
|
|
|
8631a2 |
%{expand:%%files %{1}} \
|
|
|
8631a2 |
%defattr(-,root,root,-) \
|
|
|
8631a2 |
%config(noreplace) %{_sysconfdir}/%{name}.cfg \
|
|
|
8631a2 |
%ghost %config(noreplace) /boot/%{name}/grub.cfg \
|
|
|
8631a2 |
%dir %attr(0700,root,root)/boot/loader/entries \
|
|
|
09e3cc |
%ifarch ppc64le \
|
|
|
09e3cc |
%dir %{_libdir}/grub/%{2}/ \
|
|
|
09e3cc |
%{_libdir}/grub/%{2}/%{grubelfname} \
|
|
|
09e3cc |
%endif \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%if 0%{?with_legacy_modules} \
|
|
|
8631a2 |
%{expand:%%files %{1}-modules} \
|
|
|
8631a2 |
%defattr(-,root,root) \
|
|
|
8631a2 |
%dir %{_libdir}/grub/%{2}/ \
|
|
|
8631a2 |
%{_libdir}/grub/%{2}/* \
|
|
|
09e3cc |
%ifarch ppc64le \
|
|
|
09e3cc |
%exclude %{_libdir}/grub/%{2}/%{grubelfname} \
|
|
|
09e3cc |
%endif \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/*.module \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/{boot,boot_hybrid,cdboot,diskboot,lzma_decompress,pxeboot}.image \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{2}/*.o \
|
|
|
8631a2 |
%else \
|
|
|
8631a2 |
%%exclude %%{_libdir}/grub/%%{grublegacyarch}/* \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
%{nil}
|
|
|
8631a2 |
|
|
|
8631a2 |
%define define_efi_variant_files() \
|
|
|
8631a2 |
%{expand:%%files %{1}} \
|
|
|
8631a2 |
%defattr(0700,root,root,-) \
|
|
|
8631a2 |
%config(noreplace) %{_sysconfdir}/%{name}-efi.cfg \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/%{2} \
|
|
|
8631a2 |
%dir %attr(0700,root,root)%{efi_esp_dir}/fonts \
|
|
|
8631a2 |
%dir %attr(0700,root,root)/boot/loader/entries \
|
|
|
8631a2 |
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grub.cfg \
|
|
|
a7e0e3 |
%config(noreplace) %verify(not size mode md5 mtime) /boot/grub2/grubenv \
|
|
|
8631a2 |
%ghost %config(noreplace) %attr(0700,root,root)%{efi_esp_dir}/grubenv \
|
|
|
8631a2 |
%{expand:%if 0%{?without_efi_modules} \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6} \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6}/* \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%if 0%{?with_efi_modules} \
|
|
|
8631a2 |
%{expand:%%files %{1}-modules} \
|
|
|
8631a2 |
%defattr(-,root,root,-) \
|
|
|
8631a2 |
%dir %{_libdir}/grub/%{6}/ \
|
|
|
8631a2 |
%{_libdir}/grub/%{6}/* \
|
|
|
8631a2 |
%exclude %{_libdir}/grub/%{6}/*.module \
|
|
|
8631a2 |
%endif} \
|
|
|
8631a2 |
\
|
|
|
8631a2 |
%{expand:%%files %{1}-cdboot} \
|
|
|
8631a2 |
%defattr(0700,root,root,-) \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/%{3} \
|
|
|
8631a2 |
%attr(0700,root,root)%{efi_esp_dir}/fonts \
|
|
|
8631a2 |
%{nil}
|