* [PATCH] kernel.bbclass: remove dependency on initramfs when not bundled
@ 2026-02-17 17:32 AdrianF
2026-02-18 17:53 ` [OE-core] " Mathieu Dubois-Briand
0 siblings, 1 reply; 3+ messages in thread
From: AdrianF @ 2026-02-17 17:32 UTC (permalink / raw)
To: openembedded-core; +Cc: Adrian Freihofer
From: Adrian Freihofer <adrian.freihofer@siemens.com>
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 <adrian.freihofer@siemens.com>
---
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
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [OE-core] [PATCH] kernel.bbclass: remove dependency on initramfs when not bundled
2026-02-17 17:32 [PATCH] kernel.bbclass: remove dependency on initramfs when not bundled AdrianF
@ 2026-02-18 17:53 ` Mathieu Dubois-Briand
2026-02-22 12:11 ` adrian.freihofer
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Dubois-Briand @ 2026-02-18 17:53 UTC (permalink / raw)
To: adrian.freihofer, openembedded-core
On Tue Feb 17, 2026 at 6:32 PM CET, Adrian Freihofer via lists.openembedded.org wrote:
> From: Adrian Freihofer <adrian.freihofer@siemens.com>
>
> 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 <adrian.freihofer@siemens.com>
> ---
Hi Adrian,
It looks like this is causing some build issues. I only saw them on
ARM64 so far:
ERROR: core-image-full-cmdline-1.0-r0 do_image_wic: Execution of '/srv/pokybuild/yocto-worker/genericarm64-alt/build/build/tmp/work/genericarm64-poky-linux/core-image-full-cmdline/1.0/temp/run.do_image_wic.2336354' failed with exit code 1
...
| INFO: Creating image(s)...
...
| ERROR: _exec_cmd: cp -v -p /srv/pokybuild/yocto-worker/genericarm64-alt/build/build/tmp/deploy/images/genericarm64/core-image-initramfs-boot-genericarm64.cpio.gz /srv/pokybuild/yocto-worker/genericarm64-alt/build/build/tmp/work/genericarm64-poky-linux/core-image-full-cmdline/1.0/tmp-wic/hdd/boot returned '1' instead of 0
| output: cp: cannot stat '/srv/pokybuild/yocto-worker/genericarm64-alt/build/build/tmp/deploy/images/genericarm64/core-image-initramfs-boot-genericarm64.cpio.gz': No such file or directory
|
https://autobuilder.yoctoproject.org/valkyrie/#/builders/22/builds/3228
https://autobuilder.yoctoproject.org/valkyrie/#/builders/60/builds/3202
Can you have a look at what is going wrong?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH] kernel.bbclass: remove dependency on initramfs when not bundled
2026-02-18 17:53 ` [OE-core] " Mathieu Dubois-Briand
@ 2026-02-22 12:11 ` adrian.freihofer
0 siblings, 0 replies; 3+ messages in thread
From: adrian.freihofer @ 2026-02-22 12:11 UTC (permalink / raw)
To: mathieu.dubois-briand, adrian.freihofer, openembedded-core
On Wed, 2026-02-18 at 18:53 +0100, Mathieu Dubois-Briand via
lists.openembedded.org wrote:
> On Tue Feb 17, 2026 at 6:32 PM CET, Adrian Freihofer via
> lists.openembedded.org wrote:
> > From: Adrian Freihofer <adrian.freihofer@siemens.com>
> >
> > 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 <adrian.freihofer@siemens.com>
> > ---
>
> Hi Adrian,
>
> It looks like this is causing some build issues. I only saw them on
> ARM64 so far:
>
> ERROR: core-image-full-cmdline-1.0-r0 do_image_wic: Execution of
> '/srv/pokybuild/yocto-worker/genericarm64-
> alt/build/build/tmp/work/genericarm64-poky-linux/core-image-full-
> cmdline/1.0/temp/run.do_image_wic.2336354' failed with exit code 1
> ...
> > INFO: Creating image(s)...
> ...
> > ERROR: _exec_cmd: cp -v -p /srv/pokybuild/yocto-
> > worker/genericarm64-
> > alt/build/build/tmp/deploy/images/genericarm64/core-image-
> > initramfs-boot-genericarm64.cpio.gz /srv/pokybuild/yocto-
> > worker/genericarm64-alt/build/build/tmp/work/genericarm64-poky-
> > linux/core-image-full-cmdline/1.0/tmp-wic/hdd/boot returned '1'
> > instead of 0
> > output: cp: cannot stat '/srv/pokybuild/yocto-worker/genericarm64-
> > alt/build/build/tmp/deploy/images/genericarm64/core-image-
> > initramfs-boot-genericarm64.cpio.gz': No such file or directory
> >
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/22/builds/3228
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/60/builds/3202
>
> Can you have a look at what is going wrong?
Thank you!
Here is a v2 which should address this issue:
https://lists.openembedded.org/g/openembedded-core/message/231629
Adrian
>
> Thanks,
> Mathieu
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#231315):
> https://lists.openembedded.org/g/openembedded-core/message/231315
> Mute This Topic: https://lists.openembedded.org/mt/117860606/4454582
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe:
> https://lists.openembedded.org/g/openembedded-core/unsub [
> adrian.freihofer@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-22 12:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17 17:32 [PATCH] kernel.bbclass: remove dependency on initramfs when not bundled AdrianF
2026-02-18 17:53 ` [OE-core] " Mathieu Dubois-Briand
2026-02-22 12:11 ` adrian.freihofer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox