From 0f33e78d05f5e50f4734f5493255232ce1c647fa Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerl...@gentoo.org>
Date: Wed, 3 Jan 2024 11:31:15 +0100
Subject: [PATCH] kernel-build.eclass: allow overriding UKI cmdline

Signed-off-by: Andrew Ammerlaan <andrewammerl...@gentoo.org>
---
 eclass/kernel-build.eclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 28f111ec998bb..120056c5c26b2 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -1,4 +1,4 @@
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2

 # @ECLASS: kernel-build.eclass
@@ -99,6 +99,14 @@ IUSE="+strip"
 # key in PEM format to use. Must be specified if MODULES_SIGN_KEY
 # is set to a path of a file that only contains the private key.

+# @ECLASS_VARIABLE: KERNEL_GENERIC_UKI_CMDLINE
+# @USER_VARIABLE
+# @DESCRIPTION:
+# If KERNEL_IUSE_GENERIC_UKI is set, this variable allows setting the
+# built-in kernel command line for the UKI. If unset, the default is
+# root=/dev/gpt-auto-root ro
+: "${KERNEL_GENERIC_UKI_CMDLINE:="root=/dev/gpt-auto-root ro"}"
+
 if [[ ${KERNEL_IUSE_MODULES_SIGN} ]]; then
        IUSE+=" modules-sign"
        REQUIRED_USE="secureboot? ( modules-sign )"
@@ -435,7 +443,7 @@ kernel-build_src_install() {
                        local ukify_args=(
                                --linux="${image}"
                                --initrd="${image%/*}/initrd"
-                               --cmdline="root=/dev/gpt-auto-root ro"
+                               --cmdline="${KERNEL_GENERIC_UKI_CMDLINE}"
                                --uname="${dir_ver}"
                                --output="${image%/*}/uki.efi"
                        )

Reply via email to