* [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature
@ 2025-11-05 7:26 'Christoph Steiger' via isar-users
2025-11-06 8:42 ` 'Andreas Naumann' via isar-users
0 siblings, 1 reply; 4+ messages in thread
From: 'Christoph Steiger' via isar-users @ 2025-11-05 7:26 UTC (permalink / raw)
To: isar-users; +Cc: felix.moessbauer, jan.kiszka, Christoph Steiger
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"
--
2.39.5
--
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/20251105072630.37142-1-christoph.steiger%40siemens.com.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature
2025-11-05 7:26 [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature '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
0 siblings, 1 reply; 4+ messages in thread
From: 'Andreas Naumann' via isar-users @ 2025-11-06 8:42 UTC (permalink / raw)
To: Christoph Steiger, isar-users; +Cc: felix.moessbauer, jan.kiszka
Am 05.11.25 um 08:26 schrieb 'Christoph Steiger' via isar-users:
> 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
I stumbled over this a while ago and was suprised because I didnt see a
the change to "is now a default rootfs feature" announced anywhere.
Maybe it could be included in this Changelog entry.
> +following way:
> +```
> +ROOTFS_FEATURE:remove = "generate-initrd"
This is definitely easier to understand. Thx.
regards,
Andreas
> +```
> +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"
>
--
Andreas Naumann
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Goettingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Goettingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
--
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/95d9fef7-32c2-4b46-83e1-51cff7af961a%40emlix.com.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature
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
0 siblings, 1 reply; 4+ messages in thread
From: 'Christoph Steiger' via isar-users @ 2025-11-06 8:59 UTC (permalink / raw)
To: Andreas Naumann, isar-users; +Cc: felix.moessbauer, jan.kiszka
Hi Andreas,
> I stumbled over this a while ago and was suprised because I didnt see a
> the change to "is now a default rootfs feature" announced anywhere.
> Maybe it could be included in this Changelog entry.
The default behavior remains completely unchanged (or at least that is
the intention). The initrd was generated per default before, and the
no-generate-intird feature was missing. Now the generate-initrd feature
is enabled by default, and we generate the initrd as before.
Regards,
Christoph
--
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/79756434-1c74-434a-9079-883194ddf552%40siemens.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature
2025-11-06 8:59 ` 'Christoph Steiger' via isar-users
@ 2025-11-06 10:00 ` 'Andreas Naumann' via isar-users
0 siblings, 0 replies; 4+ messages in thread
From: 'Andreas Naumann' via isar-users @ 2025-11-06 10:00 UTC (permalink / raw)
To: Christoph Steiger, isar-users; +Cc: felix.moessbauer, jan.kiszka
Am 06.11.25 um 09:59 schrieb Christoph Steiger:
> Hi Andreas,
>
>> I stumbled over this a while ago and was suprised because I didnt see a
>> the change to "is now a default rootfs feature" announced anywhere.
>> Maybe it could be included in this Changelog entry.
> The default behavior remains completely unchanged (or at least that is
> the intention). The initrd was generated per default before, and the
> no-generate-intird feature was missing. Now the generate-initrd
> feature is enabled by default, and we generate the initrd as before.
I havn't looked into why, but since b0913306 (Delay creation of initrd
until end of rootfs install), we had to actively disable the initrd
creation for our images.
Actually now I have had a look: We reused the initramfs class in another
class, which diverted the initrd creation to another implementation.
Moving the do_generate_initramfs() to the rootfs class then had the
effect that we no longer overwrite it.
If this is not an API relevant thing, never mind.
regards,
Andreas
>
> Regards,
> Christoph
>
--
Andreas Naumann
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Goettingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Goettingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
--
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/3977cb3e-769b-4557-ad44-858fcba466ac%40emlix.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-06 10:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-05 7:26 [PATCH v3 1/1] rootfs: rework no-generate-initrd rootfs feature '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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox