From: "'Quirin Gylstorff' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com, jan.kiszka@siemens.com,
felix.moessbauer@siemens.com, cedric.hombourger@siemens.com
Subject: [PATCH v5 12/12] user_manual: Add dracut for initramfs generation
Date: Thu, 30 Oct 2025 10:44:46 +0100 [thread overview]
Message-ID: <20251030094451.1303871-13-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20251030094451.1303871-1-Quirin.Gylstorff@siemens.com>
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..7133b217 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 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
@@ -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/20251030094451.1303871-13-Quirin.Gylstorff%40siemens.com.
prev parent reply other threads:[~2025-10-30 9:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 9:44 [PATCH v5 00/12] Add support for dracut 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 01/12] Add dracut to custom kernel builds 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 02/12] rootfs: Allow to overwrite the initramfs generation cmds 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 03/12] rootfs: Add isar-work directory to rootfs mounts 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 04/12] rootfs: Copy the newly created initrd.img to the work directory 'Quirin Gylstorff' via isar-users
2025-10-30 12:04 ` 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 05/12] rootfs: Add dracut to initramfs generator 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 06/12] initramfs: allow to set the generator command 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 07/12] Add class to generate custom dracut initramfs 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 08/12] rootfs: add flag to use dracut if it is not part of the package list 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 09/12] Add example dracut initramfs 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 10/12] Add dracut module helper 'Quirin Gylstorff' via isar-users
2025-10-30 11:26 ` 'Jan Kiszka' via isar-users
2025-10-30 11:53 ` 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` [PATCH v5 11/12] Use lighttpd as a example how to add a dracut module 'Quirin Gylstorff' via isar-users
2025-10-30 9:44 ` 'Quirin Gylstorff' via isar-users [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251030094451.1303871-13-Quirin.Gylstorff@siemens.com \
--to=isar-users@googlegroups.com \
--cc=Quirin.Gylstorff@siemens.com \
--cc=cedric.hombourger@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=jan.kiszka@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox