commit:     044771fd93582ce9af74647360f2285de1b5cdc2
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 17 16:42:04 2024 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sun Mar 17 16:53:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=044771fd

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 <andrewammerlaan <AT> gentoo.org>

 ...virt-firmware-24.2-allow-cmdline-override.patch | 68 ++++++++++++++++++++++
 ...uild => virt-firmware-24.2_p20240315-r2.ebuild} | 13 ++---
 2 files changed, 73 insertions(+), 8 deletions(-)

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-r2.ebuild
similarity index 78%
rename from app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild
rename to app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild
index 5eb358eb6555..8fcfe0071043 100644
--- a/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r1.ebuild
+++ b/app-emulation/virt-firmware/virt-firmware-24.2_p20240315-r2.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..12} )
 DISTUTILS_USE_PEP517=setuptools
 
-inherit distutils-r1 optfeature systemd
+inherit distutils-r1 systemd
 
 COMMIT="f278ef19b0bc94ae93881ee4ab45fcbb03926e5f"
 
@@ -29,6 +29,7 @@ RDEPEND="
 
 PATCHES=(
        "${FILESDIR}/${PN}-24.2-dont-force-shim.patch"
+       "${FILESDIR}/${PN}-24.2-allow-cmdline-override.patch"
 )
 
 distutils_enable_tests unittest
@@ -45,11 +46,7 @@ python_install_all() {
        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]"
+       # Use our own provided by sys-kernel/installkernel[efistub] instead
+       #exeinto /usr/lib/kernel/install.d
+       #doexe systemd/99-uki-uefi-setup.install
 }

Reply via email to