public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Zhihang Wei <wzh@ilbers.de>
To: Christoph Steiger <christoph.steiger@siemens.com>,
	isar-users@googlegroups.com
Cc: felix.moessbauer@siemens.com, jan.kiszka@siemens.com
Subject: Re: [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature
Date: Fri, 7 Nov 2025 14:26:02 +0100	[thread overview]
Message-ID: <68039a95-5962-4129-9e29-0980697df46c@ilbers.de> (raw)
In-Reply-To: <20251105072630.37142-1-christoph.steiger@siemens.com>

Applied to next, thanks.

Best regards,
Zhihang

On 11/5/25 08:26, 'Christoph Steiger' via isar-users wrote:
> Instead of using a negative feature replace it with a positive one:
> generate-initrd. It can be confusing for the user why a initrd is
> generated even though no additional rootfs features are enabled.
>
> To keep default behavior the same add generate-initrd to the default
> rootfs features, unless INITRD_IMAGE is provided.
>
> Signed-off-by: Christoph Steiger <christoph.steiger@siemens.com>
> ---
>
> Changes in v3:
> - enable generate-initrd also when there are already other rootfs
>    features
>
> Changes in v2:
> - move initialisation of INITRD_IMAGE to rootfs
>
>   RECIPE-API-CHANGELOG.md                            | 14 ++++++++++++++
>   meta/classes/image.bbclass                         |  3 ---
>   meta/classes/rootfs.bbclass                        | 10 ++++++----
>   .../sbuild-chroot/sbuild-chroot.inc                |  2 +-
>   4 files changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 1826667a..1a5eba31 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -797,3 +797,17 @@ root file modifications) are required.
>   A new class called `opensbi` has been introduced that shall help writing
>   shorter recipes for custom OpenSBI builds. Usage examples can be found in
>   `meta-isar/recipes/bsp/opensbi`.
> +
> +### Rework `no-generate-initrd` rootfs feature
> +
> +This negative feature is being replaced with a positive one:
> +`generate-initrd`. The default behavior remains unchanged, as `generate-initrd`
> +is now a default rootfs feature. Disabling initrd creation can be done in the
> +following way:
> +```
> +ROOTFS_FEATURE:remove = "generate-initrd"
> +```
> +instead of
> +```
> +ROOTFS_FEATURE += "no-generate-initrd"
> +```
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 441ea936..b58711d0 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -23,7 +23,6 @@ IMAGE_FULLNAME = "${PN}-${DISTRO}-${MACHINE}"
>   
>   # These variables are used by wic and start_vm
>   KERNEL_IMAGE ?= "${IMAGE_FULLNAME}-${KERNEL_FILE}"
> -INITRD_IMAGE ?= ""
>   INITRD_DEPLOY_FILE = "${@ d.getVar('INITRD_IMAGE') or '${IMAGE_FULLNAME}-initrd.img'}"
>   
>   # This defines the deployed dtbs for reuse by imagers
> @@ -67,8 +66,6 @@ inherit essential
>   
>   ROOTFSDIR = "${IMAGE_ROOTFS}"
>   ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
> -# when using a custom initrd, do not generate one as part of the image rootfs
> -ROOTFS_FEATURES += "${@ '' if d.getVar('INITRD_IMAGE') == '' else 'no-generate-initrd'}"
>   ROOTFS_PACKAGES += "${IMAGE_PREINSTALL} ${@isar_multiarch_packages('IMAGE_INSTALL', d)}"
>   ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
>   ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index 2fef3120..32d49146 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -8,14 +8,16 @@ ROOTFS_DISTRO ?= "${DISTRO}"
>   ROOTFS_PACKAGES ?= ""
>   ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
>   
> +INITRD_IMAGE ?= ""
> +
>   # Features of the rootfs creation:
>   # available features are:
>   # 'clean-package-cache' - delete package cache from rootfs
>   # 'generate-manifest' - generate a package manifest of the rootfs into ${ROOTFS_MANIFEST_DEPLOY_DIR}
>   # 'export-dpkg-status' - exports /var/lib/dpkg/status file to ${ROOTFS_DPKGSTATUS_DEPLOY_DIR}
>   # 'clean-log-files' - delete log files that are not owned by packages
> -# 'no-generate-initrd' - do not generate debian default initrd
> -ROOTFS_FEATURES ?= ""
> +# 'generate-initrd' - generate debian default initrd
> +ROOTFS_FEATURES += "${@ 'generate-initrd' if d.getVar('INITRD_IMAGE') == '' else ''}"
>   
>   ROOTFS_APT_ARGS="install --yes -o Debug::pkgProblemResolver=yes"
>   
> @@ -349,7 +351,7 @@ rootfs_restore_initrd_tooling() {
>   EOSUDO
>   }
>   
> -ROOTFS_INSTALL_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'no-generate-initrd', 'rootfs_clear_initrd_symlinks', '', d)}"
> +ROOTFS_INSTALL_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-initrd', '', 'rootfs_clear_initrd_symlinks', d)}"
>   rootfs_clear_initrd_symlinks() {
>       sudo rm -f ${ROOTFSDIR}/initrd.img
>       sudo rm -f ${ROOTFSDIR}/initrd.img.old
> @@ -594,7 +596,7 @@ rootfs_generate_initramfs() {
>   }
>   
>   python() {
> -    if 'no-generate-initrd' not in d.getVar('ROOTFS_FEATURES', True).split():
> +    if 'generate-initrd' in d.getVar('ROOTFS_FEATURES', True).split():
>           bb.build.addtask('do_generate_initramfs', 'do_rootfs', 'do_rootfs_postprocess', d)
>           bb.build.addtask('do_generate_initramfs_setscene', None, None, d)
>   }
> diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> index 479aa91d..61d37760 100644
> --- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> +++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot.inc
> @@ -55,7 +55,7 @@ SBUILD_CHROOT_PREINSTALL_COMMON = " \
>   SBUILD_CHROOT_DIR = "${WORKDIR}/rootfs"
>   ROOTFSDIR = "${SBUILD_CHROOT_DIR}"
>   ROOTFS_PACKAGES = "${SBUILD_CHROOT_PREINSTALL}"
> -ROOTFS_FEATURES += "no-generate-initrd"
> +ROOTFS_FEATURES:remove = "generate-initrd"
>   
>   ROOTFS_INSTALL_COMMAND:remove = "rootfs_restore_initrd_tooling"
>   

-- 
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/68039a95-5962-4129-9e29-0980697df46c%40ilbers.de.

      parent reply	other threads:[~2025-11-07 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05  7:26 'Christoph Steiger' via isar-users
2025-11-06  8:42 ` 'Andreas Naumann' via isar-users
2025-11-06  8:59   ` 'Christoph Steiger' via isar-users
2025-11-06 10:00     ` 'Andreas Naumann' via isar-users
2025-11-07 13:26 ` Zhihang Wei [this message]

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=68039a95-5962-4129-9e29-0980697df46c@ilbers.de \
    --to=wzh@ilbers.de \
    --cc=christoph.steiger@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    /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