public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [OE-core][meta][PATCH v2] uki.bbclass: make DTB packaging optional
@ 2026-03-11 12:25 Viswanath Kraleti
  2026-03-12  7:43 ` Mathieu Dubois-Briand
  0 siblings, 1 reply; 2+ messages in thread
From: Viswanath Kraleti @ 2026-03-11 12:25 UTC (permalink / raw)
  To: openembedded-core; +Cc: Viswanath Kraleti

According to the Unified Kernel Image (UKI) specification [1], including
a compiled device tree in the .dtb section of a UKI is optional. However,
the current implementation always packages device trees listed in
KERNEL_DEVICETREE into the UKI by default. This makes uki.bbclass
unsuitable for systems that rely on firmware-provided DTBs and do not
want a DTB embedded in the UKI.

Fix this by introducing a new UKI_DEVICETREE variable to control device
tree packaging. The .dtb section is now populated from UKI_DEVICETREE
instead of KERNEL_DEVICETREE. Users who do not want DTBs included in the
UKI can override UKI_DEVICETREE to an empty value from their recipes.

Update the UKI selftests accordingly, as QEMU does not provide a device
tree to embed.

[1] https://uapi-group.org/specifications/specs/unified_kernel_image/

Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
---
 meta/classes-recipe/uki.bbclass     | 6 ++++--
 meta/lib/oeqa/selftest/cases/uki.py | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index ea449540db..326697a066 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_DEVICETREE ?= "${KERNEL_DEVICETREE}"
 # secure boot keys and cert, needs sbsign-tools-native (meta-secure-core)
 #UKI_SB_KEY ?= ""
 #UKI_SB_CERT ?= ""
@@ -149,8 +150,9 @@ python do_uki() {
         ukify_cmd += " --cmdline='%s'" % (cmdline)
 
     # dtb
-    if d.getVar('KERNEL_DEVICETREE'):
-        for dtb in d.getVar('KERNEL_DEVICETREE').split():
+    uki_devicetree = d.getVar('UKI_DEVICETREE')
+    if uki_devicetree:
+        for dtb in uki_devicetree.split():
             # DTBs are without sub-directories in deploy_dir
             dtb_name = os.path.basename(dtb)
             dtb_path = "%s/%s" % (deploy_dir_image, dtb_name)
diff --git a/meta/lib/oeqa/selftest/cases/uki.py b/meta/lib/oeqa/selftest/cases/uki.py
index 9a1aa4e269..4265a40e9e 100644
--- a/meta/lib/oeqa/selftest/cases/uki.py
+++ b/meta/lib/oeqa/selftest/cases/uki.py
@@ -47,6 +47,9 @@ QB_DEFAULT_KERNEL = "none"
 # boot command line provided via uki, not via bootloader
 UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}"
 
+# qemu provides the devicetree at boot, do not embed a dtb in the uki for selftests
+UKI_DEVICETREE = ""
+
 # disable kvm, breaks boot
 QEMU_USE_KVM = ""
 
@@ -106,6 +109,9 @@ QB_DEFAULT_KERNEL = "none"
 # boot command line provided via uki, not via bootloader
 UKI_CMDLINE = "rootwait root=LABEL=root console=${KERNEL_CONSOLE}"
 
+# qemu provides the devicetree at boot, do not embed a dtb in the uki for selftests
+UKI_DEVICETREE = ""
+
 # disable kvm, breaks boot
 QEMU_USE_KVM = ""
 


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

* Re: [OE-core][meta][PATCH v2] uki.bbclass: make DTB packaging optional
  2026-03-11 12:25 [OE-core][meta][PATCH v2] uki.bbclass: make DTB packaging optional Viswanath Kraleti
@ 2026-03-12  7:43 ` Mathieu Dubois-Briand
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Dubois-Briand @ 2026-03-12  7:43 UTC (permalink / raw)
  To: viswanath.kraleti, openembedded-core

On Wed Mar 11, 2026 at 1:25 PM CET, Viswanath Kraleti via lists.openembedded.org wrote:
> According to the Unified Kernel Image (UKI) specification [1], including
> a compiled device tree in the .dtb section of a UKI is optional. However,
> the current implementation always packages device trees listed in
> KERNEL_DEVICETREE into the UKI by default. This makes uki.bbclass
> unsuitable for systems that rely on firmware-provided DTBs and do not
> want a DTB embedded in the UKI.
>
> Fix this by introducing a new UKI_DEVICETREE variable to control device
> tree packaging. The .dtb section is now populated from UKI_DEVICETREE
> instead of KERNEL_DEVICETREE. Users who do not want DTBs included in the
> UKI can override UKI_DEVICETREE to an empty value from their recipes.
>
> Update the UKI selftests accordingly, as QEMU does not provide a device
> tree to embed.
>
> [1] https://uapi-group.org/specifications/specs/unified_kernel_image/
>
> Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
> ---

Hi Viswanath,

Thanks for the new version.

It looks like one of the selftest is still failing:

2026-03-11 20:52:20,986 - oe-selftest - INFO - wic.Wic2.test_efi_plugin_unified_kernel_image_qemu (subunit.RemotedTestCase)
2026-03-11 20:52:20,987 - oe-selftest - INFO -  ... FAIL
...
2026-03-11 20:52:20,987 - oe-selftest - INFO - 13: 48/73 559/681 (145.46s) (0 failed) (wic.Wic2.test_efi_plugin_unified_kernel_image_qemu)
2026-03-11 20:52:20,987 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
    return func(*args, **kwargs)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/wic.py", line 1561, in test_efi_plugin_unified_kernel_image_qemu
    bitbake('core-image-base ovmf')
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py", line 236, in bitbake
    return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py", line 214, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))
AssertionError: Command 'bitbake  core-image-base ovmf' returned non-zero exit status 1:
...
ERROR: core-image-base-1.0-r0 do_uki: ERROR: cannot find /srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-4172893/tmp/deploy/images/qemux86-64/${KERNEL_DEVICETREE}.

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3383
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3273

Can you have a look at the issue?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



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

end of thread, other threads:[~2026-03-12  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 12:25 [OE-core][meta][PATCH v2] uki.bbclass: make DTB packaging optional Viswanath Kraleti
2026-03-12  7:43 ` Mathieu Dubois-Briand

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