diff mbox series

[v2,1/2] image_types_wic.bbclass: add depend on initramfs

Message ID 20260222120910.318167-2-adrian.freihofer@siemens.com
State New
Headers show
Series kernel.bbclass: remove dependency on initramfs when not bundled | expand

Commit Message

AdrianF Feb. 22, 2026, 12:07 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

When the wic image creation requires an initramfs image that is not bundled
with the kernel (INITRAMFS_IMAGE_BUNDLE != "1"), ensure that the initramfs
image is built before attempting to create the wic image by adding an
explicit dependency on do_image_complete.

Previously, this dependency was incorrectly handled by kernel.bbclass.
This change moves the responsibility to image_types_wic.bbclass where
it belongs.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes-recipe/image_types_wic.bbclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/image_types_wic.bbclass b/meta/classes-recipe/image_types_wic.bbclass
index 675aa97513..aea61d67e3 100644
--- a/meta/classes-recipe/image_types_wic.bbclass
+++ b/meta/classes-recipe/image_types_wic.bbclass
@@ -190,6 +190,18 @@  python () {
                 d.setVar('_WKS_TEMPLATE', body)
                 bb.build.addtask('do_write_wks_template', 'do_image_wic', 'do_image', d)
         bb.build.addtask('do_image_wic', 'do_image_complete', None, d)
+
+        # If the INITRAMFS_IMAGE is set and the INITRAMFS_IMAGE_BUNDLE is set to 1, the initramfs
+        # image is expected to be built as part of the kernel. Otherwise, the standalone image
+        # must be requestd to be in the deployed artifacts for the wic image to be built.
+        initramfs_image = d.getVar('INITRAMFS_IMAGE')
+        if initramfs_image and not bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')):
+            initramfs_multiconfig = d.getVar('INITRAMFS_MULTICONFIG')
+            if initramfs_multiconfig:
+                d.appendVarFlag('do_image_wic', 'mcdepends', ' mc:%s:%s:%s:do_image_complete' %
+                                (d.getVar('BB_CURRENT_MC'), initramfs_multiconfig, initramfs_image))
+            else:
+                d.appendVarFlag('do_image_wic', 'depends', ' %s:do_image_complete' % initramfs_image)
 }
 
 #