mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-24 06:22:43 +00:00
Build modules for Xen PV and PVH
The grub2-mkimage tool can be used for building custom images for various platforms and architectures. But it needs modules for that specific target. The x86_64-xen target is for PV guest type, the i386-xen_pvh is for PVH guest type (even for x86_64). Signed-off-by: Matyáš Kroupa <kroupa.matyas@gmail.com> Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
parent
283797a45d
commit
a0dbec9c2a
4 changed files with 246 additions and 1 deletions
32
0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch
Normal file
32
0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matyáš Kroupa <kroupa.matyas@gmail.com>
|
||||
Date: Fri, 30 Aug 2024 16:28:21 +0200
|
||||
Subject: [PATCH] Enable building blscfg module on xen and xen_pvh
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Building blscfg module for Xen targets makes it possible to include them
|
||||
in custom pvgrub2 and pvhgrub2 images. Those are then used to boot PV and
|
||||
PVH domUs.
|
||||
|
||||
Signed-off-by: Matyáš Kroupa <kroupa.matyas@gmail.com>
|
||||
---
|
||||
grub-core/Makefile.core.def | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 6ff4835..95fd18d 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -880,6 +880,8 @@ module = {
|
||||
enable = efi;
|
||||
enable = i386_pc;
|
||||
enable = emu;
|
||||
+ enable = xen;
|
||||
+ enable = i386_xen_pvh;
|
||||
};
|
||||
|
||||
module = {
|
||||
--
|
||||
2.46.0
|
169
grub.macros
169
grub.macros
|
@ -50,6 +50,8 @@
|
|||
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
||||
)}
|
||||
%global efi_host_cflags %{expand:%%(echo %{host_cflags})}
|
||||
%global xen_host_cflags %{expand:%%(echo %{host_cflags})}
|
||||
%global xen_pvh_host_cflags %{expand:%%(echo %{host_cflags})}
|
||||
|
||||
%global target_cflags %{expand:%%(echo %{build_cflags} | %{cflags_sed})}
|
||||
%global legacy_target_cflags \\\
|
||||
|
@ -59,6 +61,8 @@
|
|||
-e 's/-mcpu=power[[:alnum:]]\\+/-mcpu=power6/g' \\\
|
||||
)}
|
||||
%global efi_target_cflags %{expand:%%(echo %{target_cflags})}
|
||||
%global xen_target_cflags %{expand:%%(echo %{target_cflags})}
|
||||
%global xen_pvh_target_cflags %{expand:%%(echo %{target_cflags})}
|
||||
|
||||
%global ldflags_sed \\\
|
||||
sed \\\
|
||||
|
@ -72,6 +76,8 @@
|
|||
%{ldflags_sed} \\\
|
||||
)}
|
||||
%global efi_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
||||
%global xen_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
||||
%global xen_pvh_host_ldflags %{expand:%%(echo %{host_ldflags})}
|
||||
|
||||
%global target_ldflags %{expand:%%(echo %{build_ldflags} -Wl,--no-warn-rwx-segments -static | %{ldflags_sed})}
|
||||
%global legacy_target_ldflags \\\
|
||||
|
@ -79,15 +85,21 @@
|
|||
%{ldflags_sed} \\\
|
||||
)}
|
||||
%global efi_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
||||
%global xen_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
||||
%global xen_pvh_target_ldflags %{expand:%%(echo %{target_ldflags})}
|
||||
|
||||
%global with_efi_arch 0
|
||||
%global with_alt_efi_arch 0
|
||||
%global with_legacy_arch 0
|
||||
%global with_emu_arch 1
|
||||
%global with_xen_arch 0
|
||||
%global with_xen_pvh_arch 0
|
||||
%global emuarch %{_arch}
|
||||
%global grubefiarch %{nil}
|
||||
%global grublegacyarch %{nil}
|
||||
%global grubelfname %{nil}
|
||||
%global xen_package_arch %{nil}
|
||||
%global xen_pvh_package_arch %{nil}
|
||||
|
||||
# sparc is always compiled 64 bit
|
||||
%ifarch %{sparc}
|
||||
|
@ -131,6 +143,24 @@
|
|||
%global efi_modules " efi_netfs efifwsetup efinet lsefi lsefimmap connectefi "
|
||||
%endif
|
||||
|
||||
%global xen_arch x86_64
|
||||
%ifarch %{xen_arch}
|
||||
%global with_xen_arch 1
|
||||
%else
|
||||
%global with_xen_arch 0
|
||||
%endif
|
||||
%{!?with_xen_arch:%global without_xen_arch 0}
|
||||
%{?with_xen_arch:%global without_xen_arch 1}
|
||||
|
||||
%global xen_pvh_arch x86_64
|
||||
%ifarch %{xen_pvh_arch}
|
||||
%global with_xen_pvh_arch 1
|
||||
%else
|
||||
%global with_xen_pvh_arch 0
|
||||
%endif
|
||||
%{!?with_xen_pvh_arch:%global without_xen_pvh_arch 0}
|
||||
%{?with_xen_pvh_arch:%global without_xen_pvh_arch 1}
|
||||
|
||||
%ifarch x86_64 %{ix86}
|
||||
%global platform_modules " backtrace chain tpm usb usbserial_common usbserial_pl2303 usbserial_ftdi usbserial_usbdebug keylayouts at_keyboard "
|
||||
%endif
|
||||
|
@ -163,11 +193,18 @@
|
|||
%global target_cpu_name %{_arch}
|
||||
%global grub_target_name %{_arch}-efi
|
||||
%global package_arch efi-x64
|
||||
%global xen_package_arch xen-x64
|
||||
%global xen_pvh_package_arch xen_pvh-i386
|
||||
|
||||
%global legacy_target_cpu_name i386
|
||||
%global legacy_package_arch pc
|
||||
%global platform pc
|
||||
|
||||
%global xen_grub_target_name %{_arch}-xen
|
||||
%global xen_pvh_grub_target_name i386-xen_pvh
|
||||
%global grubxenarch %{xen_grub_target_name}
|
||||
%global grubxenpvharch %{xen_pvh_grub_target_name}
|
||||
|
||||
%global alt_efi_arch ia32
|
||||
%global alt_target_cpu_name i386
|
||||
%global alt_grub_target_name i386-efi
|
||||
|
@ -333,6 +370,32 @@ Provides: grub2-efi-cdboot = %{evr} \
|
|||
This subpackage provides optional components of grub used with removeable media on %{1} systems.\
|
||||
%{nil}
|
||||
|
||||
%define define_xen_variant(o) \
|
||||
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
|
||||
%{expand:%%package %{1}-modules} \
|
||||
Summary: Modules used to build custom grub-%{xen_grub_target_name}.bin images \
|
||||
BuildArch: noarch \
|
||||
Requires: grub2-tools = %{evr} \
|
||||
Provides: grub2-xen-modules = %{evr} \
|
||||
Obsoletes: grub2-xen-modules < %{evr} \
|
||||
%{expand:%%description %{1}-modules} \
|
||||
%{desc} \
|
||||
This subpackage provides support for rebuilding your own grub-%{xen_grub_target_name}.bin. \
|
||||
%{nil}
|
||||
|
||||
%define define_xen_pvh_variant(o) \
|
||||
%{expand:%%{?!buildsubdir:%%define buildsubdir grub-%{1}-%{tarversion}}}\
|
||||
%{expand:%%package %{1}-modules} \
|
||||
Summary: Modules used to build custom grub-%{xen_pvh_grub_target_name}.bin images \
|
||||
BuildArch: noarch \
|
||||
Requires: grub2-tools = %{evr} \
|
||||
Provides: grub2-xen_pvh-modules = %{evr} \
|
||||
Obsoletes: grub2-xen_pvh-modules < %{evr} \
|
||||
%{expand:%%description %{1}-modules} \
|
||||
%{desc} \
|
||||
This subpackage provides support for rebuilding your own grub-%{xen_pvh_grub_target_name}.bin. \
|
||||
%{nil}
|
||||
|
||||
%global do_common_setup() \
|
||||
%setup -q -n grub-%{tarversion} \
|
||||
rm -fv docs/*.info \
|
||||
|
@ -378,6 +441,46 @@ git add . \
|
|||
git commit -m "After efi configure" \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_configure() \
|
||||
%configure \\\
|
||||
%{cc_equals} \\\
|
||||
HOST_CFLAGS="%{3}" \\\
|
||||
HOST_CPPFLAGS="-I$(pwd)" \\\
|
||||
HOST_LDFLAGS="%{xen_host_ldflags}" \\\
|
||||
TARGET_CFLAGS="%{2}" \\\
|
||||
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
||||
TARGET_LDFLAGS="%{xen_target_ldflags}" \\\
|
||||
--with-rpm-version=%{version}-%{release} \\\
|
||||
--with-platform=xen \\\
|
||||
--with-utils=host \\\
|
||||
--target=%{1} \\\
|
||||
--with-grubdir=grub2 \\\
|
||||
--program-transform-name=s,grub,grub2, \\\
|
||||
--disable-werror || ( cat config.log ; exit 1 ) \
|
||||
git add . \
|
||||
git commit -m "After xen configure" \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_pvh_configure() \
|
||||
%configure \\\
|
||||
%{cc_equals} \\\
|
||||
HOST_CFLAGS="%{3}" \\\
|
||||
HOST_CPPFLAGS="-I$(pwd)" \\\
|
||||
HOST_LDFLAGS="%{xen_pvh_host_ldflags}" \\\
|
||||
TARGET_CFLAGS="%{2}" \\\
|
||||
TARGET_CPPFLAGS="-I$(pwd)" \\\
|
||||
TARGET_LDFLAGS="%{xen_pvh_target_ldflags}" \\\
|
||||
--with-rpm-version=%{version}-%{release} \\\
|
||||
--with-platform=xen_pvh \\\
|
||||
--with-utils=host \\\
|
||||
--target=%{1} \\\
|
||||
--with-grubdir=grub2 \\\
|
||||
--program-transform-name=s,grub,grub2, \\\
|
||||
--disable-werror || ( cat config.log ; exit 1 ) \
|
||||
git add . \
|
||||
git commit -m "After xen_pvh configure" \
|
||||
%{nil}
|
||||
|
||||
%define do_efi_build_modules() \
|
||||
make %{?_smp_mflags} ascii.h widthspec.h \
|
||||
make %{?_smp_mflags} -C grub-core \
|
||||
|
@ -393,6 +496,16 @@ for x in grub-mkimage ; do \\\
|
|||
done \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_build_modules() \
|
||||
make %{?_smp_mflags} ascii.h widthspec.h \
|
||||
make %{?_smp_mflags} -C grub-core \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_pvh_build_modules() \
|
||||
make %{?_smp_mflags} ascii.h widthspec.h \
|
||||
make %{?_smp_mflags} -C grub-core \
|
||||
%{nil}
|
||||
|
||||
%define do_install_protected_file() \
|
||||
touch %{1}.conf \
|
||||
echo %{1} > %{1}.conf \
|
||||
|
@ -563,6 +676,20 @@ make %{?_smp_mflags} -C grub-core \
|
|||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_build() \
|
||||
cd grub-%{1}-%{tarversion} \
|
||||
%{expand:%%do_xen_configure %%{2} %%{3} %%{4}} \
|
||||
%do_xen_build_modules \
|
||||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_pvh_build() \
|
||||
cd grub-%{1}-%{tarversion} \
|
||||
%{expand:%%do_xen_pvh_configure %%{2} %%{3} %%{4}} \
|
||||
%do_xen_pvh_build_modules \
|
||||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_alt_efi_install() \
|
||||
cd grub-%{1}-%{tarversion} \
|
||||
install -d -m 755 $RPM_BUILD_ROOT/usr/lib/grub/%{grubaltefiarch}/ \
|
||||
|
@ -660,6 +787,32 @@ fi \
|
|||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_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 {} '\;' \
|
||||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_xen_pvh_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 {} '\;' \
|
||||
cd .. \
|
||||
%{nil}
|
||||
|
||||
%define do_common_install() \
|
||||
install -d -m 0755 \\\
|
||||
$RPM_BUILD_ROOT%{_datarootdir}/locale/en\@quot \\\
|
||||
|
@ -746,3 +899,19 @@ ln -s ../boot/grub2/grub.cfg \\\
|
|||
%attr(0700,root,root) %verify(not mtime) %{efi_esp_dir}/%{3} \
|
||||
%attr(0700,root,root)/boot/grub2/fonts \
|
||||
%{nil}
|
||||
|
||||
%define define_xen_variant_files() \
|
||||
%{expand:%%files %{1}-modules} \
|
||||
%defattr(-,root,root,-) \
|
||||
%dir %{_libdir}/grub/%{2}/ \
|
||||
%{_libdir}/grub/%{2}/* \
|
||||
%exclude %{_libdir}/grub/%{2}/*.module \
|
||||
%{nil}
|
||||
|
||||
%define define_xen_pvh_variant_files() \
|
||||
%{expand:%%files %{1}-modules} \
|
||||
%defattr(-,root,root,-) \
|
||||
%dir %{_libdir}/grub/%{2}/ \
|
||||
%{_libdir}/grub/%{2}/* \
|
||||
%exclude %{_libdir}/grub/%{2}/*.module \
|
||||
%{nil}
|
||||
|
|
|
@ -277,3 +277,4 @@ Patch0276: 0276-efi-loader-Check-if-NX-is-required-in-grub_efi_linux.patch
|
|||
Patch0277: 0277-Stop-grub.efi-from-always-printing-dynamic_load_symb.patch
|
||||
Patch0278: 0278-acpi-Fix-out-of-bounds-access-in-grub_acpi_xsdt_find.patch
|
||||
Patch0279: 0279-cmd-search-Fix-a-possible-NULL-ptr-dereference.patch
|
||||
Patch0280: 0280-Enable-building-blscfg-module-on-xen-and-xen_pvh.patch
|
||||
|
|
45
grub2.spec
45
grub2.spec
|
@ -17,7 +17,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.12
|
||||
Release: 13%{?dist}
|
||||
Release: 14%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPL-3.0-or-later
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
|
@ -160,6 +160,12 @@ This subpackage provides tools for support of all platforms.
|
|||
%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} -o}
|
||||
%endif
|
||||
%if 0%{with_xen_pvh_arch}
|
||||
%{expand:%define_xen_pvh_variant %%{xen_pvh_package_arch} -o}
|
||||
%endif
|
||||
|
||||
%if 0%{with_emu_arch}
|
||||
%package emu
|
||||
|
@ -207,6 +213,22 @@ grep -A100000 '# stuff "make" creates' .gitignore > grub-emu-%{tarversion}/.giti
|
|||
cp %{SOURCE4} grub-emu-%{tarversion}/unifont.pcf.gz
|
||||
git add grub-emu-%{tarversion}
|
||||
%endif
|
||||
%if 0%{with_xen_arch}
|
||||
mkdir grub-%{grubxenarch}-%{tarversion}
|
||||
grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubxenarch}-%{tarversion}/.gitignore
|
||||
cp %{SOURCE4} grub-%{grubxenarch}-%{tarversion}/unifont.pcf.gz
|
||||
sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \
|
||||
%{SOURCE12} > grub-%{grubxenarch}-%{tarversion}/sbat.csv
|
||||
git add grub-%{grubxenarch}-%{tarversion}
|
||||
%endif
|
||||
%if 0%{with_xen_pvh_arch}
|
||||
mkdir grub-%{grubxenpvharch}-%{tarversion}
|
||||
grep -A100000 '# stuff "make" creates' .gitignore > grub-%{grubxenpvharch}-%{tarversion}/.gitignore
|
||||
cp %{SOURCE4} grub-%{grubxenpvharch}-%{tarversion}/unifont.pcf.gz
|
||||
sed -e "s,@@VERSION@@,%{version},g" -e "s,@@VERSION_RELEASE@@,%{version}-%{release},g" \
|
||||
%{SOURCE12} > grub-%{grubxenpvharch}-%{tarversion}/sbat.csv
|
||||
git add grub-%{grubxenpvharch}-%{tarversion}
|
||||
%endif
|
||||
git commit -m "After making subdirs"
|
||||
|
||||
%build
|
||||
|
@ -222,6 +244,12 @@ git commit -m "After making subdirs"
|
|||
%if 0%{with_emu_arch}
|
||||
%{expand:%do_emu_build}
|
||||
%endif
|
||||
%if 0%{with_xen_arch}
|
||||
%{expand:%do_xen_build %%{grubxenarch} %%{_target_platform} %%{xen_target_cflags} %%{xen_host_cflags}}
|
||||
%endif
|
||||
%if 0%{with_xen_pvh_arch}
|
||||
%{expand:%do_xen_pvh_build %%{grubxenpvharch} %%{_target_platform} %%{xen_pvh_target_cflags} %%{xen_pvh_host_cflags}}
|
||||
%endif
|
||||
%ifarch ppc64le
|
||||
%{expand:%do_ieee1275_build_images %%{grublegacyarch} %{grubelfname} %{sb_cer} %{sb_key}}
|
||||
%endif
|
||||
|
@ -251,6 +279,12 @@ rm -fr $RPM_BUILD_ROOT
|
|||
%if 0%{with_emu_arch}
|
||||
%{expand:%do_emu_install %%{package_arch}}
|
||||
%endif
|
||||
%if 0%{with_xen_arch}
|
||||
%{expand:%do_xen_install %%{grubxenarch}}
|
||||
%endif
|
||||
%if 0%{with_xen_pvh_arch}
|
||||
%{expand:%do_xen_pvh_install %%{grubxenpvharch}}
|
||||
%endif
|
||||
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
||||
ln -s grub2-set-password ${RPM_BUILD_ROOT}/%{_sbindir}/grub2-setpassword
|
||||
echo '.so man8/grub2-set-password.8' > ${RPM_BUILD_ROOT}/%{_datadir}/man/man8/grub2-setpassword.8
|
||||
|
@ -550,6 +584,12 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||
%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} %%{xen_grub_target_name}}
|
||||
%endif
|
||||
%if 0%{with_xen_pvh_arch}
|
||||
%{expand:%define_xen_pvh_variant_files %%{xen_pvh_package_arch} %%{xen_pvh_grub_target_name}}
|
||||
%endif
|
||||
|
||||
%if 0%{with_emu_arch}
|
||||
%files emu
|
||||
|
@ -562,6 +602,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Nov 20 2024 Nicolas Frayer <nfrayer@redhat.com> 2.12-14
|
||||
- Build modules for Xen PV and PVH
|
||||
|
||||
* Fri Nov 15 2024 Nicolas Frayer <nfrayer@redhat.com> 2.12-13
|
||||
- posttrans: added check for efi_home/grub.cfg
|
||||
- Resolves: #2326502
|
||||
|
|
Loading…
Reference in a new issue