diff mbox series

uki.bbclass: make initramfs optional

Message ID 20260716095004.282348-1-nora.schiffer@ew.tq-group.com
State New
Headers show
Series uki.bbclass: make initramfs optional | expand

Commit Message

Nora Schiffer July 16, 2026, 9:50 a.m. UTC
On many platforms, the boot time can be reduced by booting without
initramfs. Allow omitting it instead of failing the build when
INITRAMFS_IMAGE is empty.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/classes-recipe/uki.bbclass | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/uki.bbclass b/meta/classes-recipe/uki.bbclass
index fa1c95603b..566eab1eaa 100644
--- a/meta/classes-recipe/uki.bbclass
+++ b/meta/classes-recipe/uki.bbclass
@@ -73,7 +73,7 @@  require ../conf/image-uefi.conf
 
 INITRAMFS_IMAGE ?= "core-image-minimal-initramfs"
 
-do_image_complete[depends] += "${INITRAMFS_IMAGE}:do_image_complete"
+do_image_complete[depends] += "${@ '${INITRAMFS_IMAGE}:do_image_complete' if d.getVar('INITRAMFS_IMAGE') else ''}"
 
 UKIFY_CMD ?= "ukify build"
 UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
@@ -127,9 +127,11 @@  python do_uki() {
     ukify_cmd += " --stub %s" % (stub)
 
     # initrd
-    uki_fstype = d.getVar("INITRAMFS_FSTYPES").split()[0]
-    initramfs_image = "%s-%s.%s" % (d.getVar('INITRAMFS_IMAGE'), d.getVar('MACHINE'), uki_fstype)
-    ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image))
+    initramfs_image = d.getVar('INITRAMFS_IMAGE')
+    if initramfs_image:
+        uki_fstype = d.getVar("INITRAMFS_FSTYPES").split()[0]
+        initramfs_file = "%s-%s.%s" % (initramfs_image, d.getVar('MACHINE'), uki_fstype)
+        ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_file))
 
     # kernel
     kernel_filename = d.getVar('UKI_KERNEL_FILENAME') or None