From 044771fd93582ce9af74647360f2285de1b5cdc2 Mon Sep 17 00:00:00 2001 From: Andrew Ammerlaan Date: Sun, 17 Mar 2024 17:42:04 +0100 Subject: app-emulation/virt-firmware: move plugin to installkernel and add cmdline option so we can use this with vanilla linux stub instead of systemd-stub Signed-off-by: Andrew Ammerlaan --- ...virt-firmware-24.2-allow-cmdline-override.patch | 68 ++++++++++++++++++++++ .../virt-firmware-24.2_p20240315-r1.ebuild | 55 ----------------- .../virt-firmware-24.2_p20240315-r2.ebuild | 52 +++++++++++++++++ 3 files changed, 120 insertions(+), 55 deletions(-) create mode 100644 app-emulation/virt-firmware/files/virt-firmware-24.2-allow-cmdline-override.patch delete mode 100644 app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild create mode 100644 app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild (limited to 'app-emulation') diff --git a/app-emulation/virt-firmware/files/virt-firmware-24.2-allow-cmdline-override.patch b/app-emulation/virt-firmware/files/virt-firmware-24.2-allow-cmdline-override.patch new file mode 100644 index 000000000000..6dd774424784 --- /dev/null +++ b/app-emulation/virt-firmware/files/virt-firmware-24.2-allow-cmdline-override.patch @@ -0,0 +1,68 @@ +https://gitlab.com/kraxel/virt-firmware/-/merge_requests/11 +diff --git a/man/kernel-bootcfg.1 b/man/kernel-bootcfg.1 +index 089d4dc..121304e 100644 +--- a/man/kernel-bootcfg.1 ++++ b/man/kernel-bootcfg.1 +@@ -38,6 +38,9 @@ update boot entry for UKI image FILE + \fB\-\-remove\-uki\fR FILE + remove boot entry for UKI image FILE + .TP ++\fB\-\-cmdline\fR CMDLINE ++override UKIs cmdline when adding boot entry (ignored when Secure Boot is enabled) CMDLINE ++.TP + \fB\-\-boot\-ok\fR, \fB\-\-boot\-successful\fR + boot is successful, update BootOrder to have current + entry listed first. +diff --git a/virt/firmware/bootcfg/main.py b/virt/firmware/bootcfg/main.py +index 65f2ad3..b809380 100644 +--- a/virt/firmware/bootcfg/main.py ++++ b/virt/firmware/bootcfg/main.py +@@ -71,6 +71,8 @@ def add_uki(cfg, options): + if not options.title: + logging.error('entry title not specified') + sys.exit(1) ++ if options.cmdline and cfg.secureboot: ++ logging.warning("Overriding built-in UKI cmdline is not possible when Secure Boot is enabled") + + efiuki = linuxcfg.LinuxEfiFile(options.adduki) + nr = cfg.find_uki_entry(efiuki.efi_filename()) +@@ -84,15 +86,25 @@ def add_uki(cfg, options): + if efishim.device != efiuki.device: + logging.error('shim and uki are on different filesystems') + sys.exit(1) +- optdata = ucs16.from_string(efiuki.efi_filename()) ++ if options.cmdline: ++ optdata = ucs16.from_string(efiuki.efi_filename() + ' ' + options.cmdline) ++ else: ++ optdata = ucs16.from_string(efiuki.efi_filename()) + entry = bootentry.BootEntry(title = ucs16.from_string(options.title), + attr = bootentry.LOAD_OPTION_ACTIVE, + devicepath = efishim.dev_path_file(), + optdata = bytes(optdata)) + else: +- entry = bootentry.BootEntry(title = ucs16.from_string(options.title), +- attr = bootentry.LOAD_OPTION_ACTIVE, +- devicepath = efiuki.dev_path_file()) ++ if options.cmdline: ++ optdata = ucs16.from_string(options.cmdline) ++ entry = bootentry.BootEntry(title = ucs16.from_string(options.title), ++ attr = bootentry.LOAD_OPTION_ACTIVE, ++ devicepath = efiuki.dev_path_file(), ++ optdata = bytes(optdata)) ++ else: ++ entry = bootentry.BootEntry(title = ucs16.from_string(options.title), ++ attr = bootentry.LOAD_OPTION_ACTIVE, ++ devicepath = efiuki.dev_path_file()) + + logging.info('Create new entry: %s', str(entry)) + nr = cfg.add_entry(entry) +@@ -229,6 +241,9 @@ def main(): + help = 'update boot entry for UKI image FILE', metavar = 'FILE') + group.add_argument('--remove-uki', dest = 'removeuki', type = str, + help = 'remove boot entry for UKI image FILE', metavar = 'FILE') ++ group.add_argument('--cmdline', dest = 'cmdline', type = str, ++ help = 'override UKIs cmdline when adding boot entry ' ++ '(ignored when Secure Boot is enabled)', metavar = 'CMDLINE') + group.add_argument('--boot-ok', '--boot-successful', dest = 'bootok', + action = 'store_true', default = False, + help = 'boot is successful, update BootOrder to have ' diff --git a/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild b/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild deleted file mode 100644 index 5eb358eb6555..000000000000 --- a/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -PYTHON_COMPAT=( python3_{10..12} ) -DISTUTILS_USE_PEP517=setuptools - -inherit distutils-r1 optfeature systemd - -COMMIT="f278ef19b0bc94ae93881ee4ab45fcbb03926e5f" - -DESCRIPTION="Tools for ovmf/armvirt firmware volumes" -HOMEPAGE=" - https://gitlab.com/kraxel/virt-firmware - https://pypi.org/project/virt-firmware/ -" -SRC_URI="https://gitlab.com/kraxel/virt-firmware/-/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" -S="${WORKDIR}/${PN}-${COMMIT}" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~amd64" - -RDEPEND=" - dev-python/cryptography[${PYTHON_USEDEP}] - dev-python/pefile[${PYTHON_USEDEP}] -" - -PATCHES=( - "${FILESDIR}/${PN}-24.2-dont-force-shim.patch" -) - -distutils_enable_tests unittest - -python_test() { - eunittest tests -} - -python_install_all() { - distutils-r1_python_install_all - - doman man/*.1 - - doinitd "${FILESDIR}/kernel-bootcfg-boot-successful" - systemd_dounit systemd/kernel-bootcfg-boot-successful.service - - exeinto /usr/lib/kernel/install.d - doexe systemd/99-uki-uefi-setup.install -} - -pkg_postinst() { - optfeature "managing UEFI entries on Unified Kernel Image installation and removal" \ - "sys-kernel/installkernel[systemd,uki]" -} diff --git a/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild b/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild new file mode 100644 index 000000000000..8fcfe0071043 --- /dev/null +++ b/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild @@ -0,0 +1,52 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 systemd + +COMMIT="f278ef19b0bc94ae93881ee4ab45fcbb03926e5f" + +DESCRIPTION="Tools for ovmf/armvirt firmware volumes" +HOMEPAGE=" + https://gitlab.com/kraxel/virt-firmware + https://pypi.org/project/virt-firmware/ +" +SRC_URI="https://gitlab.com/kraxel/virt-firmware/-/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN}-${COMMIT}" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + dev-python/cryptography[${PYTHON_USEDEP}] + dev-python/pefile[${PYTHON_USEDEP}] +" + +PATCHES=( + "${FILESDIR}/${PN}-24.2-dont-force-shim.patch" + "${FILESDIR}/${PN}-24.2-allow-cmdline-override.patch" +) + +distutils_enable_tests unittest + +python_test() { + eunittest tests +} + +python_install_all() { + distutils-r1_python_install_all + + doman man/*.1 + + doinitd "${FILESDIR}/kernel-bootcfg-boot-successful" + systemd_dounit systemd/kernel-bootcfg-boot-successful.service + + # Use our own provided by sys-kernel/installkernel[efistub] instead + #exeinto /usr/lib/kernel/install.d + #doexe systemd/99-uki-uefi-setup.install +} -- cgit v1.2.3-65-gdbad