public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v6 00/13] Add support for dracut
@ 2025-11-05  9:29 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 01/13] Add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Debian intends to change the default initrd generator from
initramfs-tools to dracut[1],[2].

This is a first draft to support multiple initrd generator in
ISAR. I tested it with bookworm and trixie.

You can switch a normal Debian version to a dracut based initrd
by installing the package `dracut`. This similar to a normal Debian
installation.

Customizing the initrd generation should be done with a seperate recipe
which inherit `initrd-dracut`. This is intentionally done to avoid
installing packages which are only used by the initrd generation process.

[1]: https://salsa.debian.org/kernel-team/meetings/-/wikis/20250730
[2]: https://meetbot.debian.net/debian-kernel/2025/debian-kernel.2025-08-06-19.00.log.html

Changes v6:
 - rebase on commit 666c5e571b46d9b3e34158163e74b4a89c89bfe7
 - use class instead of inc
 - fail early if dracut generation fail

Changes v5:
 - cleanup formatting
 - Add additional comments
 - Add isar-work mount point to the rootfs to copy the initrd to the workdir
 - make the build compatible with ubuntu
 - use the feature to derive the  module name from the installed package

Changes v4:
 - fix extra_modules and extra_drivers
 - extend user_manual to switch normal installation to dracut

Changes v3:
 - drop initramfs patch
 - add examples
 - add user_manual section

Changes v2:
 - extract the initramfs-cmd from the cmdline
 - increase version of enable-fsck
 - add function to print an error in case a invalid package is installed

Quirin Gylstorff (13):
  Add dracut to custom kernel builds
  rootfs: Allow to overwrite the initramfs generation cmds
  rootfs: Add isar-work directory to rootfs mounts
  rootfs: Copy the newly created initrd.img to the work directory
  rootfs: Add dracut to initramfs generator
  rootfs: exit immediately if INITRAMFS_GENERATOR_CMD fails
  initramfs: allow to set the generator command
  Add class to generate custom dracut initramfs
  rootfs: add flag to use dracut if it is not part of the package list
  Add example dracut initramfs
  Add dracut module helper
  Use lighttpd as a example how to add a dracut module
  user_manual: Add dracut for initramfs generation

 doc/user_manual.md                            | 73 +++++++++++++++-
 .../dracut-example-lighttpd_0.1.bb            | 44 ++++++++++
 .../dracut-example-lighttpd/files/install.sh  | 20 +++++
 .../files/lighttpd.conf                       | 52 +++++++++++
 .../files/lighttpd.service                    | 13 +++
 .../files/sysuser-lighttpd.conf               |  2 +
 .../recipes-initramfs/images/isar-dracut.bb   | 25 ++++++
 meta/classes/dracut-module.bbclass            | 87 +++++++++++++++++++
 meta/classes/initramfs.bbclass                | 19 +++-
 meta/classes/initrd-dracut.bbclass            | 58 +++++++++++++
 meta/classes/rootfs.bbclass                   | 43 ++++++---
 .../dracut-module/files/module-setup.sh.tmpl  | 42 +++++++++
 meta/recipes-kernel/linux/linux-custom.inc    |  2 +-
 13 files changed, 461 insertions(+), 19 deletions(-)
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf
 create mode 100644 meta-isar/recipes-initramfs/images/isar-dracut.bb
 create mode 100644 meta/classes/dracut-module.bbclass
 create mode 100644 meta/classes/initrd-dracut.bbclass
 create mode 100644 meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl

-- 
2.51.0

-- 
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/20251105093710.19582-1-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 01/13] Add dracut to custom kernel builds
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 02/13] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This change makes it possible to install dracut without initramfs tools.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/recipes-kernel/linux/linux-custom.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f2892921..c909d30b 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -31,7 +31,7 @@ KBUILD_DEPENDS ?= "build-essential:native, \
                    linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
                    rsync,"
 
-KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
+KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool | dracut, \
                           kmod, \
                           linux-base (>= 4.3~),"
 
-- 
2.51.0

-- 
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/20251105093710.19582-2-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 02/13] rootfs: Allow to overwrite the initramfs generation cmds
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 01/13] Add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 03/13] rootfs: Add isar-work directory to rootfs mounts 'Quirin Gylstorff' via isar-users
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This is in preparation to support additional initramfs generators
like dracut.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index e9e8cde0..b295a99e 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -5,7 +5,13 @@ inherit deb-dl-dir
 
 ROOTFS_ARCH ?= "${DISTRO_ARCH}"
 ROOTFS_DISTRO ?= "${DISTRO}"
+
+def initramfs_generator_cmdline(d):
+    return "update-initramfs -u -v -k \"$kernel_version\""
+
 ROOTFS_PACKAGES ?= ""
+ROOTFS_INITRAMFS_GENERATOR_CMD = "${@ d.getVar('ROOTFS_INITRAMFS_GENERATOR_CMDLINE').split()[0]}"
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE = "${@ initramfs_generator_cmdline(d)}"
 ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
 
 # Features of the rootfs creation:
