commit:     fe333be41312b7b84fa739a46e568217d7a51f44
Author:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 14 11:45:13 2026 +0000
Commit:     Nowa Ammerlaan <nowa <AT> gentoo <DOT> org>
CommitDate: Wed Jan 14 15:18:27 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe333be4

kernel-build.eclass: use branding to set os-release in generic-uki

Use our new branding.eclass to set the .osrel section in the
generic-uki. This overwrites the /etc/os-release that would otherwise
be used. We write this into an array and expand that later because
it makes the code more readable and this way we can avoid writing
empty lines if one or more of these variables are not set.

Signed-off-by: Nowa Ammerlaan <nowa <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/45366
Closes: https://github.com/gentoo/gentoo/pull/45366

 eclass/kernel-build.eclass | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 3d4b07dd58c0..faef6e2a9179 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -38,7 +38,7 @@ _KERNEL_BUILD_ECLASS=1
 
 PYTHON_COMPAT=( python3_{11..14} )
 
-inherit multiprocessing python-any-r1 savedconfig secureboot
+inherit branding multiprocessing python-any-r1 savedconfig secureboot
 inherit toolchain-funcs kernel-install
 
 BDEPEND="
@@ -575,6 +575,18 @@ kernel-build_src_install() {
                                "rescue"
                        )
 
+                       local os_release=(
+                               ${BRANDING_OS_NAME+"NAME='${BRANDING_OS_NAME}'"}
+                               ${BRANDING_OS_ID+"ID='${BRANDING_OS_ID}'"}
+                               
${BRANDING_OS_ID_LIKE+"ID_LIKE='${BRANDING_OS_ID_LIKE}'"}
+                               
${BRANDING_OS_HOME_URL+"HOME_URL='${BRANDING_OS_HOME_URL}'"}
+                               
${BRANDING_OS_SUPPORT_URL+"SUPPORT_URL='${BRANDING_OS_SUPPORT_URL}'"}
+                               
${BRANDING_OS_BUG_REPORT_URL+"BUG_REPORT_URL='${BRANDING_OS_BUG_REPORT_URL}'"}
+                               
${BRANDING_OS_VERSION+"VERSION='${BRANDING_OS_VERSION}'"}
+                               
${BRANDING_OS_VERSION_ID+"VERSION_ID='${BRANDING_OS_VERSION_ID}'"}
+                               
${BRANDING_OS_PRETTY_NAME+"PRETTY_NAME='${BRANDING_OS_PRETTY_NAME}'"}
+                       )
+
                        local ukify_args=(
                                --linux="${image}"
                                --initrd="${image%/*}/initrd"
@@ -582,6 +594,7 @@ kernel-build_src_install() {
                                --output="${image%/*}/uki.efi"
                                --profile="${profiles[0]}"
                                --cmdline="${cmdlines[0]}"
+                               --os-release="$(printf '%s\n' 
"${os_release[@]}")"
                        ) # 0th profile is default
 
                        # Additional profiles have to be added with 
--join-profile

Reply via email to