Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] uki.bbclass: allow overriding the embedded os-release
@ 2026-11-29 16:57 Ricardo Salveti
  2026-11-29 20:15 ` Paul Barker
  2026-11-29 22:26 ` [PATCH v2] " Ricardo Salveti
  0 siblings, 2 replies; 5+ messages in thread
From: Ricardo Salveti @ 2026-11-29 16:57 UTC (permalink / raw)
  To: openembedded-core

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 --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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] uki.bbclass: allow overriding the embedded os-release
  2026-11-29 16:57 [PATCH] uki.bbclass: allow overriding the embedded os-release Ricardo Salveti
@ 2026-11-29 20:15 ` Paul Barker
  2026-11-29 22:25   ` Ricardo Salveti
  2026-11-29 22:26 ` [PATCH v2] " Ricardo Salveti
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Barker @ 2026-11-29 20:15 UTC (permalink / raw)
  To: Ricardo Salveti, openembedded-core

On Sun Nov 29, 2026 at 4:57 PM GMT, Ricardo Salveti wrote:
> 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>

Hi Ricardo,

Claude may understand this commit message, but sadly I don't. It's worth
remembering that reviewers of patches to openembedded-core probably
don't have the full context of an upstream project and aren't
immediately familiar with what a "type #2 entry" is for example. Please
re-work the commit message.

Best regards,

-- 
Paul Barker


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] uki.bbclass: allow overriding the embedded os-release
  2026-11-29 20:15 ` Paul Barker
@ 2026-11-29 22:25   ` Ricardo Salveti
  0 siblings, 0 replies; 5+ messages in thread
From: Ricardo Salveti @ 2026-11-29 22:25 UTC (permalink / raw)
  To: Paul Barker; +Cc: openembedded-core

Hi,

On Sun, Nov 29, 2026 at 5:15 PM Paul Barker <paul@pbarker.dev> wrote:
>
> On Sun Nov 29, 2026 at 4:57 PM GMT, Ricardo Salveti wrote:
> > 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>
>
> Hi Ricardo,
>
> Claude may understand this commit message, but sadly I don't. It's worth
> remembering that reviewers of patches to openembedded-core probably
> don't have the full context of an upstream project and aren't
> immediately familiar with what a "type #2 entry" is for example. Please
> re-work the commit message.

Sure, I can extend the commit message in a v2.

Thanks,

Ricardo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] uki.bbclass: allow overriding the embedded os-release
  2026-11-29 16:57 [PATCH] uki.bbclass: allow overriding the embedded os-release Ricardo Salveti
  2026-11-29 20:15 ` Paul Barker
@ 2026-11-29 22:26 ` Ricardo Salveti
  2026-12-04 13:36   ` Paul Barker
  1 sibling, 1 reply; 5+ messages in thread
From: Ricardo Salveti @ 2026-11-29 22:26 UTC (permalink / raw)
  To: openembedded-core

uki.bbclass copies the os-release file from the recipe sysroot into the
UKI (its .osrel section), and there is no way to use a different file:
the class always passes --os-release to ukify, which takes precedence
over UKI_CONFIG_FILE.

systemd-boot boots the UKIs placed in /EFI/Linux on the EFI system
partition without any loader entry file; the Boot Loader Specification
calls these "Type #2" entries [1]. It reads the os-release embedded in
each UKI to name it in the menu and to order them: UKIs of the same OS
are sorted by their version fields (VERSION, VERSION_ID, IMAGE_VERSION
or BUILD_ID), newest first, and by file name only when those are equal,
and the first one boots by default. A layer that installs several such
UKIs and sets their order through the file names therefore needs to
embed an os-release without the version fields, while the rootfs keeps
the full one.

Add UKI_OS_RELEASE, the os-release file embedded in the UKI. It
defaults to the os-release from the recipe sysroot, so nothing changes
unless a layer sets it.

[1] https://uapi-group.org/specifications/specs/boot_loader_specification/#type-2-efi-unified-kernel-images

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 --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
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] uki.bbclass: allow overriding the embedded os-release
  2026-11-29 22:26 ` [PATCH v2] " Ricardo Salveti
@ 2026-12-04 13:36   ` Paul Barker
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Barker @ 2026-12-04 13:36 UTC (permalink / raw)
  To: Ricardo Salveti, openembedded-core

On Sun Nov 29, 2026 at 10:26 PM GMT, Ricardo Salveti wrote:
> uki.bbclass copies the os-release file from the recipe sysroot into the
> UKI (its .osrel section), and there is no way to use a different file:
> the class always passes --os-release to ukify, which takes precedence
> over UKI_CONFIG_FILE.
>
> systemd-boot boots the UKIs placed in /EFI/Linux on the EFI system
> partition without any loader entry file; the Boot Loader Specification
> calls these "Type #2" entries [1]. It reads the os-release embedded in
> each UKI to name it in the menu and to order them: UKIs of the same OS
> are sorted by their version fields (VERSION, VERSION_ID, IMAGE_VERSION
> or BUILD_ID), newest first, and by file name only when those are equal,
> and the first one boots by default. A layer that installs several such
> UKIs and sets their order through the file names therefore needs to
> embed an os-release without the version fields, while the rootfs keeps
> the full one.
>
> Add UKI_OS_RELEASE, the os-release file embedded in the UKI. It
> defaults to the os-release from the recipe sysroot, so nothing changes
> unless a layer sets it.
>
> [1] https://uapi-group.org/specifications/specs/boot_loader_specification/#type-2-efi-unified-kernel-images
>
> AI-Generated: Uses Claude Code (Claude Opus 5.5)
> Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>

Hi Ricardo,

This patch has been merged. Would it be possible to follow up with some
test cases? We don't need to boot test the resulting UKI files, just
ensure that they get the right data.

Best regards,

-- 
Paul Barker


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-04 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 16:57 [PATCH] uki.bbclass: allow overriding the embedded os-release Ricardo Salveti
2026-11-29 20:15 ` Paul Barker
2026-11-29 22:25   ` Ricardo Salveti
2026-11-29 22:26 ` [PATCH v2] " Ricardo Salveti
2026-12-04 13:36   ` Paul Barker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox