From 5fec5ae32ca40eb545fa3b9af81c36beb668a2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20N=C3=A9ri?= Date: Thu, 20 Feb 2020 14:27:06 +0000 Subject: [PATCH] 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. --- srcpkgs/grub-xen | 1 + .../patches/grub-install-pvxen-paths.patch | 71 +++++++++++++++++++ .../grub-install-pvxen-paths.patch.args | 1 + srcpkgs/grub/template | 24 +++++-- 4 files changed, 92 insertions(+), 5 deletions(-) create mode 120000 srcpkgs/grub-xen create mode 100644 srcpkgs/grub/patches/grub-install-pvxen-paths.patch create mode 100644 srcpkgs/grub/patches/grub-install-pvxen-paths.patch.args diff --git a/srcpkgs/grub-xen b/srcpkgs/grub-xen new file mode 120000 index 0000000000..2c8276e741 --- /dev/null +++ b/srcpkgs/grub-xen @@ -0,0 +1 @@ +grub \ No newline at end of file diff --git a/srcpkgs/grub/patches/grub-install-pvxen-paths.patch b/srcpkgs/grub/patches/grub-install-pvxen-paths.patch new file mode 100644 index 0000000000..0522bcd60e --- /dev/null +++ b/srcpkgs/grub/patches/grub-install-pvxen-paths.patch @@ -0,0 +1,71 @@ +From 04aa0aa735f4bfa2d7a4f6593745fbe1d7fa0d0a Mon Sep 17 00:00:00 2001 +From: Ian Campbell +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 + +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")); diff --git a/srcpkgs/grub/patches/grub-install-pvxen-paths.patch.args b/srcpkgs/grub/patches/grub-install-pvxen-paths.patch.args new file mode 100644 index 0000000000..2eba1cb3c5 --- /dev/null +++ b/srcpkgs/grub/patches/grub-install-pvxen-paths.patch.args @@ -0,0 +1 @@ +-Np1 diff --git a/srcpkgs/grub/template b/srcpkgs/grub/template index 16f3f5eb01..5860c9735c 100644 --- a/srcpkgs/grub/template +++ b/srcpkgs/grub/template @@ -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"