@@ -255,7 +261,7 @@ rootfs_disable_initrd_generation() {
     set -e
 
     mkdir -p "${ROOTFSDIR}${ROOTFS_STUBS_DIR}"
-    ln -s /usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/update-initramfs
+    ln -s /usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/${ROOTFS_INITRAMFS_GENERATOR_CMD}
 
     mkdir -p '${ROOTFSDIR}/etc/apt/apt.conf.d'
     echo 'DPkg::Path ${ROOTFS_STUBS_DIR}:/usr/sbin:/usr/bin:/sbin:/bin;' \
@@ -589,7 +595,7 @@ rootfs_generate_initramfs() {
             echo "Total number of modules: $mods_total"
             echo "Generating initrd for kernel version: $kernel_version"
             sudo -E chroot "${ROOTFSDIR}" sh -c ' \
-                update-initramfs -u -v -k "$kernel_version"'
+                ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE};'
         done
         if [ -n "${INITRD_DEPLOY_FILE}" ]; then
             if [ -f "${ROOTFSDIR}/initrd.img" ]; then
-- 
2.51.0

-- 
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/20251105093710.19582-3-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 03/13] rootfs: Add isar-work directory to rootfs mounts
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 01/13] Add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 02/13] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 04/13] rootfs: Copy the newly created initrd.img to the work directory 'Quirin Gylstorff' via isar-users
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This in preparation for dracut. `dracut` creates the initrd.img with
0600 permission. These permission makes it necessary to copy
the initrd.img from the sudo context to the deploy dir.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index b295a99e..c683d5d2 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -139,6 +139,12 @@ rootfs_do_mounts() {
                 mount -o bind,private '${REPO_ISAR_DIR}/${DISTRO}' '${ROOTFSDIR}/isar-apt'
         fi
 
+        if [ ! -e '$ROOTFSDIR'/isar-work ]; then
+            mkdir -p '${ROOTFSDIR}/isar-work'
+            mountpoint -q '${ROOTFSDIR}/isar-work' || \
+                mount -o bind,private '${WORKDIR}' '${ROOTFSDIR}/isar-work'
+        fi
+
         # Mount base-apt if 'ISAR_USE_CACHED_BASE_REPO' is set
         if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')))}" = 'True' ]
         then
@@ -163,6 +169,11 @@ rootfs_do_umounts() {
             rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/base-apt
         fi
 
+        if mountpoint -q '${ROOTFSDIR}/isar-work'; then
+            umount '${ROOTFSDIR}/isar-work'
+            rmdir --ignore-fail-on-non-empty ${ROOTFSDIR}/isar-work
+        fi
+
         if mountpoint -q '${ROOTFSDIR}/dev/pts'; then
             umount '${ROOTFSDIR}/dev/pts'
         fi
-- 
2.51.0

-- 
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/20251105093710.19582-4-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 04/13] rootfs: Copy the newly created initrd.img to the work directory
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (2 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 03/13] rootfs: Add isar-work directory to rootfs mounts 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 05/13] rootfs: Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows to change the permissions of the initrd to 0644. And
all followup steps do not need sudo.

This is necessary as dracut creates the initrd with 0600 permissions.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index c683d5d2..78da8a4b 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -606,17 +606,11 @@ rootfs_generate_initramfs() {
             echo "Total number of modules: $mods_total"
             echo "Generating initrd for kernel version: $kernel_version"
             sudo -E chroot "${ROOTFSDIR}" sh -c ' \
-                ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE};'
+                ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}; \
+                find /boot -name "initrd.img-$kernel_version*" -exec install --mode 0644 {} /isar-work/initrd.img \; \
+                '
         done
-        if [ -n "${INITRD_DEPLOY_FILE}" ]; then
-            if [ -f "${ROOTFSDIR}/initrd.img" ]; then
-                # debian (mkinitramfs)
-                cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
-            else
-                # ubuntu (dracut)
-                cp ${ROOTFSDIR}/boot/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
-            fi
-        fi
+        install --owner $(id -u) --group $(id -g) ${WORKDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
     else
         echo "no kernel in this rootfs, do not generate initrd"
     fi
-- 
2.51.0

-- 
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/20251105093710.19582-5-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 05/13] rootfs: Add dracut to initramfs generator
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (3 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 04/13] rootfs: Copy the newly created initrd.img to the work directory 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 06/13] rootfs: exit immediately if INITRAMFS_GENERATOR_CMD fails 'Quirin Gylstorff' via isar-users
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 78da8a4b..b7c8301b 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -7,6 +7,9 @@ ROOTFS_ARCH ?= "${DISTRO_ARCH}"
 ROOTFS_DISTRO ?= "${DISTRO}"
 
 def initramfs_generator_cmdline(d):
+    rootfs_packages =  d.getVar('ROOTFS_PACKAGES') or ''
+    if 'dracut' in rootfs_packages:
+        return "dracut --force --kver \"$kernel_version\""
     return "update-initramfs -u -v -k \"$kernel_version\""
 
 ROOTFS_PACKAGES ?= ""
-- 
2.51.0

-- 
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/20251105093710.19582-6-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 06/13] rootfs: exit immediately if INITRAMFS_GENERATOR_CMD fails
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (4 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 05/13] rootfs: Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 07/13] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This avoids an missing initrd if the dracut generation fails,
but followup commands succeed.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index b7c8301b..f10007c7 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -608,7 +608,7 @@ rootfs_generate_initramfs() {
             mods_total="$(find ${ROOTFSDIR}/usr/lib/modules/$kernel_version -type f -name '*.ko*' | wc -l)"
             echo "Total number of modules: $mods_total"
             echo "Generating initrd for kernel version: $kernel_version"
-            sudo -E chroot "${ROOTFSDIR}" sh -c ' \
+            sudo -E chroot "${ROOTFSDIR}" sh -ec ' \
                 ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}; \
                 find /boot -name "initrd.img-$kernel_version*" -exec install --mode 0644 {} /isar-work/initrd.img \; \
                 '
-- 
2.51.0

-- 
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/20251105093710.19582-7-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 07/13] initramfs: allow to set the generator command
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (5 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 06/13] rootfs: exit immediately if INITRAMFS_GENERATOR_CMD fails 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 08/13] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows to exchange the initramfs generator.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/initramfs.bbclass | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/meta/classes/initramfs.bbclass b/meta/classes/initramfs.bbclass
index 658ef0ac..862bd873 100644
--- a/meta/classes/initramfs.bbclass
+++ b/meta/classes/initramfs.bbclass
@@ -10,6 +10,7 @@ INITRAMFS_INSTALL ?= ""
 INITRAMFS_PREINSTALL ?= ""
 INITRAMFS_ROOTFS ?= "${WORKDIR}/rootfs"
 INITRAMFS_IMAGE_NAME = "${INITRAMFS_FULLNAME}.initrd.img"
+INITRAMFS_GENERATOR_PKG ??= "initramfs-tools"
 INITRD_DEPLOY_FILE = "${INITRAMFS_IMAGE_NAME}"
 
 # Install proper kernel
@@ -26,6 +27,20 @@ DEPENDS += "${INITRAMFS_INSTALL}"
 
 ROOTFSDIR = "${INITRAMFS_ROOTFS}"
 ROOTFS_FEATURES = "generate-manifest"
