public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Christoph Steiger <christoph.steiger@siemens.com>,
	isar-users@googlegroups.com
Cc: felix.moessbauer@siemens.com
Subject: Re: [PATCH 1/1] rootfs: rework no-generate-initrd rootfs feature
Date: Wed, 20 Aug 2025 18:25:25 +0200	[thread overview]
Message-ID: <2837432a-831b-495e-ada6-81cc5e4144d4@siemens.com> (raw)
In-Reply-To: <20250820141023.767004-1-christoph.steiger@siemens.com>

On 20.08.25 16:10, Christoph Steiger 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>
> ---
>  RECIPE-API-CHANGELOG.md                            | 14 ++++++++++++++
>  meta/classes/image.bbclass                         |  2 --
>  meta/classes/rootfs.bbclass                        |  8 ++++----
>  .../sbuild-chroot/sbuild-chroot.inc                |  2 +-
>  4 files changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 8468717d..ef18a0ac 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -727,3 +727,17 @@ Changes in next
>  
>  This was never documented and never had practical relevance. `oci-archive` is
>  the useful OCI image format that can be imported, e.g., by podman.
> +
> +### 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 bd1b8552..f4b07816 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -67,8 +67,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 7b7859b9..f5513277 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -14,8 +14,8 @@ ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
>  # '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 ''}"

INITRD_IMAGE is initialized to an empty string in image.bbclass.
However, if rootfs.bbclass should be used in some recipe without
inhering image as well, getVar will deliver None, and comparing that to
a string will cause an ugly error. Probably better to do (d.getVar() or '').

Jan

>  
>  ROOTFS_APT_ARGS="install --yes -o Debug::pkgProblemResolver=yes"
>  
> @@ -258,7 +258,7 @@ rootfs_restore_initrd_tooling() {
>      sudo rm -rf "${ROOTFSDIR}${ROOTFS_STUBS_DIR}"
>  }
>  
> -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
> @@ -501,7 +501,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 98e427e5..ce35497f 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_POSTPROCESS_COMMAND:remove = "rootfs_cleanup_isar_apt"
>  


-- 
Siemens AG, Foundational Technologies
Linux Expert Center

-- 
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/2837432a-831b-495e-ada6-81cc5e4144d4%40siemens.com.

  reply	other threads:[~2025-08-20 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 14:10 'Christoph Steiger' via isar-users
2025-08-20 16:25 ` 'Jan Kiszka' via isar-users [this message]
2025-08-20 16:30   ` 'Jan Kiszka' via isar-users

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=2837432a-831b-495e-ada6-81cc5e4144d4@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=christoph.steiger@siemens.com \
    --cc=felix.moessbauer@siemens.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