grub: add -xen subpackage for Xen PV guest domain boot

Also add patch (from Debian) for installation of standard Xen PV 2nd stage bootloader binary.
This commit is contained in:
Daniel Néri 2020-02-20 14:27:06 +00:00 committed by Juan RP
parent f73d2df928
commit 5fec5ae32c
4 changed files with 92 additions and 5 deletions

1
srcpkgs/grub-xen Symbolic link
View file

@ -0,0 +1 @@
grub

View file

@ -0,0 +1,71 @@
From 04aa0aa735f4bfa2d7a4f6593745fbe1d7fa0d0a Mon Sep 17 00:00:00 2001
From: Ian Campbell <ijc@hellion.org.uk>
Date: Sat, 6 Sep 2014 12:20:12 +0100
Subject: grub-install: Install PV Xen binaries into the upstream specified
path
Upstream have defined a specification for where guests ought to place their
xenpv grub binaries in order to facilitate chainloading from a stage 1 grub
loaded from dom0.
http://xenbits.xen.org/docs/unstable-staging/misc/x86-xenpv-bootloader.html
The spec calls for installation into /boot/xen/pvboot-i386.elf or
/boot/xen/pvboot-x86_64.elf.
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Bug-Debian: https://bugs.debian.org/762307
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00041.html
Last-Update: 2014-10-24
Patch-Name: grub-install-pvxen-paths.patch
---
v2: Respect bootdir, create /boot/xen as needed.
---
util/grub-install.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/util/grub-install.c b/util/grub-install.c
index b82c14d41..caadada98 100644
--- a/util/grub-install.c
+++ b/util/grub-install.c
@@ -2057,6 +2057,28 @@ main (int argc, char *argv[])
}
break;
+ case GRUB_INSTALL_PLATFORM_I386_XEN:
+ {
+ char *path = grub_util_path_concat (2, bootdir, "xen");
+ char *dst = grub_util_path_concat (2, path, "pvboot-i386.elf");
+ grub_install_mkdir_p (path);
+ grub_install_copy_file (imgfile, dst, 1);
+ free (dst);
+ free (path);
+ }
+ break;
+
+ case GRUB_INSTALL_PLATFORM_X86_64_XEN:
+ {
+ char *path = grub_util_path_concat (2, bootdir, "xen");
+ char *dst = grub_util_path_concat (2, path, "pvboot-x86_64.elf");
+ grub_install_mkdir_p (path);
+ grub_install_copy_file (imgfile, dst, 1);
+ free (dst);
+ free (path);
+ }
+ break;
+
case GRUB_INSTALL_PLATFORM_MIPSEL_LOONGSON:
case GRUB_INSTALL_PLATFORM_MIPSEL_QEMU_MIPS:
case GRUB_INSTALL_PLATFORM_MIPS_QEMU_MIPS:
@@ -2066,8 +2088,6 @@ main (int argc, char *argv[])
case GRUB_INSTALL_PLATFORM_MIPSEL_ARC:
case GRUB_INSTALL_PLATFORM_ARM_UBOOT:
case GRUB_INSTALL_PLATFORM_I386_QEMU:
- case GRUB_INSTALL_PLATFORM_I386_XEN:
- case GRUB_INSTALL_PLATFORM_X86_64_XEN:
case GRUB_INSTALL_PLATFORM_I386_XEN_PVH:
grub_util_warn ("%s",
_("WARNING: no platform-specific install was performed"));

View file

@ -0,0 +1 @@
-Np1

View file

@ -1,7 +1,7 @@
# Template file for 'grub'
pkgname=grub
version=2.04
revision=2
revision=3
hostmakedepends="python3 pkg-config flex freetype-devel font-unifont-bdf"
makedepends="libusb-compat-devel ncurses-devel freetype-devel
liblzma-devel device-mapper-devel fuse-devel"
@ -22,15 +22,15 @@ subpackages="grub-utils"
case "$XBPS_TARGET_MACHINE" in
x86_64*)
_NATIVE_PLATFORM=pc
_SUPPLEMENTARY_BUILDS="i386-efi x86_64-efi"
subpackages+=" grub-i386-efi grub-x86_64-efi"
_SUPPLEMENTARY_BUILDS="i386-efi x86_64-efi x86_64-xen"
subpackages+=" grub-i386-efi grub-x86_64-efi grub-xen"
;;
i686*)
CFLAGS="-D_FILE_OFFSET_BITS=64"
configure_args+=" ac_cv_sizeof_off_t=8"
_NATIVE_PLATFORM=pc
_SUPPLEMENTARY_BUILDS="i386-efi"
subpackages+=" grub-i386-efi"
_SUPPLEMENTARY_BUILDS="i386-efi i386-xen"
subpackages+=" grub-i386-efi grub-xen"
;;
aarch64*)
_NATIVE_PLATFORM=efi
@ -177,6 +177,20 @@ grub-i386-efi_package() {
vmove usr/lib/grub/i386-efi
}
}
grub-xen_package() {
depends="grub>=$version"
short_desc+=" - Xen PV support"
pkg_install() {
case "$XBPS_TARGET_MACHINE" in
x86_64*)
vmove usr/lib/grub/x86_64-xen
;;
i686*)
vmove usr/lib/grub/i386-xen
;;
esac
}
}
grub-arm64-efi_package() {
archs=noarch
depends="grub>=$version dosfstools efibootmgr"