-ROOTFS_PACKAGES = "initramfs-tools ${INITRAMFS_PREINSTALL} ${INITRAMFS_INSTALL}"
-
+ROOTFS_PACKAGES = "${INITRAMFS_GENERATOR_PKG} ${INITRAMFS_PREINSTALL} ${INITRAMFS_INSTALL}"
+
+# validate if have incompatible packages in the installation list
+python do_validate_rootfs_packages () {
+    # in Debian initramfs-tools specific packages should end or star
+    # with initramfs
+    # dracut specific packages end with dracut
+    incompatible_initrd_packages = { 'initramfs-tools':['dracut'],
+                                     'dracut':['initramfs']}
+    initrd_generator = d.getVar("INITRAMFS_GENERATOR_PKG")
+    for invalid_generator_idenitifier in incompatible_initrd_packages.get(initrd_generator):
+        for pkg in d.getVar('ROOTFS_PACKAGES').split():
+            if invalid_generator_idenitifier  in pkg:
+                bb.error(f"{pkg} is incompatible with the selected generator '{initrd_generator}'")
+}
+addtask do_validate_rootfs_packages before do_rootfs_install
 inherit rootfs
-- 
2.51.0

-- 
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/20251105093710.19582-8-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 08/13] Add class to generate custom dracut initramfs
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (6 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 07/13] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05 10:16   ` 'Jan Kiszka' via isar-users
  2025-11-05  9:29 ` [PATCH v6 09/13] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This class allows to customize a dracut initramfs by using
configuration files add addition modules and drivers.

It is recommended to use the addition of modules and drivers
sparely and prefer dracut configuration files.

This class has the option to add custom modules automatically to
the initramfs if:
 - The modules are provided by the ISAR build system
 - The module name is part of the package name, valid names are
   - dracut-<module-name>
   - <module-name>-dracut
   - <something>-dracut-<module-name>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/initrd-dracut.bbclass | 58 ++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 meta/classes/initrd-dracut.bbclass

diff --git a/meta/classes/initrd-dracut.bbclass b/meta/classes/initrd-dracut.bbclass
new file mode 100644
index 00000000..0602c364
--- /dev/null
+++ b/meta/classes/initrd-dracut.bbclass
@@ -0,0 +1,58 @@
+# This software is a part of ISAR.
+# This class provides the necessary options to
+# customize a dracut based initramfs.
+#
+# This class should not provide every dracut cmdline
+# option possible. Use the dracut configuration files.
+
+INITRAMFS_GENERATOR_PKG = "dracut"
+
+# The preferred way to configure dracut is to
+# provide dracut-config-<your-config> package which
+# contains all necessary config options
+DRACUT_CONFIG_PATH ??= ""
+
+# Variable to add additional kernel driver to the initrd
+DRACUT_EXTRA_DRIVERS ??= ""
+
+# Variable to add additional dracut modules to the initrd
+DRACUT_EXTRA_MODULES ??= ""
+
+# This option does not work with some of the dracut modules in Debian
+# as there is no standardized mapping between module name and package name
+DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES ??= "False"
+
+def extend_dracut_cmdline(d):
+    config_path = d.getVar('DRACUT_CONFIG_PATH') or ''
+    extra_drivers = d.getVar('DRACUT_EXTRA_DRIVERS') or ''
+    extra_modules = d.getVar('DRACUT_EXTRA_MODULES') or ''
+    enable_module_extraction = bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES'))
+    pkg_list = d.getVar('INITRAMFS_INSTALL') or ''
+
+    cmdline = []
+    modules_from_pkg_names = []
+    if enable_module_extraction:
+        for pkg in pkg_list.split():
+            # Skip dracut-config-* packages
+            if pkg.startswith('dracut-config-'):
+                continue
+            elif pkg.startswith('dracut-'):
+                modules_from_pkg_names.append(pkg[7:])
+            elif pkg.endswith('-dracut'):
+                modules_from_pkg_names.append(pkg[:-7])
+            elif '-dracut-' in pkg:
+                _, module_name = pkg.split('-dracut-', 1)
+                modules_from_pkg_names.append(module_name)
+        extra_modules = extra_modules + ' ' +' '.join(modules_from_pkg_names)
+
+    if config_path:
+        cmdline.append(f"--conf {config_path}")
+    if extra_drivers:
+        cmdline.append(f"--add-drivers {extra_drivers}")
+    if extra_modules:
+        cmdline.append(f"--add {extra_modules}")
+    return ' '.join(cmdline)
+
+ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
+
+inherit initramfs
-- 
2.51.0

-- 
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/20251105093710.19582-9-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 09/13] rootfs: add flag to use dracut if it is not part of the package list
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (7 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 08/13] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 10/13] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This is intend for version where dracut is the default initramfs where
dracut is part of the dependency tree and not explicit requested.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/rootfs.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index f10007c7..d5f863fe 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -6,9 +6,14 @@ inherit deb-dl-dir
 ROOTFS_ARCH ?= "${DISTRO_ARCH}"
 ROOTFS_DISTRO ?= "${DISTRO}"
 
+# This variable is intended to be set if dracut is
+# the default initramfs generator and it is not
+# possible to derive the value in another way
+ROOTFS_USE_DRACUT ??= ""
+
 def initramfs_generator_cmdline(d):
     rootfs_packages =  d.getVar('ROOTFS_PACKAGES') or ''
-    if 'dracut' in rootfs_packages:
+    if 'dracut' in rootfs_packages or bb.utils.to_boolean(d.getVar('ROOTFS_USE_DRACUT')):
         return "dracut --force --kver \"$kernel_version\""
     return "update-initramfs -u -v -k \"$kernel_version\""
 
-- 
2.51.0

-- 
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/20251105093710.19582-10-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 10/13] Add example dracut initramfs
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (8 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 09/13] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 11/13] Add dracut module helper 'Quirin Gylstorff' via isar-users
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../recipes-initramfs/images/isar-dracut.bb     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 meta-isar/recipes-initramfs/images/isar-dracut.bb

diff --git a/meta-isar/recipes-initramfs/images/isar-dracut.bb b/meta-isar/recipes-initramfs/images/isar-dracut.bb
new file mode 100644
index 00000000..226fdeaa
--- /dev/null
+++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb
@@ -0,0 +1,17 @@
+# Example of a custom initramfs image recipe.  The image will be deployed to
+#
+#   build/tmp/deploy/images/${MACHINE}/isar-initramfs-${DISTRO}-${MACHINE}.initrd.img
+#
+# This software is a part of ISAR.
+
+inherit initrd-dracut
+
+# Debian packages that should be installed into the system for building the
+# initramfs.  E.g. the cryptsetup package which contains initramfs scripts for
+# decrypting a root filesystem.
+INITRAMFS_PREINSTALL += " \
+    "
+
+# Recipes that should be installed into the initramfs build rootfs.
+INITRAMFS_INSTALL += " \
+    "
-- 
2.51.0

-- 
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/20251105093710.19582-11-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 11/13] Add dracut module helper
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (9 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 10/13] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05 10:15   ` 'Jan Kiszka' via isar-users
  2025-11-05  9:29 ` [PATCH v6 12/13] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 13/13] user_manual: Add dracut for initramfs generation 'Quirin Gylstorff' via isar-users
  12 siblings, 1 reply; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This adds a helper class similar to initramfs-hook
to generate a dracut module based on dpkg-raw.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/dracut-module.bbclass            | 87 +++++++++++++++++++
 .../dracut-module/files/module-setup.sh.tmpl  | 42 +++++++++
 2 files changed, 129 insertions(+)
 create mode 100644 meta/classes/dracut-module.bbclass
 create mode 100644 meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl

diff --git a/meta/classes/dracut-module.bbclass b/meta/classes/dracut-module.bbclass
new file mode 100644
index 00000000..364fb5b4
--- /dev/null
+++ b/meta/classes/dracut-module.bbclass
@@ -0,0 +1,87 @@
+#
+# Copyright (c) Siemens AG, 2025
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+FILESPATH:append = ":${LAYERDIR_core}/recipes-initramfs/dracut-module/files"
+
+DPKG_ARCH = "all"
+
+DRACUT_MODULE_SETUP = "module-setup.sh"
+SRC_URI:append = "file://${DRACUT_MODULE_SETUP}.tmpl"
+
+DRACUT_MODULE_NO ??= "50"
+DRACUT_MODULE_NAME ?= "${@ d.getVar('PN')[7:] if d.getVar('PN').startswith('dracut-') else d.getVAR('PN')}"
+
+DEBIAN_DEPENDS = "dracut-core"
+DRACUT_MODULE_PATH = "${D}/usr/lib/dracut/modules.d/${DRACUT_MODULE_NO}${DRACUT_MODULE_NAME}/"
+
+DRACUT_REQUIRED_BINARIES ??= ""
+DRACUT_MODULE_DEPENDENCIES ??= ""
+DRACUT_CHECK_CONTENT_FILE_NAME ??= ""
+DRACUT_DEPENDS_CONTENT_FILE_NAME ??= ""
+DRACUT_CMDLINE_CONTENT_FILE_NAME ??= ""
+DRACUT_INSTALL_CONTENT_FILE_NAME ??= ""
+DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME ??= ""
+
+def add_file_if_variable_is_set(d, variable_name, prefix):
+    variable = d.getVar(variable_name) or ''
+    if variable:
+        return f"{prefix}{variable}"
+    return ''
+
+def replace_marker_with_file_content(template_file, content_file, marker):
+    with open(template_file, 'r') as template_fd:
+        tmpl_content = template_fd.read()
+
+    with open(content_file, 'r') as content_fd:
+        content = content_fd.read()
+
+    new_tpml_content = tmpl_content.replace(marker, content)
+    with open(template_file, 'w') as tmpl_fd:
+        tmpl_fd.write(new_tpml_content)
+
+SRC_URI:append = " ${@ add_file_if_variable_is_set(d, 'DRACUT_CHECK_CONTENT_FILE_NAME', 'file://')} \
+            ${@ add_file_if_variable_is_set(d, 'DRACUT_DEPENDS_CONTENT_FILE_NAME', 'file://')} \
+            ${@ add_file_if_variable_is_set(d, 'DRACUT_CMDLINE_CONTENT_FILE_NAME', 'file://')} \
+            ${@ add_file_if_variable_is_set(d, 'DRACUT_INSTALL_CONTENT_FILE_NAME', 'file://')} \
+            ${@ add_file_if_variable_is_set(d, 'DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME', 'file://')}"
+
+TEMPLATE_FILES:append = " \
+    ${DRACUT_MODULE_SETUP}.tmpl \
+    "
+
+TEMPLATE_VARS:append = " \
+    DRACUT_REQUIRED_BINARIES \
+    DRACUT_MODULE_DEPENDENCIES \
+    "
+python do_add_additional_dracut_configuration() {
+    workdir = os.path.normpath(d.getVar('WORKDIR'))
+    module_setup = d.getVar('DRACUT_MODULE_SETUP')
+    module_setup_tpml = f"{module_setup}.tmpl"
+    content_file_name_to_marker = {
+        "DRACUT_CHECK_CONTENT_FILE_NAME" : "# ISAR_DRACUT_CHECK",
+        "DRACUT_DEPENDS_CONTENT_FILE_NAME" : "# ISAR_DRACUT_DEPENDS",
+        "DRACUT_CMDLINE_CONTENT_FILE_NAME" : "# ISAR_DRACUT_CMDLINE",
+        "DRACUT_INSTALL_CONTENT_FILE_NAME" : "# ISAR_DRACUT_INSTALL",
+        "DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME" : "# ISAR_DRACUT_KERNELINSTALL"
+    }
+
+    for var_name, marker in content_file_name_to_marker.items():
+        file_name = d.getVar(var_name) or ''
+        if file_name:
+            replace_marker_with_file_content(f"{workdir}/{module_setup_tpml}",
+                f"{workdir}/{file_name}", marker)
+}
+addtask add_additional_dracut_configuration before do_transform_template after do_patch
+
+do_install[cleandirs] += "${DRACUT_MODULE_PATH}"
+do_install:append() {
+    install -m 770 ${WORKDIR}/${DRACUT_MODULE_SETUP} ${DRACUT_MODULE_PATH}
+}
diff --git a/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
new file mode 100644
index 00000000..be0f4c54
--- /dev/null
+++ b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# called by dracut
+check() {
+
+    # If the binary(s) requirements are not fulfilled the module can't be installed.
+    require_binaries \
+        ${DRACUT_REQUIRED_BINARIES} \
+        || return 1
+    # ISAR_DRACUT_CHECK
+    return 0
+
+}
+
+# Module dependency requirements.
+depends() {
+    echo "${DRACUT_MODULE_DEPENDENCIES}"
+    # ISAR_DRACUT_DEPENDS
+    return 0
+
+}
+installkernel() {
+    # ISAR_DRACUT_KERNELINSTALL
+    return 0
+}
+
+cmdline() {
+    # ISAR_DRACUT_CMDLINE
+    return 0
+}
+
+install() {
+    for executable in ${DRACUT_REQUIRED_BINARIES}; do
+        if exec_path=$(command -v $executable 2>/dev/null); then
+            inst_binary "$exec_path"
+        else
+            echo "(ERROR): Unable to copy $executable" >&2
+            exit 1
+        fi
+    done
+    # ISAR_DRACUT_INSTALL
+}
-- 
2.51.0

