--- a/grub2.spec 2024-10-04 14:29:17.919109100 -0700 +++ b/grub2.spec 2024-10-08 12:53:22.000000000 -0700 @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 7%{?dist} +Release: 17%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -35,6 +35,7 @@ Source10: 20-grub.install Source11: grub.patches Source12: sbat.csv.in +Source16: grub_grub.cfg %include %{SOURCE1} @@ -83,6 +84,12 @@ Requires: grub2-%{package_arch} = %{evr} %endif +%if 0%{with_xen_arch} +Requires: grub2-%{xen_package_arch} = %{evr} +%else +Requires: grub2-%{package_arch} = %{evr} +%endif + %global desc \ The GRand Unified Bootloader (GRUB) is a highly configurable and \ customizable bootloader with modular architecture. It supports a rich \ @@ -161,6 +168,9 @@ %if 0%{with_legacy_arch} %{expand:%define_legacy_variant %%{legacy_package_arch}} %endif +%if 0%{with_xen_arch} +%{expand:%define_xen_variant %%{xen_package_arch}} +%endif %if 0%{with_emu_arch} %package emu @@ -202,6 +212,18 @@ cp %{SOURCE4} grub-%{grublegacyarch}-%{tarversion}/unifont.pcf.gz git add grub-%{grublegacyarch}-%{tarversion} %endif +%if 0%{with_xen_arch} +#mkdir grub-{grubxenarch}-{tarversion} +mkdir -p grub-%{grubxenarch}-%{tarversion}/boot/grub +cp %{SOURCE16} grub-%{grubxenarch}-%{tarversion}/boot/grub/grub.cfg +grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grublegacyarch}-%{tarversion}/.gitignore +cp %{SOURCE4} grub-%{grubxenarch}-%{tarversion}/unifont.pcf.gz +git add grub-%{grubxenarch}-%{tarversion} +mkdir -p grub-%{grubxen_pvharch}-%{tarversion}/boot/grub +cp %{SOURCE16} grub-%{grubxen_pvharch}-%{tarversion}/boot/grub/grub.cfg +cp %{SOURCE4} grub-%{grubxen_pvharch}-%{tarversion}/unifont.pcf.gz +git add grub-%{grubxen_pvharch}-%{tarversion} +%endif %if 0%{with_emu_arch} mkdir grub-emu-%{tarversion} grep -A100000 '# stuff "make" creates' .gitignore > grub-emu-%{tarversion}/.gitignore @@ -220,6 +242,10 @@ %if 0%{with_legacy_arch} %{expand:%do_legacy_build %%{grublegacyarch}} %endif +%if 0%{with_xen_arch} +%{expand:%do_xen_build %%{grubxenarch} xen} +%{expand:%do_xen_build %%{grubxen_pvharch} xen_pvh} +%endif %if 0%{with_emu_arch} %{expand:%do_emu_build} %endif @@ -238,7 +264,6 @@ %install set -e rm -fr $RPM_BUILD_ROOT - %do_common_install %if 0%{with_efi_arch} %{expand:%do_efi_install %%{grubefiarch} %%{grubefiname} %%{grubeficdname}} @@ -249,6 +274,10 @@ %if 0%{with_legacy_arch} %{expand:%do_legacy_install %%{grublegacyarch} %%{alt_grub_target_name} 0%{with_efi_arch}} %endif +%if 0%{with_xen_arch} +%{expand:%do_xen_install x86_64-xen x86_64 xen} +%{expand:%do_xen_install i386-xen_pvh i386 xen_pvh} +%endif %if 0%{with_emu_arch} %{expand:%do_emu_install %%{package_arch}} %endif @@ -549,6 +578,9 @@ %if 0%{with_legacy_arch} %{expand:%define_legacy_variant_files %%{legacy_package_arch} %%{grublegacyarch}} %endif +%if 0%{with_xen_arch} +%{expand:%define_xen_variant_files %%{xen_package_arch} %%{grubxenarch}} +%endif %if 0%{with_emu_arch} %files emu @@ -561,6 +593,13 @@ %endif %changelog +* Tue Oct 08 2024 Mark Pryor - 1:2.12-17.fc41 +- setup for fc41/rawhide +- add xen_pvh support + +* Mon Oct 07 2024 Mark Pryor - 1:2.12-16.el9 +- add xen module/pvgrub2 support + * Tue Sep 17 2024 Nicolas Frayer - 2.12-7 - aarch64/macros: Build gnulib with -mbranch-protection=standard --- a/grub.macros 2024-09-09 13:25:07.151196776 -0700 +++ b/grub.macros 2024-10-08 12:46:02.000000000 -0700 @@ -160,7 +160,9 @@ %global package_arch efi-x64 %global legacy_target_cpu_name i386 +%global xen_target_cpu_name %{_arch} %global legacy_package_arch pc +%global xen_package_arch xen %global platform pc %global alt_efi_arch ia32 @@ -233,8 +235,11 @@ %ifnarch %{efi_only} %global with_legacy_arch 1 +%global with_xen_arch 1 %global grublegacyarch %{legacy_target_cpu_name}-%{platform} %global moduledir %{legacy_target_cpu_name}-%{platform} +%global grubxenarch %{xen_target_cpu_name}-xen +%global grubxen_pvharch %{legacy_target_cpu_name}-xen_pvh %global grubelfname core.elf %endif @@ -291,6 +296,7 @@ This subpackage provides tools for support of %%{1} platforms. \ %{nil} + %define define_efi_variant(o) \ %{expand:%%package %{1}} \ Summary: GRUB for EFI systems. \ @@ -624,7 +630,7 @@ ${RPM_BUILD_ROOT}/boot/grub2/grubenv create \ fi \ %{expand:%ifnarch ppc64le \ -mkdir pxe \ +#mkdir pxe \ ./grub-mknetdir \\\ --directory ./grub-core \\\ --fonts="" \\\ @@ -741,3 +747,70 @@ %attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \ %attr(0700,root,root)/boot/grub2/fonts \ %{nil} + +%define do_xen_install() \ +cd grub-%{1}-%{tarversion} \ +make DESTDIR=$RPM_BUILD_ROOT install \ +%{expand:%%{xen_mkimage %{2} %{3}}} \ +cd .. \ +%{nil} + +%define xen_mkimage() \ +target=%{1} \ +platform=%{2} \ +pvfile=grub2-%{1}-%{2}.bin \ + ./grub-mkstandalone -v --compress=xz --locale-dir=%{buildroot}/usr/share/locale --locales=en\@quot --fonts="unicode" \\\ + --modules="linux normal" --themes="" -d grub-core \\\ + -O %{1}-%{2} -o $pvfile boot/grub/grub.cfg \ +pvdir=%{buildroot}/usr/share/${platform}/pvgrub2 \ +if [ "${platform}" == "xen_pvh" ]; then \\\ +pvdir=%{buildroot}/usr/share/xen/pvgrub2 \ +fi \ +if [ ! -d $pvdir ]; then \\\ +install -m 755 -d $pvdir \ +fi \ +install -m 755 $pvfile $pvdir/$pvfile \ +%{nil} + +%define define_xen_variant_files() \ +%{expand:%%files %{1}} \ +%defattr(-,root,root,-) \ +%{_libdir}/grub/*xen*/* \ +%exclude %{_libdir}/grub/*xen*/*.module \ +%defattr(0755,root,root,-) \ +%{_datadir}/xen*/pvgrub2/* \ +%{nil} + +%define define_xen_variant() \ +%{expand:%%package %%{1}} \ +Summary: Xen modules and pvgrub kernels \ +Provides: grub2 = %{evr} \ +Obsoletes: grub2 < %{evr} \ +%{expand:%%description %%{1}} \ +%{desc} \ +This subpackage provides support for %{1} systems. \ + \ +%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%%{1}-%{tarversion}}}\ +%{nil} + +%define do_xen_build() \ +cd grub-%{1}-%{tarversion} \ +%configure \\\ + %{cc_equals} \\\ + 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}" \\\ + --with-platform=%{2} \\\ + --with-utils=host \\\ + --target=%{_target_platform} \\\ + --with-grubdir=grub2 \\\ + --program-transform-name=s,grub,grub2, \\\ + --disable-werror || ( cat config.log ; exit 1 ) \ +git add . \ +git commit -m "After xen configure" \ +make %{?_smp_mflags} \ +cd .. \ +%{nil}