Skip to contentSkip to conversation

dracut: extend support and tests (branch yem/dracut)

PATCH In review Yann E. MORIN 2 participants 4 messages Sep 20, 2022 – Feb 6, 2023

lore
Share & tools
lore
#0 lore raw

cover dracut: extend support and tests (branch yem/dracut)

Hello All!

Follow-up to the dracut addition, this two-patch series adds support for providing extra dracut modules, and extends the cpio+dracut runtime test accordingly.

Regards,
Yann E. MORIN.

Regards,
Yann E. MORIN.

----------------------------------------------------------------
Yann E. MORIN (2):
fs/cpio: allow users to provide their own dracut modules support/tests/cpio: extend runtime tests for extra dract modules

 fs/cpio/Config.in                                            |  5 +++++
 fs/cpio/cpio.mk                                              | 12 +++++++++++-
 support/testing/tests/fs/test_cpio.py                        |  5 ++++-
 .../tests/fs/test_cpio/modules/99cramfs/module-setup.sh      | 11 +++++++++++
 4 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/2 fs/cpio: allow users to provide their own dracut modules

Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ as dracut does not offer the possibility to look elsewhere.

Installing files in HOST_DIR/ can do done either from a host-package, or via a post-built script; there is no overlay like there is for target/. This is a bit cumbersome.

Additional modules are most probably developped in a relatively tight loop with the configuration files, so it makes sense to expose both close together.

Add an option to the fs/cpio filesystem, so users can point to a list of modules to install.

Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc Thierry Bultel <[email protected]>
Cc Adam Duskett <[email protected]>
---
 fs/cpio/Config.in |  5 +++++
 fs/cpio/cpio.mk   | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
fs/cpio/Config.in +5 -0
index bec2d9dca2..4d38276c88 100644
@@ -29,6 +29,11 @@ endchoice
 
 if BR2_TARGET_ROOTFS_CPIO_DRACUT
 
+config BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES
+	string "extra dracut modules"
+	help
+	  Space-separated list of directories containing dracut modules.
+
 config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES
 	string "dracut configuration files"
 	default "fs/cpio/dracut.conf"
fs/cpio/cpio.mk +11 -1
index d671c337df..04c8f49013 100644
@@ -50,6 +50,13 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
 
 ROOTFS_CPIO_DEPENDENCIES += host-dracut
 
+ROOTFS_CPIO_DRACUT_MODULES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES))
+ifeq ($(BR_BUILDING),y)
+ifneq ($(words $(ROOTFS_CPIO_DRACUT_MODULES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_MODULES)))))
+$(error No two dracut modules can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES setting)
+endif
+endif
+
 ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES))
 ifeq ($(BR_BUILDING),y)
 ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),)
@@ -68,10 +75,13 @@ ROOTFS_CPIO_OPTS += --no-kernel
 endif
 
 define ROOTFS_CPIO_CMD
-	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir $(HOST_DIR)/lib/dracut/modules.d
 	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
 		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
 	)
+	$(foreach m,$(ROOTFS_CPIO_DRACUT_MODULES), \
+		cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/
+	)
 	$(HOST_DIR)/bin/dracut \
 		$(ROOTFS_CPIO_OPTS) \
 		-c /dev/null \
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 2/2 support/tests/cpio: extend runtime tests for extra dract modules

In reply to Yann E. MORIN

Add a basic module that installs a single file, to check that it is properly accounted for.

---
 support/testing/tests/fs/test_cpio.py                 |  5 ++++-
 .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
support/testing/tests/fs/test_cpio.py +4 -1
index 8c0d357994..172af579bb 100644
@@ -41,9 +41,11 @@ class TestCpioDracutBase(infra.basetest.BRTest):
         BR2_PACKAGE_PV=y
         BR2_TARGET_ROOTFS_CPIO=y
         BR2_TARGET_ROOTFS_CPIO_DRACUT=y
+        BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES="{}"
         BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES="{}"
         # BR2_TARGET_ROOTFS_TAR is not set
-        """.format(" ".join(["fs/cpio/dracut.conf",
+        """.format("support/testing/tests/fs/test_cpio/modules",
+                   " ".join(["fs/cpio/dracut.conf",
                              "support/testing/tests/fs/test_cpio/dracut-cramfs.conf"]))
 
     def check_dracut(self):
@@ -57,6 +59,7 @@ class TestCpioDracutBase(infra.basetest.BRTest):
         self.assertEqual(out.find("bin/pv"), -1)
         # libz should be, because of cramfs
         self.assertNotEqual(out.find("usr/bin/mkcramfs"), -1)
+        self.assertNotEqual(out.find("usr/bin/cramfsck"), -1)
         self.assertNotEqual(out.find("usr/lib/libz.so"), -1)
 
         exit_code = boot_img(self.emulator,
support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh new file +11 -0
new file mode 100755
index 0000000000..60706c8bd9
@@ -0,0 +1,11 @@
+check() {
+    return 0
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    inst_multiple /usr/bin/cramfsck
+}
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Yann E. MORIN
Quoted 3 lines · On Tue, 20 Sep 2022 20:37:09 +0200 "Yann E. MORIN" <[email protected]>…

Yann E. MORIN (2):
fs/cpio: allow users to provide their own dracut modules support/tests/cpio: extend runtime tests for extra dract modules

Both finally applied. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot