diff mbox series

uki.bbclass: allow overriding the embedded os-release

Message ID 20261129165751.1606210-1-ricardo.salveti@oss.qualcomm.com
State New
Headers show
Series uki.bbclass: allow overriding the embedded os-release | expand

Commit Message

Ricardo Salveti Nov. 29, 2026, 4:57 p.m. UTC
systemd-boot orders type #2 entries by the version fields of the
os-release in their .osrel section before their file names. A layer
that names the UKIs to set the boot order therefore needs an os-release
without those fields in the UKI, while the rootfs keeps the full one.
UKI_CONFIG_FILE cannot provide it, as the class always passes
--os-release and ukify prefers the command line over its configuration
file. Add UKI_OS_RELEASE, defaulting to the os-release from the recipe
sysroot.

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
---
 meta/classes-recipe/uki.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index bcccf824c7..faad496f1b 100644
--- a/meta/classes-recipe/uki.bbclass
+++ b/meta/classes-recipe/uki.bbclass
@@ -80,6 +80,7 @@  UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
 UKI_FILENAME ?= "uki.efi"
 UKI_KERNEL_FILENAME ?= "${KERNEL_IMAGETYPE}"
 UKI_CMDLINE ?= "rootwait root=LABEL=root"
+UKI_OS_RELEASE ?= "${RECIPE_SYSROOT}${prefix}/lib/os-release"
 KERNEL_DEVICETREE ??= ""
 UKI_DEVICETREE ?= "${KERNEL_DEVICETREE}"
 # secure boot keys and cert, needs sbsign-tools-native (meta-secure-core)
@@ -171,8 +172,10 @@  python do_uki() {
         (d.getVar("RECIPE_SYSROOT_NATIVE"), d.getVar("prefix"))
 
     # version
-    ukify_cmd += " --os-release=@%s%s/lib/os-release" % \
-        (d.getVar("RECIPE_SYSROOT"), d.getVar("prefix"))
+    os_release = d.getVar('UKI_OS_RELEASE')
+    if not os_release or not os.path.exists(os_release):
+        bb.fatal("ERROR: cannot find os-release %s" % (os_release))
+    ukify_cmd += " --os-release=@%s" % (os_release)
 
     # TODO: tpm2 measure for secure boot, depends on systemd-native and TPM tooling
     # needed in systemd > 254 to fulfill ConditionSecurity=measured-uki