From patchwork Sun Feb 22 12:07:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 81576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A2ADC624D8 for ; Sun, 22 Feb 2026 12:09:28 +0000 (UTC) Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.12210.1771762159106842288 for ; Sun, 22 Feb 2026 04:09:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=Lm5ucgv7; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.227, mailfrom: fm-1329275-202602221209158acc35333b00020743-pkhr10@rts-flowmailer.siemens.com) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202602221209158acc35333b00020743 for ; Sun, 22 Feb 2026 13:09:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=WBWVZKlG77zBp1ZqkyqtT+gtJgY5jnVr33S/4ggIFQI=; b=Lm5ucgv7Uqe9EhL8/6ZBj1xtBQgVUWPScu1xZ3JNwpWNP8V3G6srY8awlNSX3tYvfdkguV 66tUfUxZ1IkVSW++BBvWAl2h0j9o6MSmDdmeCVfpDzqq7LpEjLa7v1Vm/dIidd9bN3CMjNzw 3plRn1AleqbC2lnqisVCQmLdsHhznYfX8mJOdL/gMmO+gRQ1c6pvc8NlIaM+GdhHONek0pcl q1l2vyVFBYqIgJY9pbZVu26pifo6CN0Hgj982SKbJu3NEn0iH/ROZKZjeREDloPZzM15RH4b piCPUSK6BcPDq2BXhpxO+3MdtFtlfQoqyBs3QMxCUVx/+kZhISsqAhCA==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 1/2] image_types_wic.bbclass: add depend on initramfs Date: Sun, 22 Feb 2026 13:07:35 +0100 Message-ID: <20260222120910.318167-2-adrian.freihofer@siemens.com> In-Reply-To: <20260222120910.318167-1-adrian.freihofer@siemens.com> References: <20260222120910.318167-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Feb 2026 12:09:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/231628 From: Adrian Freihofer 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 --- meta/classes-recipe/image_types_wic.bbclass | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) } # From patchwork Sun Feb 22 12:07:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 81577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69A53C63680 for ; Sun, 22 Feb 2026 12:09:28 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.12185.1771762159113067335 for ; Sun, 22 Feb 2026 04:09:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=PfAVvfld; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-1329275-202602221209167428cbf72500020761-ukwvhq@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 202602221209167428cbf72500020761 for ; Sun, 22 Feb 2026 13:09:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=i/6lElXTq9p7Yyg+Hm7fVCk3QHcDUkaLjmD0eEhxoes=; b=PfAVvfldo04yihcFRdulMdsnAFEEMwCHTklKNKdD91i8ZS9erykhqb0hYaaVI9/GI09w8A Lz5i45Nkint6j2FIwjFHqSoKFS2o9DOoG80feNaJ8G2uGw6HY3jKAEzdftR77gGKoSJVt6/g hylaFIKzT0FaHliRmy6n4bKEi+4qxfigmM9b6uc1TyOiXVO3NI9UzOJElMc4Fg+spFtP5RyG 9M9Q0zBeVqa3p+Etx5tDkW7JT8/LbV8f/hFgdDkuBjUIf1ZX/EZnEszZRV0OWE3giIsfKvwq qTQdVCmadEMUpWRnGRR9Cj5RuvO+Xqe83pyPvIuE8HlNQRNhS/3vQSUg==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 2/2] kernel.bbclass: remove dependency on initramfs when not bundled Date: Sun, 22 Feb 2026 13:07:36 +0100 Message-ID: <20260222120910.318167-3-adrian.freihofer@siemens.com> In-Reply-To: <20260222120910.318167-1-adrian.freihofer@siemens.com> References: <20260222120910.318167-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 22 Feb 2026 12:09:28 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/231630 From: Adrian Freihofer Previously, the kernel recipe depended on the initramfs image even when INITRAMFS_IMAGE_BUNDLE was not enabled. This caused the kernel to be rebuilt whenever the initramfs image changed, regardless of whether the kernel actually included the initramfs. The problematic chain was: linux:do_deploy -> linux:do_bundle_initramfs -> image-initramfs:do_image_complete The original intent (acc. to the comment) was to ensure the initramfs image was available for tools like wic. However, apart from bundling the initramfs in the kernel, there is probably no reason why the kernel should depend on the initramfs. And it is therefore simply wrong if it does so anyway. Thus, use cases that may be broken by these change are based on a bug, not a feature. This needs to be fixed by adding a dependency on the initramfs in the right place, not in the kernel where this destroys the kernel's sstate-caching. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel.bbclass | 77 ++++++++++++++---------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass index f989b31c47..7a5ccb585a 100644 --- a/meta/classes-recipe/kernel.bbclass +++ b/meta/classes-recipe/kernel.bbclass @@ -149,16 +149,13 @@ set -e """ % (type, type, type)) - image = d.getVar('INITRAMFS_IMAGE') - # If the INTIRAMFS_IMAGE is set but the INITRAMFS_IMAGE_BUNDLE is set to 0, - # the do_bundle_initramfs does nothing, but the INITRAMFS_IMAGE is built - # standalone for use by wic and other tools. - if image: + if d.getVar('INITRAMFS_IMAGE') and bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')): if d.getVar('INITRAMFS_MULTICONFIG'): d.appendVarFlag('do_bundle_initramfs', 'mcdepends', ' mc:${BB_CURRENT_MC}:${INITRAMFS_MULTICONFIG}:${INITRAMFS_IMAGE}:do_image_complete') else: d.appendVarFlag('do_bundle_initramfs', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete') - if image and bb.utils.to_boolean(d.getVar('INITRAMFS_IMAGE_BUNDLE')): + + bb.build.addtask('do_bundle_initramfs', 'do_deploy', 'do_install', d) bb.build.addtask('do_transform_bundled_initramfs', 'do_deploy', 'do_bundle_initramfs', d) # NOTE: setting INITRAMFS_TASK is for backward compatibility @@ -305,39 +302,37 @@ copy_initramfs() { } do_bundle_initramfs () { - if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then - echo "Creating a kernel image with a bundled initramfs..." - copy_initramfs - # Backing up kernel image relies on its type(regular file or symbolic link) - tmp_path="" - for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do - if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then - linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType` - realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType` - mv -f $realpath $realpath.bak - tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath - elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then - mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak - tmp_path=$tmp_path" "$imageType"##" - fi - done - use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio - kernel_do_compile - # Restoring kernel image - for tp in $tmp_path ; do - imageType=`echo $tp|cut -d "#" -f 1` - linkpath=`echo $tp|cut -d "#" -f 2` - realpath=`echo $tp|cut -d "#" -f 3` - if [ -n "$realpath" ]; then - mv -f $realpath $realpath.initramfs - mv -f $realpath.bak $realpath - ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs - else - mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs - mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType - fi - done - fi + echo "Creating a kernel image with a bundled initramfs..." + copy_initramfs + # Backing up kernel image relies on its type(regular file or symbolic link) + tmp_path="" + for imageType in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do + if [ -h ${KERNEL_OUTPUT_DIR}/$imageType ] ; then + linkpath=`readlink -n ${KERNEL_OUTPUT_DIR}/$imageType` + realpath=`readlink -fn ${KERNEL_OUTPUT_DIR}/$imageType` + mv -f $realpath $realpath.bak + tmp_path=$tmp_path" "$imageType"#"$linkpath"#"$realpath + elif [ -f ${KERNEL_OUTPUT_DIR}/$imageType ]; then + mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.bak + tmp_path=$tmp_path" "$imageType"##" + fi + done + use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio + kernel_do_compile + # Restoring kernel image + for tp in $tmp_path ; do + imageType=`echo $tp|cut -d "#" -f 1` + linkpath=`echo $tp|cut -d "#" -f 2` + realpath=`echo $tp|cut -d "#" -f 3` + if [ -n "$realpath" ]; then + mv -f $realpath $realpath.initramfs + mv -f $realpath.bak $realpath + ln -sf $linkpath.initramfs ${B}/${KERNEL_OUTPUT_DIR}/$imageType.initramfs + else + mv -f ${KERNEL_OUTPUT_DIR}/$imageType ${KERNEL_OUTPUT_DIR}/$imageType.initramfs + mv -f ${KERNEL_OUTPUT_DIR}/$imageType.bak ${KERNEL_OUTPUT_DIR}/$imageType + fi + done } do_bundle_initramfs[dirs] = "${B}" @@ -357,8 +352,6 @@ python do_devshell:prepend () { os.environ["LDFLAGS"] = '' } -addtask bundle_initramfs after do_install before do_deploy - KERNEL_DEBUG_TIMESTAMPS ??= "0" kernel_do_compile() { @@ -860,7 +853,7 @@ kernel_do_deploy() { # ensure we get the right values for both do_deploy[prefuncs] += "read_subpackage_metadata" -addtask deploy after do_populate_sysroot do_packagedata +addtask deploy after do_install do_populate_sysroot do_packagedata EXPORT_FUNCTIONS do_deploy