]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
uki.bbclass: make DTB packaging optional
authorViswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
Thu, 12 Mar 2026 12:58:34 +0000 (18:28 +0530)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Mar 2026 17:05:37 +0000 (17:05 +0000)
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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/uki.bbclass
meta/lib/oeqa/selftest/cases/uki.py
meta/lib/oeqa/selftest/cases/wic.py

index ea449540db66bd046cbe5d5057379ed1f4c6db27..326697a06660d8be7e4f04f56dec780061645c43 100644 (file)
@@ -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)
index 9a1aa4e2696f1a11857a7f261460f481e2181109..4265a40e9e11af02e63ab171bc655604f08c4cb7 100644 (file)
@@ -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 = ""
 
index c4bc5a42b1a60b52b9fc9ace7436183ec2c9a5eb..64424768457669279e30fa5066c5457774f1d82d 100644 (file)
@@ -1581,6 +1581,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 = ""
+
 """
         self.append_config(config)
         bitbake('core-image-base ovmf')