summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Licht <jonas.licht@fem.tu-ilmenau.de>2020-02-17 17:12:17 +0100
committerSam James <sam@gentoo.org>2021-10-20 02:05:33 +0000
commitfb9b0ff51ad4a0b9efe1ec4888374181bcbe58de (patch)
tree2044055aef6c5eecae22c0e6eff40b5bba834763 /app-emulation/grub-xen-host
parentapp-emulation/bochs: adapt to upstream changes (diff)
downloadgentoo-fb9b0ff51ad4a0b9efe1ec4888374181bcbe58de.tar.gz
gentoo-fb9b0ff51ad4a0b9efe1ec4888374181bcbe58de.tar.bz2
gentoo-fb9b0ff51ad4a0b9efe1ec4888374181bcbe58de.zip
app-emulation/grub-xen-host: add USE=pvh
Bug: https://bugs.gentoo.org/698916 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Jonas Licht <jonas.licht@fem.tu-ilmenau.de> Closes: https://github.com/gentoo/gentoo/pull/13496 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-emulation/grub-xen-host')
-rw-r--r--app-emulation/grub-xen-host/grub-xen-host-1.0-r1.ebuild98
-rw-r--r--app-emulation/grub-xen-host/metadata.xml3
2 files changed, 101 insertions, 0 deletions
diff --git a/app-emulation/grub-xen-host/grub-xen-host-1.0-r1.ebuild b/app-emulation/grub-xen-host/grub-xen-host-1.0-r1.ebuild
new file mode 100644
index 000000000000..9a2c9dc09f07
--- /dev/null
+++ b/app-emulation/grub-xen-host/grub-xen-host-1.0-r1.ebuild
@@ -0,0 +1,98 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Grub2 built as a PV grub per the Xen PV Boot Protocol"
+HOMEPAGE="https://blog.xenproject.org/2015/01/07/using-grub-2-as-a-bootloader-for-xen-pv-guests/"
+SRC_URI=""
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="pvh"
+
+DEPEND="sys-boot/grub:2=[grub_platforms_xen]
+ pvh? ( >=sys-boot/grub-2.04:2=[grub_platforms_xen-pvh] )
+ app-emulation/xen-tools:="
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+RESTRICT="binchecks strip test"
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ cat > "${S}/grub-bootstrap.cfg" <<- EOF || die
+ normal (memdisk)/grub.cfg
+ EOF
+
+ cat > "${S}/grub.cfg" <<- EOF || die
+ if search -s -f /boot/xen/pvboot-x86_64.elf ; then
+ echo "Chainloading (${root})/boot/xen/pvboot-x86_64.elf"
+ multiboot "/boot/xen/pvboot-x86_64.elf"
+ boot
+ fi
+
+ if search -s -f /xen/pvboot-x86_64.elf ; then
+ echo "Chainloading (${root})/xen/pvboot-x86_64.elf"
+ multiboot "/xen/pvboot-x86_64.elf"
+ boot
+ fi
+
+ if search -s -f /boot/grub/grub.cfg ; then
+ echo "Reading (${root})/boot/grub/grub.cfg"
+ configfile /boot/grub/grub.cfg
+ fi
+
+ if search -s -f /grub/grub.cfg ; then
+ echo "Reading (${root})/grub/grub.cfg"
+ configfile /grub/grub.cfg
+ fi
+ EOF
+
+ tar cf memdisk.tar grub.cfg || die "failed to tar"
+
+ local grub_mkimage=grub-mkimage
+ if type grub2-mkimage &> /dev/null; then
+ grub_mkimage=grub2-mkimage
+ fi
+
+ local args=(
+ "${grub_mkimage}"
+ -O x86_64-xen
+ -c grub-bootstrap.cfg
+ -m memdisk.tar
+ -o grub-x86_64-xen.bin
+ /usr/lib/grub/x86_64-xen/*.mod
+ )
+
+ echo "${args[@]}"
+ "${args[@]}" || die "failed to grub-mkimage"
+
+ if use pvh; then
+ local args=(
+ "${grub_mkimage}"
+ -O i386-xen_pvh
+ -c grub-bootstrap.cfg
+ -m memdisk.tar
+ -o grub-i386-xen_pvh.bin
+ /usr/lib/grub/i386-xen_pvh/*.mod
+ )
+
+ echo "${args[@]}"
+ "${args[@]}" || die "failed to grub-mkimage"
+ fi
+
+}
+
+src_install() {
+ exeinto /usr/libexec/xen/bin
+ doexe grub-x86_64-xen.bin
+ if use pvh; then
+ doexe grub-i386-xen_pvh.bin
+ fi
+}
diff --git a/app-emulation/grub-xen-host/metadata.xml b/app-emulation/grub-xen-host/metadata.xml
index 212093a6f10e..485b9cd416b6 100644
--- a/app-emulation/grub-xen-host/metadata.xml
+++ b/app-emulation/grub-xen-host/metadata.xml
@@ -9,4 +9,7 @@
a guest installed PV grub (grub legacy or grub 2) or handle a guest
supplied grub 2 config file.
</longdescription>
+ <use>
+ <flag name="pvh">Build an additional grub bin for pvh.</flag>
+ </use>
</pkgmetadata>