public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'MOESSBAUER, Felix' via isar-users" <isar-users@googlegroups.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "Gylstorff, Quirin" <quirin.gylstorff@siemens.com>,
	"wzh@ilbers.de" <wzh@ilbers.de>
Subject: Re: [PATCH 2/2] fix(rootfs): generate in-tree initrd as part of image install
Date: Fri, 17 Jul 2026 14:40:13 +0000	[thread overview]
Message-ID: <2dada87c8a25242a893de6668cb4048c3461c6eb.camel@siemens.com> (raw)
In-Reply-To: <20260714133422.1792603-3-felix.moessbauer@siemens.com>

On Tue, 2026-07-14 at 15:34 +0200, Felix Moessbauer wrote:
> When working with a in-tree initrd, the generation of the initrd has the
> side effect of placing the initrd in /boot as well (in addition to the
> deployment to the deploy dir). This part is currently skipped in case
> the initrd is taken from the sstate cache, leading to reproducibility
> issues of non-wic images (e.g. a rootfs tarball).
> 
> This issue remained unnoticed, as all image types that go through wic
> anyways replace the /boot part with the artifacts from the deploy dir.
> 
> We now run the initrd generator as part of the rootfs_install in case an
> in-tree initrd is used. If an out-of-tree initrd is used, the current
> logic is kept, as the rootfs from the initrd generation is not used.
> 
> Fixes: b0913306 ("Delay creation of initrd until end of rootfs ...")
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes-recipe/image.bbclass     |  2 +-
>  meta/classes-recipe/initramfs.bbclass | 38 +++++++++++++++++++++++++++
>  meta/classes-recipe/rootfs.bbclass    | 33 ++++-------------------
>  3 files changed, 44 insertions(+), 29 deletions(-)
> 
> diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
> index 4194dda4..03127ded 100644
> --- a/meta/classes-recipe/image.bbclass
> +++ b/meta/classes-recipe/image.bbclass
> @@ -488,7 +488,7 @@ EOSUDO
>          -exec touch '{}' -h -d@${SOURCE_DATE_EPOCH} ';'
>  }
>  do_rootfs_finalize[network] = "${TASK_USE_SUDO}"
> -addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess do_generate_initramfs
> +addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
>  
>  ROOTFS_QA_FIND_ARGS ?= ""
>  
> diff --git a/meta/classes-recipe/initramfs.bbclass b/meta/classes-recipe/initramfs.bbclass
> index e0a5f5ab..bfe530c4 100644
> --- a/meta/classes-recipe/initramfs.bbclass
> +++ b/meta/classes-recipe/initramfs.bbclass
> @@ -44,4 +44,42 @@ python do_validate_rootfs_packages () {
>                  bb.error(f"{pkg} is incompatible with the selected generator '{initrd_generator}'")
>  }
>  addtask do_validate_rootfs_packages before do_rootfs_install
> +
> +SSTATETASKS += "do_generate_initramfs"
> +do_generate_initramfs[cleandirs] += "${DEPLOYDIR}"
> +do_generate_initramfs[network] = "${TASK_USE_SUDO}"
> +do_generate_initramfs[sstate-inputdirs] = "${DEPLOYDIR}"
> +do_generate_initramfs[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"
> +python do_generate_initramfs() {
> +    bb.build.exec_func('rootfs_do_mounts', d)
> +    bb.build.exec_func('rootfs_do_qemu', d)
> +
> +    progress_reporter = bb.progress.ProgressHandler(d)
> +    d.rootfs_progress = progress_reporter
> +
> +    try:
> +        bb.build.exec_func('rootfs_generate_initramfs', d)
> +        bb.build.exec_func('rootfs_purge_initramfs', d)
> +    finally:
> +        bb.build.exec_func('rootfs_do_umounts', d)
> +}
> +
> +python do_generate_initramfs_setscene () {
> +    sstate_setscene(d)
> +}
> +
> +# When generating an external initrd, remove it from the rootfs to ensure
> +# identical artifacts when using the sstate cache. The remaining rootfs
> +# is not used for booting.
> +rootfs_purge_initramfs[weight] = "1"
> +rootfs_purge_initramfs() {
> +    sudo find ${ROOTFSDIR}/boot -name "initrd.img-*" -delete

As rootless was merged first, the sudo needs to be replaced by a
"run_privileged". Feel free to just update the commit or let me know if
I should send a patch.

Felix

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/2dada87c8a25242a893de6668cb4048c3461c6eb.camel%40siemens.com.

  reply	other threads:[~2026-07-17 14:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 13:34 [PATCH 0/2] Fix issue around missing initrd on partial rebuilds 'Felix Moessbauer' via isar-users
2026-07-14 13:34 ` [PATCH 1/2] rootfs: make DEPLOYDIR available to all rootfs 'Felix Moessbauer' via isar-users
2026-07-14 13:34 ` [PATCH 2/2] fix(rootfs): generate in-tree initrd as part of image install 'Felix Moessbauer' via isar-users
2026-07-17 14:40   ` 'MOESSBAUER, Felix' via isar-users [this message]
2026-07-17 14:42     ` Zhihang Wei
2026-07-14 14:32 ` [PATCH 0/2] Fix issue around missing initrd on partial rebuilds 'Quirin Gylstorff' via isar-users
2026-07-17 14:07 ` Zhihang Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2dada87c8a25242a893de6668cb4048c3461c6eb.camel@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=quirin.gylstorff@siemens.com \
    --cc=wzh@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox