* [RFC PATCH v3 01/10] add dracut to custom kernel builds
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 02/10] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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/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 ca90c4e9..3ab35d8d 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/20251006183214.1593195-2-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 02/10] rootfs: Allow to overwrite the initramfs generation cmds
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 01/10] add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 03/10] rootfs Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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 | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index ebe3bf4a..ef2b7376 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:
@@ -183,7 +189,7 @@ rootfs_disable_initrd_generation[weight] = "1"
rootfs_disable_initrd_generation() {
# fully disable initrd generation
sudo mkdir -p "${ROOTFSDIR}${ROOTFS_STUBS_DIR}"
- sudo cp -a ${ROOTFSDIR}/usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/update-initramfs
+ sudo cp -a ${ROOTFSDIR}/usr/bin/true ${ROOTFSDIR}${ROOTFS_STUBS_DIR}/${ROOTFS_INITRAMFS_GENERATOR_CMD}
}
ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_update"
@@ -486,12 +492,13 @@ rootfs_generate_initramfs() {
mods_total="$(find /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"; \
- update-initramfs -u -v -k "$kernel_version"; \
+ ${ROOTFS_INITRAMFS_GENERATOR_CMDLINE}; \
done;'
if [ -n "${INITRD_DEPLOY_FILE}" ]; then
if [ -f "${ROOTFSDIR}/initrd.img" ]; then
# debian (mkinitramfs)
- cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
+ sudo cp ${ROOTFSDIR}/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
+ sudo chown $(id -u):$(id -g) ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
else
# ubuntu (dracut)
cp ${ROOTFSDIR}/boot/initrd.img ${DEPLOYDIR}/${INITRD_DEPLOY_FILE}
--
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/20251006183214.1593195-3-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 03/10] rootfs Add dracut to initramfs generator
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 01/10] add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 02/10] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 04/10] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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 ef2b7376..a9f174d9 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 /initrd.img \"$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/20251006183214.1593195-4-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 04/10] initramfs: allow to set the generator command
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (2 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 03/10] rootfs Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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/20251006183214.1593195-5-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (3 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 04/10] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-09 5:22 ` 'cedric.hombourger@siemens.com' via isar-users
2025-10-09 6:21 ` 'cedric.hombourger@siemens.com' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 06/10] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
` (4 subsequent siblings)
9 siblings, 2 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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 | 49 ++++++++++++++++++++++++++++++
1 file changed, 49 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..a06296cc
--- /dev/null
+++ b/meta/classes/initrd-dracut.bbclass
@@ -0,0 +1,49 @@
+# 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 ??= ""
+DRACUT_EXTRA_DRIVERS ??= ""
+DRACUT_EXTRA_MODULES ??= ""
+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_CONFIG_PATH') or ''
+ extra_modules = d.getVar('DRACUT_CONFIG_PATH') or ''
+ enable_module_extraction = bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_LIST'))
+ 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 += "${@ extend_dracut_cmdline()}"
+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/20251006183214.1593195-6-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs
2025-10-06 18:31 ` [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-10-09 5:22 ` 'cedric.hombourger@siemens.com' via isar-users
2025-10-09 6:52 ` 'Quirin Gylstorff' via isar-users
2025-10-09 6:21 ` 'cedric.hombourger@siemens.com' via isar-users
1 sibling, 1 reply; 15+ messages in thread
From: 'cedric.hombourger@siemens.com' via isar-users @ 2025-10-09 5:22 UTC (permalink / raw)
To: quirin.gylstorff, isar-users, Kiszka, Jan, MOESSBAUER, Felix
On Mon, 2025-10-06 at 20:31 +0200, 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.
why restricting support for dracut to initramfs image recipes and not
supporting a switch to dracut for "normal" rootfs? I believe your patch
series provides all the required infrastructure to support both use-
cases
>
> 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 | 49
> ++++++++++++++++++++++++++++++
> 1 file changed, 49 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..a06296cc
> --- /dev/null
> +++ b/meta/classes/initrd-dracut.bbclass
> @@ -0,0 +1,49 @@
> +# 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 ??= ""
> +DRACUT_EXTRA_DRIVERS ??= ""
> +DRACUT_EXTRA_MODULES ??= ""
> +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_CONFIG_PATH') or ''
> + extra_modules = d.getVar('DRACUT_CONFIG_PATH') or ''
> + enable_module_extraction =
> bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_LIS
> T'))
> + 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 += "${@ extend_dracut_cmdline()}"
> +inherit initramfs
--
Cedric Hombourger
Siemens AG
www.siemens.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/3a4a50d9bf9e91cacbe7febbd8174feca248abb5.camel%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs
2025-10-09 5:22 ` 'cedric.hombourger@siemens.com' via isar-users
@ 2025-10-09 6:52 ` 'Quirin Gylstorff' via isar-users
0 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-09 6:52 UTC (permalink / raw)
To: Hombourger, Cedric (FT FDS CES LX),
isar-users, Kiszka, Jan (FT RPD CED),
Moessbauer, Felix (FT RPD CED OES-DE)
On 10/9/25 07:22, Hombourger, Cedric (FT FDS CES LX) wrote:
> On Mon, 2025-10-06 at 20:31 +0200, 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.
>
> why restricting support for dracut to initramfs image recipes and not
> supporting a switch to dracut for "normal" rootfs? I believe your patch
> series provides all the required infrastructure to support both use-
> cases
>
I didn't test it - but it should be possible to install dracut and it
should switch normal rootfs to dracut.
This needs to be done by the user.
Quirin>>
>> 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 | 49
>> ++++++++++++++++++++++++++++++
>> 1 file changed, 49 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..a06296cc
>> --- /dev/null
>> +++ b/meta/classes/initrd-dracut.bbclass
>> @@ -0,0 +1,49 @@
>> +# 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 ??= ""
>> +DRACUT_EXTRA_DRIVERS ??= ""
>> +DRACUT_EXTRA_MODULES ??= ""
>> +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_CONFIG_PATH') or ''
>> + extra_modules = d.getVar('DRACUT_CONFIG_PATH') or ''
>> + enable_module_extraction =
>> bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_LIS
>> T'))
>> + 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 += "${@ extend_dracut_cmdline()}"
>> +inherit initramfs
>
>
>
--
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/9a68b5a1-859d-4726-9199-10b66d381d6a%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs
2025-10-06 18:31 ` [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
2025-10-09 5:22 ` 'cedric.hombourger@siemens.com' via isar-users
@ 2025-10-09 6:21 ` 'cedric.hombourger@siemens.com' via isar-users
2025-10-09 6:53 ` 'Quirin Gylstorff' via isar-users
1 sibling, 1 reply; 15+ messages in thread
From: 'cedric.hombourger@siemens.com' via isar-users @ 2025-10-09 6:21 UTC (permalink / raw)
To: quirin.gylstorff, isar-users, Kiszka, Jan, MOESSBAUER, Felix
On Mon, 2025-10-06 at 20:31 +0200, 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 | 49
> ++++++++++++++++++++++++++++++
> 1 file changed, 49 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..a06296cc
> --- /dev/null
> +++ b/meta/classes/initrd-dracut.bbclass
> @@ -0,0 +1,49 @@
> +# 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 ??= ""
> +DRACUT_EXTRA_DRIVERS ??= ""
> +DRACUT_EXTRA_MODULES ??= ""
> +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_CONFIG_PATH') or ''
> + extra_modules = d.getVar('DRACUT_CONFIG_PATH') or ''
> + enable_module_extraction =
> bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_LIS
> T'))
> + 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 += "${@ extend_dracut_cmdline()}"
don't we need to pass (d) ?
> +inherit initramfs
--
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/3e2556822e83b7709ebc8c62feedb7eabdd0f610.camel%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs
2025-10-09 6:21 ` 'cedric.hombourger@siemens.com' via isar-users
@ 2025-10-09 6:53 ` 'Quirin Gylstorff' via isar-users
0 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-09 6:53 UTC (permalink / raw)
To: Hombourger, Cedric (FT FDS CES LX),
isar-users, Kiszka, Jan (FT RPD CED),
Moessbauer, Felix (FT RPD CED OES-DE)
On 10/9/25 08:21, Hombourger, Cedric (FT FDS CES LX) wrote:
> On Mon, 2025-10-06 at 20:31 +0200, 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 | 49
>> ++++++++++++++++++++++++++++++
>> 1 file changed, 49 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..a06296cc
>> --- /dev/null
>> +++ b/meta/classes/initrd-dracut.bbclass
>> @@ -0,0 +1,49 @@
>> +# 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 ??= ""
>> +DRACUT_EXTRA_DRIVERS ??= ""
>> +DRACUT_EXTRA_MODULES ??= ""
>> +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_CONFIG_PATH') or ''
>> + extra_modules = d.getVar('DRACUT_CONFIG_PATH') or ''
>> + enable_module_extraction =
>> bb.utils.to_boolean(d.getVar('DRACUT_EXTRACT_MODULES_FROM_PACKAGE_LIS
>> T'))
>> + 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 += "${@ extend_dracut_cmdline()}"
>
> don't we need to pass (d) ?
>
Yes, there is d missing i need to check why in didn't fail my tests.
Quirin
>> +inherit initramfs
>
>
--
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/e1b52096-fefa-468a-a6ab-bbcc161b5611%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 06/10] rootfs: add flag to use dracut if it is not part of the package list
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (4 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 05/10] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 07/10] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index a9f174d9..a27c2a99 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -6,9 +6,10 @@ inherit deb-dl-dir
ROOTFS_ARCH ?= "${DISTRO_ARCH}"
ROOTFS_DISTRO ?= "${DISTRO}"
+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 /initrd.img \"$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/20251006183214.1593195-7-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 07/10] Add example dracut initramfs
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (5 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 06/10] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 08/10] Add dracut module helper 'Quirin Gylstorff' via isar-users
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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/20251006183214.1593195-8-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 08/10] Add dracut module helper
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (6 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 07/10] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 09/10] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 10/10] user_manual: Add dracut for initramfs generation 'Quirin Gylstorff' via isar-users
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 UTC (permalink / raw)
To: isar-users, jan.kiszka, felix.moessbauer, cedric.hombourger
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
This adds a helper similar to initramfs-hook to generate a dracut
module.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
.../dracut-module/dracut-module.inc | 41 +++++++++++++++++++
.../dracut-module/files/module-setup.sh.tmpl | 20 +++++++++
2 files changed, 61 insertions(+)
create mode 100644 meta/recipes-initramfs/dracut-module/dracut-module.inc
create mode 100644 meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
diff --git a/meta/recipes-initramfs/dracut-module/dracut-module.inc b/meta/recipes-initramfs/dracut-module/dracut-module.inc
new file mode 100644
index 00000000..54071105
--- /dev/null
+++ b/meta/recipes-initramfs/dracut-module/dracut-module.inc
@@ -0,0 +1,41 @@
+#
+# Copyright (c) Siemens AG, 2025
+#
+# Authors:
+# Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+FILESPATH:append := ":${FILE_DIRNAME}/files"
+
+DPKG_ARCH = "all"
+
+DRACUT_MODULE_SETUP = "module-setup.sh"
+SRC_URI += "file://${DRACUT_MODULE_SETUP}.tmpl"
+
+DRACUT_REQUIRED_BINARIES = ""
+DRACUT_MODULE_DEPENDENCIES = ""
+DRACUT_MODULE_NO ??= "50"
+DRACUT_MODULE_NAME ?= "${@ d.getVar('PN')[7:] if d.getVar('PN').startswith('dracut-') else d.getVAR('PN')}"
+
+TEMPLATE_FILES:append = " \
+ ${DRACUT_MODULE_SETUP}.tmpl \
+ "
+
+TEMPLATE_VARS:append = " \
+ DRACUT_REQUIRED_BINARIES \
+ DRACUT_MODULE_DEPENDENCIES \
+ "
+DEBIAN_DEPENDS = "dracut-core"
+DRACUT_MODULE_PATH = "${D}/usr/lib/dracut/modules.d/${DRACUT_MODULE_NO}${DRACUT_MODULE_NAME}/"
+do_install[cleandirs] += "${DRACUT_MODULE_PATH}"
+do_install:append() {
+ install -m 770 ${WORKDIR}/${DRACUT_MODULE_SETUP} ${DRACUT_MODULE_PATH}
+ if [ -f ${WORKDIR}/install.sh ]; then
+ cat ${WORKDIR}/install.sh >> ${DRACUT_MODULE_PATH}/${DRACUT_MODULE_SETUP}
+ fi
+}
+
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..46477cf4
--- /dev/null
+++ b/meta/recipes-initramfs/dracut-module/files/module-setup.sh.tmpl
@@ -0,0 +1,20 @@
+#!/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
+
+ return 0
+
+}
+# Module dependency requirements.
+depends() {
+ echo "${DRACUT_MODULE_DEPENDENCIES}"
+ return 0
+
+}
+
--
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/20251006183214.1593195-9-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 09/10] Use lighttpd as a example how to add a dracut module
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (7 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 08/10] Add dracut module helper 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
2025-10-06 18:31 ` [RFC PATCH v3 10/10] user_manual: Add dracut for initramfs generation 'Quirin Gylstorff' via isar-users
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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>
---
.../dracut-example-lighttpd_0.1.bb | 26 ++++++++++
.../dracut-example-lighttpd/files/install.sh | 21 ++++++++
.../files/lighttpd.conf | 52 +++++++++++++++++++
.../files/lighttpd.service | 13 +++++
.../files/sysuser-lighttpd.conf | 3 ++
.../recipes-initramfs/images/isar-dracut.bb | 3 ++
6 files changed, 118 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..7895e689
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/dracut-example-lighttpd_0.1.bb
@@ -0,0 +1,26 @@
+#
+# Copyright (c) Siemens AG, 2025
+#
+# Authors:
+# Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+require recipes-initramfs/dracut-module/dracut-module.inc
+
+DEBIAN_DEPENDS:append = ",lighttpd"
+SRC_URI += "file://install.sh \
+ file://lighttpd.conf \
+ file://lighttpd.service \
+ file://sysuser-lighttpd.conf \
+ "
+DRACUT_REQUIRED_BINARIES = "lighttpd"
+DRACUT_MODULE_DEPENDENCIES = "systemd-network-management"
+
+do_install[cleandirs] += "${D}/usr/lib/sysusers.d/"
+do_install:append() {
+ install -m 666 ${WORKDIR}/lighttpd.conf ${DRACUT_MODULE_PATH}
+ install -m 666 ${WORKDIR}/lighttpd.service ${DRACUT_MODULE_PATH}
+ 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..e7e50ad4
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/install.sh
@@ -0,0 +1,21 @@
+install() {
+ inst_binary /usr/sbin/lighttpd
+ inst_binary /usr/sbin/lighttpd-angel
+ inst_binary /usr/sbin/lighttpd-disable-mod
+ inst_binary /usr/sbin/lighttpd-enable-mod
+ inst_multiple -o /usr/lib/lighttpd/*.so
+ inst_multiple -o /usr/share/lighttpd/*
+ inst_simple "${moddir}/lighttpd.service" "$systemdsystemunitdir/lighttpd.service"
+ 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/"
+ inst_simple "${moddir}/lighttpd.conf" /etc/lighttpd/lighttpd.conf
+ inst_sysusers lighttpd.conf
+ 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..6507ccf3
--- /dev/null
+++ b/meta-isar/recipes-initramfs/dracut-example-lighttpd/files/sysuser-lighttpd.conf
@@ -0,0 +1,3 @@
+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..95739b12 100644
--- a/meta-isar/recipes-initramfs/images/isar-dracut.bb
+++ b/meta-isar/recipes-initramfs/images/isar-dracut.bb
@@ -14,4 +14,7 @@ INITRAMFS_PREINSTALL += " \
# Recipes that should be installed into the initramfs build rootfs.
INITRAMFS_INSTALL += " \
+ dracut-example-lighttpd \
"
+
+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/20251006183214.1593195-10-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [RFC PATCH v3 10/10] user_manual: Add dracut for initramfs generation
2025-10-06 18:31 [RFC PATCH v3 00/10] Add support for dracut 'Quirin Gylstorff' via isar-users
` (8 preceding siblings ...)
2025-10-06 18:31 ` [RFC PATCH v3 09/10] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
@ 2025-10-06 18:31 ` 'Quirin Gylstorff' via isar-users
9 siblings, 0 replies; 15+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-10-06 18:31 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 | 51 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 47 insertions(+), 4 deletions(-)
diff --git a/doc/user_manual.md b/doc/user_manual.md
index 67f91973..a4707f0a 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1680,10 +1680,11 @@ SRC_URI += "docker://debian;digest=sha256:f528891ab1aa484bf7233dbcc84f3c806c3e42
## 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
@@ -1720,6 +1721,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 include file `recipes-initramfs/dracut-module/dracut-module.inc`.
+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
@@ -1733,4 +1761,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/20251006183214.1593195-11-Quirin.Gylstorff%40siemens.com.
^ permalink raw reply [flat|nested] 15+ messages in thread