-- 
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/20251105093710.19582-12-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 12/13] Use lighttpd as a example how to add a dracut module
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (10 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 11/13] Add dracut module helper 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  2025-11-05  9:29 ` [PATCH v6 13/13] user_manual: Add dracut for initramfs generation 'Quirin Gylstorff' via isar-users
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This example allows to add the lighttpd webserver to the
initrd. The example shows the following use cases:
 - add a own service to the initrd
 - add a user via systemd
 - add file to configure a service

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../dracut-example-lighttpd_0.1.bb            | 44 ++++++++++++++++
 .../dracut-example-lighttpd/files/install.sh  | 20 +++++++
 .../files/lighttpd.conf                       | 52 +++++++++++++++++++
 .../files/lighttpd.service                    | 13 +++++
 .../files/sysuser-lighttpd.conf               |  2 +
 .../recipes-initramfs/images/isar-dracut.bb   |  8 +++
 6 files changed, 139 insertions(+)
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service
 create mode 100644 meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf

diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb
new file mode 100644
index 00000000..847e8817
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb
@@ -0,0 +1,44 @@
+#
+# Copyright (c) Siemens AG, 2025
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+# This example adds the lighttpd server to the dracut initrd
+
+inherit dracut-module
+
+# Additional install instructions
+DRACUT_INSTALL_CONTENT_FILE_NAME = "install.sh"
+
+DEBIAN_DEPENDS:append = ",lighttpd, kbd,  passwd, \
+                   dracut-network, dbus-daemon, iproute2, \
+                   dracut-example-lighttpd, systemd-sysv, systemd-resolved, systemd-timesyncd"
+
+DEBIAN_DEPENDS:append:trixie = ", systemd-cryptsetup"
+
+
+SRC_URI += "file://lighttpd.conf \
+            file://lighttpd.service \
+            file://sysuser-lighttpd.conf \
+            "
+
+# lighttpd binaries
+DRACUT_REQUIRED_BINARIES = "lighttpd \
+                            lighttpd-angel \
+                            lighttpd-disable-mod \
+                            lighttpd-enable-mod \
+                            lighty-enable-mod \
+                            "
+# we need networking
+DRACUT_MODULE_DEPENDENCIES = "systemd-network-management"
+
+do_install[cleandirs] += "${D}/usr/lib/sysusers.d/"
+do_install() {
+        install -m 666 ${WORKDIR}/lighttpd.conf ${DRACUT_MODULE_PATH}
+        install -m 666 ${WORKDIR}/lighttpd.service ${DRACUT_MODULE_PATH}
+        # install sysuser to be used by dracut
+        install -m 666 ${WORKDIR}/sysuser-lighttpd.conf ${D}/usr/lib/sysusers.d/lighttpd.conf
+}
diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
new file mode 100644
index 00000000..b7295b94
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
@@ -0,0 +1,20 @@
+inst_multiple -o /usr/lib/lighttpd/*.so
+inst_multiple -o /usr/share/lighttpd/*
+
+inst_simple "${moddir}/lighttpd.service" "$systemdsystemunitdir/lighttpd.service"
+inst_simple "${moddir}/lighttpd.conf" /etc/lighttpd/lighttpd.conf
+
+# use the sysuser lighttpd config to create the necessary user
+inst_sysusers lighttpd.conf
+
+mkdir -p -m 0700 "$initdir/etc/lighttpd/"
+mkdir -p -m 0700 "$initdir/var/cache/lighttpd/compress"
+mkdir -p -m 0700 "$initdir/var/cache/lighttpd/uploads"
+mkdir -p -m 0700 "$initdir/var/log/lighttpd/"
+mkdir -p -m 0755 "$initdir/var/www/html"
+
+/usr/bin/install -m 0644 /usr/share/lighttpd/index.html "$initdir/var/www/html/index.html"
+touch "$moddir"/error.log
+/usr/bin/install -m 0644 "$moddir"/error.log "$initdir/var/log/lighttpd/error.log"
+chown -R www-data:www-data "$initdir/var/log/lighttpd/"
+systemctl -q --root "$initdir" enable lighttpd
diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf
new file mode 100644
index 00000000..3a1bb351
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.conf
@@ -0,0 +1,52 @@
+server.modules = (
+	"mod_indexfile",
+	"mod_access",
+	"mod_alias",
+ 	"mod_redirect",
+)
+
+server.document-root        = "/var/www/html"
+server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
+server.errorlog             = "/var/log/lighttpd/error.log"
+server.pid-file             = "/run/lighttpd.pid"
+server.username             = "www-data"
+server.groupname            = "www-data"
+server.port                 = 80
+
+# features
+#https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_feature-flagsDetails
+server.feature-flags       += ("server.h2proto" => "enable")
+server.feature-flags       += ("server.h2c"     => "enable")
+server.feature-flags       += ("server.graceful-shutdown-timeout" => 5)
+#server.feature-flags       += ("server.graceful-restart-bg" => "enable")
+
+# strict parsing and normalization of URL for consistency and security
+# https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_http-parseoptsDetails
+# (might need to explicitly set "url-path-2f-decode" = "disable"
+#  if a specific application is encoding URLs inside url-path)
+server.http-parseopts = (
+  "header-strict"           => "enable",# default
+  "host-strict"             => "enable",# default
+  "host-normalize"          => "enable",# default
+  "url-normalize-unreserved"=> "enable",# recommended highly
+  "url-normalize-required"  => "enable",# recommended
+  "url-ctrls-reject"        => "enable",# recommended
+  "url-path-2f-decode"      => "enable",# recommended highly (unless breaks app)
+ #"url-path-2f-reject"      => "enable",
+  "url-path-dotseg-remove"  => "enable",# recommended highly (unless breaks app)
+ #"url-path-dotseg-reject"  => "enable",
+ #"url-query-20-plus"       => "enable",# consistency in query string
+)
+
+index-file.names            = ( "index.php", "index.html" )
+url.access-deny             = ( "~", ".inc" )
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+# default listening port for IPv6 falls back to the IPv4 port
+include "/etc/lighttpd/conf-enabled/*.conf"
+
+#server.compat-module-load   = "disable"
+server.modules += (
+	"mod_dirlisting",
+	"mod_staticfile",
+)
diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service
new file mode 100644
index 00000000..da8c9033
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/lighttpd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Lighttpd Daemon
+DefaultDependencies=no
+
+[Service]
+Type=simple
+PIDFile=/run/lighttpd.pid
+ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
+ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
+ExecReload=/bin/kill -USR1 $MAINPID
+Restart=on-failure
+[Install]
+WantedBy=sysinit.target
diff --git a/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf
new file mode 100644
index 00000000..37060a65
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf
@@ -0,0 +1,2 @@
+g www-data - -
+u www-data - - /var/www /usr/sbin/nologin
diff --git a/meta-isar/recipes-initramfs/images/isar-dracut.bb b/meta-isar/recipes-initramfs/images/isar-dracut.bb
index 226fdeaa..aa55e360 100644
--- a/meta-isar/recipes-initramfs/images/isar-dracut.bb
+++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb
@@ -14,4 +14,12 @@ INITRAMFS_PREINSTALL += " \
 
 # Recipes that should be installed into the initramfs build rootfs.
 INITRAMFS_INSTALL += " \
+    dracut-example-lighttpd \
     "
+
+# This option does not work with some of the dracut modules in Debian
+# as there is no standardized mapping between module name and package name
+DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES = "True"
+
+# Alternative is to add the example module manually
+#DRACUT_EXTRA_MODULES += "example-lighttpd"
-- 
2.51.0

-- 
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/20251105093710.19582-13-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v6 13/13] user_manual: Add dracut for initramfs generation
  2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
                   ` (11 preceding siblings ...)
  2025-11-05  9:29 ` [PATCH v6 12/13] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
@ 2025-11-05  9:29 ` 'Quirin Gylstorff' via isar-users
  12 siblings, 0 replies; 16+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-11-05  9:29 UTC (permalink / raw)
  To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 doc/user_manual.md | 73 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 69 insertions(+), 4 deletions(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index ecb1fb2c..e7955c12 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1682,13 +1682,36 @@ CONTAINER_DELETE_AFTER_LOAD = "1"
 SRC_URI += "docker://debian;digest=sha256:f528891ab1aa484bf7233dbcc84f3c806c3e427571d75510a9d74bb5ec535b33;tag=bookworm-20240701-slim"
 ```
 
+
+## Switch from initramfs-tools to dracut
+
+To build a Isar image with dracut as the initramfs generator instead
+of initramfs-tools in Debian 13(trixie) or previous versions add dracut
+as a package to the image:
+
+```
+IMAGE_PREINSTALL +=  "dracut"
+```
+
+An dracut based initrd contains the file `/usr/lib/initrd-release`. In
+case of trixie the file has the following content:
+
+```bash
+NAME=dracut
+ID=dracut
+VERSION_ID="106-6"
+ANSI_COLOR="0;34"
+```
+
+
 ## Customize the initramfs
 
 Isar supports the customization of initramfs images by providing an
-infrastructure for quickly creating hooks and by allowing to replace the
-Debian-generated image with a separately built one.
+infrastructure for quickly creating hooks in case of `initramfs-tools`
+or modules for `dracut` by allowing to replace the Debian-generated
+image with a separately built one.
 
-### Creating initramfs hooks
+### Creating initramfs-tools hooks
 
 To create an initramfs hook that adds tools or modules to the image and may
 also run custom scripts during boot, use the include file
@@ -1725,6 +1748,33 @@ initramfs.
 
 See `initramfs-example` for an exemplary hook recipe.
 
+### Creating dracut modules
+
+To create a custom dracut module that adds tools, kernel-modules or services
+to the initrd, use the class `dracut-module`.
+It is controlled by following variables:
+
+- `DRACUT_REQUIRED_BINARIES` defines the binaries required by the module.
+- `DRACUT_MODULE_DEPENDENCIES` defines dependencies to other dracut modules.
+- `DRACUT_MODULE_NO` defines the module number which prefixes the module name
+to define the execution order.The default is `50`.
+- `DRACUT_MODULE_NAME` the name of the module which is used to install the
+module in the initrd or as a dependency to other modules. It defaults to
+`${PN}` without the prefix `dracut-`.
+- `DRACUT_MODULE_PATH` contains the path to the installed module. It is set
+to `${D}/usr/lib/dracut/modules.d/${DRACUT_MODULE_NO}${DRACUT_MODULE_NAME}/`
+
+The `install()` function is added by storing the file `install.sh` in the
+files directory of the dracut module.
+
+Other files can by added to the module by coping them to the Module folder
+with:
+```bash
+install -m 666 ${WORKDIR}/lighttpd.service ${DRACUT_MODULE_PATH}
+```
+
+See `dracut-example-lighttpd` for an exemplary hook recipe.
+
 ### Creating an initramfs image aside the rootfs
 
 To avoid shipping all tools and binaries needed to generate an initramfs, isar
@@ -1738,4 +1788,19 @@ self-built packages and `INITRAMFS_PREINSTALL` for prebuilt ones, analogously
 to the respective `IMAGE_*` variables. Note that the kernel is automatically
 added to `INITRAMFS_INSTALL` if `KERNEL_NAME` is set.
 
-See `isar-initramfs` for an example recipe.
+See `isar-initramfs` or `isar-dracut` for an example recipes.
+
+#### dracut config
+
+A dracut initramfs can be configured by the command line or a configuration file.
+The use configuration files is preferred:
+ - Debian provides dracut-config-* packages
+ - It is easier to upstream and to maintain.
+
+The configuration file can be chosen with the variable `DRACUT_CONFIG_PATH`. This variable
+contains the absolut path to the used configuration in the root file system.
+
+Still there are some use cases like debugging to add modules via the command line.
+For this the recipe meta/classes/initrd-dracut.bbclass provides the following options:
+ - `DRACUT_EXTRA_DRIVERS` add extra drivers to the dracut initrd
+ - `DRACUT_EXTRA_MODULES` add extra modules to the dracut initrd
-- 
2.51.0

-- 
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/20251105093710.19582-14-Quirin.Gylstorff%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v6 11/13] Add dracut module helper
  2025-11-05  9:29 ` [PATCH v6 11/13] Add dracut module helper 'Quirin Gylstorff' via isar-users
@ 2025-11-05 10:15   ` 'Jan Kiszka' via isar-users
  0 siblings, 0 replies; 16+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-11-05 10:15 UTC (permalink / raw)
  To: Quirin Gylstorff, isar-users, felix.moessbauer, cedric.hombourger

On 05.11.25 10:29, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This adds a helper class similar to initramfs-hook
> to generate a dracut module based on dpkg-raw.
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  meta/classes/dracut-module.bbclass            | 87 +++++++++++++++++++

I would recommend using classes-recipe directly, then our series do not
need to synchronize.

Jan

>  .../dracut-module/files/module-setup.sh.tmpl  | 42 +++++++++
>  2 files changed, 129 insertions(+)
>  create mode 100644 meta/classes/dracut-module.bbclass
>  create mode 100644 meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
> 
> diff --git a/meta/classes/dracut-module.bbclass b/meta/classes/dracut-module.bbclass
> new file mode 100644
> index 00000000..364fb5b4
> --- /dev/null
> +++ b/meta/classes/dracut-module.bbclass
> @@ -0,0 +1,87 @@
> +#
> +# Copyright (c) Siemens AG, 2025
> +#
> +# Authors:
> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +FILESPATH:append = ":${LAYERDIR_core}/recipes-initramfs/dracut-module/files"
> +
> +DPKG_ARCH = "all"
> +
> +DRACUT_MODULE_SETUP = "module-setup.sh"
> +SRC_URI:append = "file://${DRACUT_MODULE_SETUP}.tmpl"
> +
> +DRACUT_MODULE_NO ??= "50"
> +DRACUT_MODULE_NAME ?= "${@ d.getVar('PN')[7:] if d.getVar('PN').startswith('dracut-') else d.getVAR('PN')}"
> +
> +DEBIAN_DEPENDS = "dracut-core"
> +DRACUT_MODULE_PATH = "${D}/usr/lib/dracut/modules.d/${DRACUT_MODULE_NO}${DRACUT_MODULE_NAME}/"
> +
> +DRACUT_REQUIRED_BINARIES ??= ""
> +DRACUT_MODULE_DEPENDENCIES ??= ""
> +DRACUT_CHECK_CONTENT_FILE_NAME ??= ""
> +DRACUT_DEPENDS_CONTENT_FILE_NAME ??= ""
> +DRACUT_CMDLINE_CONTENT_FILE_NAME ??= ""
> +DRACUT_INSTALL_CONTENT_FILE_NAME ??= ""
> +DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME ??= ""
> +
> +def add_file_if_variable_is_set(d, variable_name, prefix):
> +    variable = d.getVar(variable_name) or ''
> +    if variable:
> +        return f"{prefix}{variable}"
> +    return ''
> +
> +def replace_marker_with_file_content(template_file, content_file, marker):
> +    with open(template_file, 'r') as template_fd:
> +        tmpl_content = template_fd.read()
> +
> +    with open(content_file, 'r') as content_fd:
> +        content = content_fd.read()
> +
> +    new_tpml_content = tmpl_content.replace(marker, content)
> +    with open(template_file, 'w') as tmpl_fd:
> +        tmpl_fd.write(new_tpml_content)
> +
> +SRC_URI:append = " ${@ add_file_if_variable_is_set(d, 'DRACUT_CHECK_CONTENT_FILE_NAME', 'file://')} \
> +            ${@ add_file_if_variable_is_set(d, 'DRACUT_DEPENDS_CONTENT_FILE_NAME', 'file://')} \
> +            ${@ add_file_if_variable_is_set(d, 'DRACUT_CMDLINE_CONTENT_FILE_NAME', 'file://')} \
> +            ${@ add_file_if_variable_is_set(d, 'DRACUT_INSTALL_CONTENT_FILE_NAME', 'file://')} \
> +            ${@ add_file_if_variable_is_set(d, 'DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME', 'file://')}"
> +
> +TEMPLATE_FILES:append = " \
> +    ${DRACUT_MODULE_SETUP}.tmpl \
> +    "
> +
> +TEMPLATE_VARS:append = " \
> +    DRACUT_REQUIRED_BINARIES \
> +    DRACUT_MODULE_DEPENDENCIES \
> +    "
> +python do_add_additional_dracut_configuration() {
> +    workdir = os.path.normpath(d.getVar('WORKDIR'))
> +    module_setup = d.getVar('DRACUT_MODULE_SETUP')
> +    module_setup_tpml = f"{module_setup}.tmpl"
> +    content_file_name_to_marker = {
> +        "DRACUT_CHECK_CONTENT_FILE_NAME" : "# ISAR_DRACUT_CHECK",
> +        "DRACUT_DEPENDS_CONTENT_FILE_NAME" : "# ISAR_DRACUT_DEPENDS",
> +        "DRACUT_CMDLINE_CONTENT_FILE_NAME" : "# ISAR_DRACUT_CMDLINE",
> +        "DRACUT_INSTALL_CONTENT_FILE_NAME" : "# ISAR_DRACUT_INSTALL",
> +        "DRACUT_INSTALLKERNEL_CONTENT_FILE_NAME" : "# ISAR_DRACUT_KERNELINSTALL"
> +    }
> +
> +    for var_name, marker in content_file_name_to_marker.items():
> +        file_name = d.getVar(var_name) or ''
> +        if file_name:
> +            replace_marker_with_file_content(f"{workdir}/{module_setup_tpml}",
> +                f"{workdir}/{file_name}", marker)
> +}
> +addtask add_additional_dracut_configuration before do_transform_template after do_patch
> +
> +do_install[cleandirs] += "${DRACUT_MODULE_PATH}"
> +do_install:append() {
> +    install -m 770 ${WORKDIR}/${DRACUT_MODULE_SETUP} ${DRACUT_MODULE_PATH}
> +}
> diff --git a/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
> new file mode 100644
> index 00000000..be0f4c54
> --- /dev/null
> +++ b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +
> +# called by dracut
> +check() {
> +
> +    # If the binary(s) requirements are not fulfilled the module can't be installed.
> +    require_binaries \
> +        ${DRACUT_REQUIRED_BINARIES} \
> +        || return 1
> +    # ISAR_DRACUT_CHECK
> +    return 0
> +
> +}
> +
> +# Module dependency requirements.
> +depends() {
> +    echo "${DRACUT_MODULE_DEPENDENCIES}"
> +    # ISAR_DRACUT_DEPENDS
> +    return 0
> +
> +}
> +installkernel() {
> +    # ISAR_DRACUT_KERNELINSTALL
> +    return 0
> +}
> +
> +cmdline() {
> +    # ISAR_DRACUT_CMDLINE
> +    return 0
> +}
> +
> +install() {
> +    for executable in ${DRACUT_REQUIRED_BINARIES}; do
> +        if exec_path=$(command -v $executable 2>/dev/null); then
> +            inst_binary "$exec_path"
> +        else
> +            echo "(ERROR): Unable to copy $executable" >&2
> +            exit 1
> +        fi
> +    done
> +    # ISAR_DRACUT_INSTALL
> +}


-- 
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/a5fb5ce1-f05f-4778-a680-9fe419c6f9de%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v6 08/13] Add class to generate custom dracut initramfs
  2025-11-05  9:29 ` [PATCH v6 08/13] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-11-05 10:16   ` 'Jan Kiszka' via isar-users
  0 siblings, 0 replies; 16+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-11-05 10:16 UTC (permalink / raw)
  To: Quirin Gylstorff, isar-users, felix.moessbauer, cedric.hombourger

On 05.11.25 10:29, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This class allows to customize a dracut initramfs by using
> configuration files add addition modules and drivers.
> 
> It is recommended to use the addition of modules and drivers
> sparely and prefer dracut configuration files.
> 
> This class has the option to add custom modules automatically to
> the initramfs if:
>  - The modules are provided by the ISAR build system
>  - The module name is part of the package name, valid names are
>    - dracut-<module-name>
>    - <module-name>-dracut
>    - <something>-dracut-<module-name>
> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  meta/classes/initrd-dracut.bbclass | 58 ++++++++++++++++++++++++++++++

Same here: classes-recipe/

Jan

>  1 file changed, 58 insertions(+)
>  create mode 100644 meta/classes/initrd-dracut.bbclass
> 
> diff --git a/meta/classes/initrd-dracut.bbclass b/meta/classes/initrd-dracut.bbclass
> new file mode 100644
> index 00000000..0602c364
> --- /dev/null
> +++ b/meta/classes/initrd-dracut.bbclass
> @@ -0,0 +1,58 @@
> +# This software is a part of ISAR.
> +# This class provides the necessary options to
> +# customize a dracut based initramfs.
> +#
> +# This class should not provide every dracut cmdline
> +# option possible. Use the dracut configuration files.
> +
> +INITRAMFS_GENERATOR_PKG = "dracut"
> +
> +# The preferred way to configure dracut is to
> +# provide dracut-config-<your-config> package which
> +# contains all necessary config options
> +DRACUT_CONFIG_PATH ??= ""
> +
> +# Variable to add additional kernel driver to the initrd
> +DRACUT_EXTRA_DRIVERS ??= ""
> +
> +# Variable to add additional dracut modules to the initrd
> +DRACUT_EXTRA_MODULES ??= ""
> +
> +# This option does not work with some of the dracut modules in Debian
> +# as there is no standardized mapping between module name and package name
> +DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES ??= "False"
> +
> +def extend_dracut_cmdline(d):
> +    config_path = d.getVar('DRACUT_CONFIG_PATH') or ''
> +    extra_drivers = d.getVar('DRACUT_EXTRA_DRIVERS') or ''
> +    extra_modules = d.getVar('DRACUT_EXTRA_MODULES') or ''
> +    enable_module_extraction = bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_NAMES'))
> +    pkg_list = d.getVar('INITRAMFS_INSTALL') or ''
> +
> +    cmdline = []
> +    modules_from_pkg_names = []
> +    if enable_module_extraction:
> +        for pkg in pkg_list.split():
> +            # Skip dracut-config-* packages
> +            if pkg.startswith('dracut-config-'):
> +                continue
> +            elif pkg.startswith('dracut-'):
> +                modules_from_pkg_names.append(pkg[7:])
> +            elif pkg.endswith('-dracut'):
> +                modules_from_pkg_names.append(pkg[:-7])
> +            elif '-dracut-' in pkg:
> +                _, module_name = pkg.split('-dracut-', 1)
> +                modules_from_pkg_names.append(module_name)
> +        extra_modules = extra_modules + ' ' +' '.join(modules_from_pkg_names)
> +
> +    if config_path:
> +        cmdline.append(f"--conf {config_path}")
> +    if extra_drivers:
> +        cmdline.append(f"--add-drivers {extra_drivers}")
> +    if extra_modules:
> +        cmdline.append(f"--add {extra_modules}")
> +    return ' '.join(cmdline)
> +
> +ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"
> +
> +inherit initramfs


-- 
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/3dfdcce8-b841-4b0f-b50b-431ecf7694af%40siemens.com.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-11-05 10:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-05  9:29 [PATCH v6 00/13] Add support for dracut 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 01/13] Add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 02/13] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 03/13] rootfs: Add isar-work directory to rootfs mounts 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 04/13] rootfs: Copy the newly created initrd.img to the work directory 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 05/13] rootfs: Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 06/13] rootfs: exit immediately if INITRAMFS_GENERATOR_CMD fails 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 07/13] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 08/13] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
2025-11-05 10:16   ` 'Jan Kiszka' via isar-users
2025-11-05  9:29 ` [PATCH v6 09/13] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 10/13] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 11/13] Add dracut module helper 'Quirin Gylstorff' via isar-users
2025-11-05 10:15   ` 'Jan Kiszka' via isar-users
2025-11-05  9:29 ` [PATCH v6 12/13] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
2025-11-05  9:29 ` [PATCH v6 13/13] user_manual: Add dracut for initramfs generation 'Quirin Gylstorff' 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