Skip to contentSkip to conversation

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

PATCH Applied Yann E. MORIN 2 participants 15 messages Aug 19, 2022 – Sep 18, 2022

lore
Share & tools
lore
#0 lore raw

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

Hello All!

Starting with a discussion with Arnout about adding the last item in the list, this small series extends or dracut support in three ways:
- allow user to easily provide custom dracut modules
- allow user to use more than one dracut config file
- extend run-time tests to check DT_NEEDED are included, by exercising the above

Additionally, the existing run-time test about the presence of pv is redundant, so the series starts by cleaning it up.

Regards,
Yann E. MORIN.

----------------------------------------------------------------
Yann E. MORIN (4):
support/test/cpio: test for pv already done by listing the cpio archive package/dracut: allow users to provide their own modules fs/cpio: accept a list of dracut.conf files support/tests/cpio: extend runtime tests

 fs/cpio/Config.in                                     | 12 +++++++-----
 fs/cpio/cpio.mk                                       | 19 ++++++++++++++-----
 package/dracut/Config.in.host                         | 11 +++++++++++
 package/dracut/dracut.mk                              |  9 +++++++++
 support/testing/tests/fs/test_cpio.py                 | 15 ++++++++++-----
 support/testing/tests/fs/test_cpio/dracut-cramfs.conf |  7 +++++++
 .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
 7 files changed, 69 insertions(+), 15 deletions(-)
 create mode 100644 support/testing/tests/fs/test_cpio/dracut-cramfs.conf
 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/4 support/test/cpio: test for pv already done by listing the cpio archive

Since we do not pivot_root/switch_root from the cpio, whatever we get in the rootfs was exactly what we got by listing the cpio archive.

Drop the test for the presence of pv, it's redundant.

Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc Thierry Bultel <[email protected]>
Cc Adam Duskett <[email protected]>
---
 support/testing/tests/fs/test_cpio.py | 4 ----
 1 file changed, 4 deletions(-)
support/testing/tests/fs/test_cpio.py +0 -4
index 3f661e370c..9a529f1edd 100644
@@ -57,10 +57,6 @@ class TestCpioDracutBase(infra.basetest.BRTest):
                              self.builddir)
         self.assertEqual(exit_code, 0)
 
-        # No pivot_root is done, so pv shouldn't be there
-        _, exit_code = self.emulator.run("ls -l /usr/bin/pv")
-        self.assertNotEqual(exit_code, 0)
-
 
 class TestCpioDracutUclibc(TestCpioDracutBase):
     config = TestCpioDracutBase.config + \
Signature · 6 lines
2.25.1

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

Re: [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive

Quoted 9 lines · Yann E. MORIN

Since we do not pivot_root/switch_root from the cpio, whatever we get in the rootfs was exactly what we got by listing the cpio archive.

Drop the test for the presence of pv, it's redundant.

Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc Thierry Bultel <[email protected]>
Cc Adam Duskett <[email protected]>

Applied to master, thanks.

Regards,
Arnout

Quoted 9 lines
---
  support/testing/tests/fs/test_cpio.py | 4 ----
  1 file changed, 4 deletions(-)
support/testing/tests/fs/test_cpio.py +0 -0
index 3f661e370c..9a529f1edd 100644

support/testing/tests/fs/test_cpio.py class TestCpioDracutBase(infra.basetest.BRTest): · line 62

Quoted 10 lines
support/testing/tests/fs/test_cpio.py +0 -4
@@ -57,10 +57,6 @@ class TestCpioDracutBase(infra.basetest.BRTest):
                               self.builddir)
          self.assertEqual(exit_code, 0)
 
-        # No pivot_root is done, so pv shouldn't be there
-        _, exit_code = self.emulator.run("ls -l /usr/bin/pv")
-        self.assertNotEqual(exit_code, 0)
-
 
  class TestCpioDracutUclibc(TestCpioDracutBase):
      config = TestCpioDracutBase.config + \

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

#3 lore raw

PATCH 2/4 package/dracut: allow users to provide their own modules

In reply to Yann E. MORIN

Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ and 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.

Add an option to the host-dracut package, 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]>
---
 package/dracut/Config.in.host | 11 +++++++++++
 package/dracut/dracut.mk      |  9 +++++++++
 2 files changed, 20 insertions(+)
package/dracut/Config.in.host +11 -0
index 18f562b310..5756dbd43f 100644
@@ -7,3 +7,14 @@ config BR2_PACKAGE_HOST_DRACUT
 	  and combining it with the dracut framework.
 
 	  https://dracut.wiki.kernel.org
+
+if BR2_PACKAGE_HOST_DRACUT
+
+config BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES
+	string "extra dracut modules"
+	help
+	  Space-separated list of directories containing dracut modules
+	  to install. The modules will be installed alongside the ones
+	  bundled with dracut.
+
+endif
package/dracut/dracut.mk +9 -0
index 2b6a144aac..96fa7db6ba 100644
@@ -19,6 +19,15 @@ define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
 endef
 HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
 
+HOST_DRACUT_EXTRA_MODULES = $(call qstrip,$(BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES))
+define HOST_DRACUT_INSTALL_EXTRA_MODULES
+	$(Q)mkdir -p $(HOST_DIR)/lib/dracut/modules.d/
+	$(foreach m,$(HOST_DRACUT_EXTRA_MODULES), \
+		cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/
+	)
+endef
+HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_INSTALL_EXTRA_MODULES
+
 # When using uClibc or musl, there must be "ld-uClibc.so.1" or
 # "ld-musl-x.so" symlinks, respectively - else the init process cannot
 # start
Signature · 6 lines
2.25.1

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

Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules

Quoted 26 lines · Yann E. MORIN

Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ and 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.

Add an option to the host-dracut package, 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]>
---
  package/dracut/Config.in.host | 11 +++++++++++
  package/dracut/dracut.mk      |  9 +++++++++
  2 files changed, 20 insertions(+)
package/dracut/Config.in.host +0 -0
index 18f562b310..5756dbd43f 100644
@@ -7,3 +7,14 @@ config BR2_PACKAGE_HOST_DRACUT
  	  and combining it with the dracut framework.
 

package/dracut/Config.in.host config BR2_PACKAGE_HOST_DRACUT · line 18

Quoted 10 lines
package/dracut/Config.in.host +9 -0
  	  https://dracut.wiki.kernel.org
+
+if BR2_PACKAGE_HOST_DRACUT
+
+config BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES
+	string "extra dracut modules"
+	help
+	  Space-separated list of directories containing dracut modules
+	  to install. The modules will be installed alongside the ones
+	  bundled with dracut.

Although I agree that conceptually this extra modules thing belongs with the
dracut package itself, from a user, practical point of view, you actually want it in the dracut option of fs/cpio. If you use host-dracut without the cpio-dracut fs, it means you are using it in a post-build script, so it's not so weird to also install the extra modules in that script. On the other hand, if you are using cpio-dracut and you need extra modules (which is quite likely), then it extremely annoying that you have to go first to filesystems->cpio and later to hosttools->dracut...

In other words, I think this should be moved to cpio.

Regards,
Arnout

Quoted 12 lines
package/dracut/Config.in.host +2 -0
+
+endif
package/dracut/dracut.mk +2 -0
index 2b6a144aac..96fa7db6ba 100644
@@ -19,6 +19,15 @@ define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
  endef
  HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
 
+HOST_DRACUT_EXTRA_MODULES = $(call qstrip,$(BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES))
+define HOST_DRACUT_INSTALL_EXTRA_MODULES

package/dracut/dracut.mk define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT · line 33

Quoted 10 lines
package/dracut/dracut.mk +7 -0
+	$(Q)mkdir -p $(HOST_DIR)/lib/dracut/modules.d/
+	$(foreach m,$(HOST_DRACUT_EXTRA_MODULES), \
+		cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/
+	)
+endef
+HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_INSTALL_EXTRA_MODULES
+
  # When using uClibc or musl, there must be "ld-uClibc.so.1" or
  # "ld-musl-x.so" symlinks, respectively - else the init process cannot
  # start

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

#5 lore raw

Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 9 lines

Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ and 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.

Add an option to the host-dracut package, so users can point to a list of modules to install.

[--SNIP--]

Quoted 10 lines

Although I agree that conceptually this extra modules thing belongs with
the dracut package itself, from a user, practical point of view, you actually want it in the dracut option of fs/cpio. If you use host-dracut without the cpio-dracut fs, it means you are using it in a post-build script, so it's not so weird to also install the extra modules in that script. On the other hand, if you are using cpio-dracut and you need extra modules (which is quite likely), then it extremely annoying that you have to go first to filesystems->cpio and later to hosttools->dracut...

In other words, I think this should be moved to cpio.

I beg to differ (of course!). ;-)

Extra modules change the features of dracut; they change what dracut can do. They are not like config files, which actually describe what the filesystem is to be assemble from.

Besides copying extra modules as done in this patch, a user could also patch dracut to add those modules. So, semantically, extra modules from a patch or a local directory are the same.

When adding new modules, you will indeed have to add config files that reference them (or one of your config files already references one and you missed it). Probably, indeed, the modules will be developped in a more-or-less closed loop with the config files that use them; but that's incidental.

If they were part of the cpio filesystem, they'd be copied on every invocation, though, which is conceptually not very nice either (but probably very low overhead).

Finally, even if using from a post-build script, it is still nicer to expose that option in the menuconfig, rather than require the user to do the copy in their script.

So, local modules should really belong to the dracut package, not the cpio filesystem.

Regards,
Yann E. MORIN.

Quoted 24 lines

Regards,
Arnout

Quoted 21 lines
(quoted diff) +2 -0
+
+endif
package/dracut/dracut.mk +9 -0
index 2b6a144aac..96fa7db6ba 100644
@@ -19,6 +19,15 @@ define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
 endef
 HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
+HOST_DRACUT_EXTRA_MODULES = $(call qstrip,$(BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES))
+define HOST_DRACUT_INSTALL_EXTRA_MODULES
+	$(Q)mkdir -p $(HOST_DIR)/lib/dracut/modules.d/
+	$(foreach m,$(HOST_DRACUT_EXTRA_MODULES), \
+		cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/
+	)
+endef
+HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_INSTALL_EXTRA_MODULES
+
 # When using uClibc or musl, there must be "ld-uClibc.so.1" or
 # "ld-musl-x.so" symlinks, respectively - else the init process cannot
 # start
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
#6 lore raw

Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules

Quoted 27 lines · Yann E. MORIN

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 9 lines

Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ and 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.

Add an option to the host-dracut package, so users can point to a list of modules to install.

[--SNIP--]

Quoted 10 lines

Although I agree that conceptually this extra modules thing belongs with
the dracut package itself, from a user, practical point of view, you actually want it in the dracut option of fs/cpio. If you use host-dracut without the cpio-dracut fs, it means you are using it in a post-build script, so it's not so weird to also install the extra modules in that script. On the other hand, if you are using cpio-dracut and you need extra modules (which is quite likely), then it extremely annoying that you have to go first to filesystems->cpio and later to hosttools->dracut...

In other words, I think this should be moved to cpio.

I beg to differ (of course!). ;-)

Quoted 7 lines

Extra modules change the features of dracut; they change what dracut can do. They are not like config files, which actually describe what the filesystem is to be assemble from.

Besides copying extra modules as done in this patch, a user could also patch dracut to add those modules. So, semantically, extra modules from a patch or a local directory are the same.

There's no question that semantically they belong with host-dracut. That's why
I wrote "conceptually they belong with the dracut package".

However, looking at it from a usability point of view, that is no longer the
case. In the head of the developer, what they want to do is to make sure the right stuff ends up in their cpio archive. They don't actually care if the dracut package is used for that.

Perhaps compare it with the gcc and libc options: we put them in the
toolchains menu, even though they actually belong to the gcc/uclibc packages.

A middle ground would be to duplicate the option, having one in the
host-dracut package that has the one from the cpio fs as the default.

Quoted 5 lines

When adding new modules, you will indeed have to add config files that reference them (or one of your config files already references one and you missed it). Probably, indeed, the modules will be developped in a more-or-less closed loop with the config files that use them; but that's incidental.

From the user point of view, that's pretty essential, not just incidental.

Quoted 3 lines

If they were part of the cpio filesystem, they'd be copied on every invocation, though, which is conceptually not very nice either (but probably very low overhead).

I was actually thinking of just putting the menu entry there, but keep the
logic in dracut.mk. Again, similar to how we do it for gcc (although there we have the actual menu in package/gcc as well).

Quoted 3 lines

Finally, even if using from a post-build script, it is still nicer to expose that option in the menuconfig, rather than require the user to do the copy in their script.

That is true.

Regards,
Arnout

Quoted 22 lines

So, local modules should really belong to the dracut package, not the cpio filesystem.

Regards,
Yann E. MORIN.

Quoted 16 lines

Regards,
Arnout

Quoted 13 lines
(quoted diff) +2 -0
+
+endif
package/dracut/dracut.mk +4 -0
index 2b6a144aac..96fa7db6ba 100644
@@ -19,6 +19,15 @@ define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
  endef
  HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT
+HOST_DRACUT_EXTRA_MODULES = $(call qstrip,$(BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES))
+define HOST_DRACUT_INSTALL_EXTRA_MODULES
+	$(Q)mkdir -p $(HOST_DIR)/lib/dracut/modules.d/
+	$(foreach m,$(HOST_DRACUT_EXTRA_MODULES), \
Quoted 9 lines
Quoted 8 lines

package/dracut/dracut.mk define HOST_DRACUT_POST_INSTALL_WRAPPER_SCRIPT · line 33

Quoted 8 lines
package/dracut/dracut.mk +5 -0
+		cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/
+	)
+endef
+HOST_DRACUT_POST_INSTALL_HOOKS += HOST_DRACUT_INSTALL_EXTRA_MODULES
+
  # When using uClibc or musl, there must be "ld-uClibc.so.1" or
  # "ld-musl-x.so" symlinks, respectively - else the init process cannot
  # start

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

#7 lore raw

Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules

Arnout, All,

On 2022-09-18 10:57 +0200, Arnout Vandecappelle spake thusly:

Quoted 5 lines · Yann E. MORIN
Quoted 4 lines

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Add an option to the host-dracut package, so users can point to a list of modules to install.

[--SNIP--]

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

In other words, I think this should be moved to cpio.

I beg to differ (of course!). ;-)

[--SNIP--]

Quoted 4 lines

However, looking at it from a usability point of view, that is no longer
the case. In the head of the developer, what they want to do is to make sure the right stuff ends up in their cpio archive. They don't actually care if the dracut package is used for that.

A final nail in the coffin of a host-dracut option, is that host-dracut is not user-selectable; the kconfig symbol does not have a prompt, and is only selectable by something else, like fs/cpio's dracut option.

On another note, users who had a post-image script that uses dracut from before we introduced it, were obviously not using host-dracut, but a dracut from their host, and so they most probably can't use extra modules in that case, so we do not need to catter to those either.

So, I'll resubmit as you suggested.

Regards,
Yann E. MORIN.

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
#8 lore raw

PATCH 3/4 fs/cpio: accept a list of dracut.conf files

In reply to Yann E. MORIN

It is not unusual that projects can target multiple boards, and in such cases, a lot is shared between boards and only the low-level stuff differ.

Allow users to specify more than one dracut config file to cover tose cases.

dracut does not accept more than one config file with the -c option, but it can load more than one from a directory with --confdir. So, we copy all the config files to a temporary directory and se that as --confdir. However, we can't drop passing -c, or dracut would read the system-wide /etc/dracut.conf (not sure if ${prefix} is even used), which we do not want. So, we use an empty file as -c; /dev/null comes in handy as an empty file.

Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc Thierry Bultel <[email protected]>
Cc Adam Duskett <[email protected]>
---
 fs/cpio/Config.in | 12 +++++++-----
 fs/cpio/cpio.mk   | 19 ++++++++++++++-----
 2 files changed, 21 insertions(+), 10 deletions(-)
fs/cpio/Config.in +7 -5
index 861e9a929e..94a826f9e4 100644
@@ -29,13 +29,15 @@ endchoice
 
 if BR2_TARGET_ROOTFS_CPIO_DRACUT
 
-config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE
-	string "dracut configuration file"
+config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES
+	string "dracut configuration files"
 	default "fs/cpio/dracut.conf"
 	help
-	  Dracut configuration file. It determines which parts of the
-	  rootfs get included in the cpio image. See dracut.conf(5) or
-	  https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
+	  Space-separated list of Dracut configuration files. They
+	  determine which parts of the rootfs get included in the
+	  cpio image. See:
+	    dracut.conf(5)
+	    https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
 
 	  The default configuration file is suitable for busybox init.
 	  It doesn't, however, pivot_root into a full rootfs.
fs/cpio/cpio.mk +14 -5
index fa66b1c710..d671c337df 100644
@@ -50,9 +50,14 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
 
 ROOTFS_CPIO_DEPENDENCIES += host-dracut
 
-ROOTFS_CPIO_DRACUT_CONF_FILE = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE))
-ifeq ($(BR_BUILDING):$(ROOTFS_CPIO_DRACUT_CONF_FILE),y:)
-$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE setting)
+ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES))
+ifeq ($(BR_BUILDING),y)
+ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),)
+$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
+ifneq ($(words $(ROOTFS_CPIO_DRACUT_CONF_FILES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_CONF_FILES)))))
+$(error No two dracut config files can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
 endif
 
 ifeq ($(BR2_LINUX_KERNEL),y)
@@ -63,10 +68,14 @@ ROOTFS_CPIO_OPTS += --no-kernel
 endif
 
 define ROOTFS_CPIO_CMD
-	mkdir -p $(ROOTFS_CPIO_DIR)/tmp
+	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
+		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
+	)
 	$(HOST_DIR)/bin/dracut \
 		$(ROOTFS_CPIO_OPTS) \
-		-c $(ROOTFS_CPIO_DRACUT_CONF_FILE) \
+		-c /dev/null \
+		--confdir $(ROOTFS_CPIO_DIR)/confdir \
 		--sysroot $(TARGET_DIR) \
 		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
 		-M \
Signature · 6 lines
2.25.1

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

Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files

Quoted 15 lines · Yann E. MORIN

It is not unusual that projects can target multiple boards, and in such cases, a lot is shared between boards and only the low-level stuff differ.

Allow users to specify more than one dracut config file to cover tose cases.

dracut does not accept more than one config file with the -c option, but it can load more than one from a directory with --confdir. So, we copy all the config files to a temporary directory and se that as --confdir. However, we can't drop passing -c, or dracut would read the system-wide /etc/dracut.conf (not sure if ${prefix} is even used), which we do not want. So, we use an empty file as -c; /dev/null comes in handy as an empty file.

Quoted 4 lines
Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc Thierry Bultel <[email protected]>
Cc Adam Duskett <[email protected]>

Applied to master, thanks.

Regards,
Arnout

Quoted 59 lines
---
  fs/cpio/Config.in | 12 +++++++-----
  fs/cpio/cpio.mk   | 19 ++++++++++++++-----
  2 files changed, 21 insertions(+), 10 deletions(-)
fs/cpio/Config.in +7 -5
index 861e9a929e..94a826f9e4 100644
@@ -29,13 +29,15 @@ endchoice
 
  if BR2_TARGET_ROOTFS_CPIO_DRACUT
 
-config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE
-	string "dracut configuration file"
+config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES
+	string "dracut configuration files"
  	default "fs/cpio/dracut.conf"
  	help
-	  Dracut configuration file. It determines which parts of the
-	  rootfs get included in the cpio image. See dracut.conf(5) or
-	  https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
+	  Space-separated list of Dracut configuration files. They
+	  determine which parts of the rootfs get included in the
+	  cpio image. See:
+	    dracut.conf(5)
+	    https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
 
  	  The default configuration file is suitable for busybox init.
  	  It doesn't, however, pivot_root into a full rootfs.
fs/cpio/cpio.mk +10 -4
index fa66b1c710..d671c337df 100644
@@ -50,9 +50,14 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
 
  ROOTFS_CPIO_DEPENDENCIES += host-dracut
 
-ROOTFS_CPIO_DRACUT_CONF_FILE = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE))
-ifeq ($(BR_BUILDING):$(ROOTFS_CPIO_DRACUT_CONF_FILE),y:)
-$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE setting)
+ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES))
+ifeq ($(BR_BUILDING),y)
+ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),)
+$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
+ifneq ($(words $(ROOTFS_CPIO_DRACUT_CONF_FILES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_CONF_FILES)))))
+$(error No two dracut config files can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
  endif
 
  ifeq ($(BR2_LINUX_KERNEL),y)
@@ -63,10 +68,14 @@ ROOTFS_CPIO_OPTS += --no-kernel
  endif
 
  define ROOTFS_CPIO_CMD
-	mkdir -p $(ROOTFS_CPIO_DIR)/tmp
+	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \

fs/cpio/cpio.mk ROOTFS_CPIO_OPTS += --no-kernel · line 81

Quoted 10 lines
fs/cpio/cpio.mk +4 -1
+		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
+	)
  	$(HOST_DIR)/bin/dracut \
  		$(ROOTFS_CPIO_OPTS) \
-		-c $(ROOTFS_CPIO_DRACUT_CONF_FILE) \
+		-c /dev/null \
+		--confdir $(ROOTFS_CPIO_DIR)/confdir \
  		--sysroot $(TARGET_DIR) \
  		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
  		-M \

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

#10 lore raw

Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Allow users to specify more than one dracut config file to cover tose cases.

[--SNIP--]

Quoted 1 line

Applied to master, thanks.

[--SNIP--]

Quoted 9 lines

fs/cpio/Config.in endchoice · line 30

Quoted 9 lines
fs/cpio/Config.in +1 -2
index 861e9a929e..94a826f9e4 100644
@@ -29,13 +29,15 @@ endchoice
 if BR2_TARGET_ROOTFS_CPIO_DRACUT
-config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE
-	string "dracut configuration file"
+config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES

When that patch was written, we did not have a release yet with support for dracut, so I did not add a legacy for _CPIO_DRACUT_CONF_FILE when I made it a plural. But 2022.08 does have dracut, so we now need to handle the legacy for BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE (or not make it a plural).

Regards,
Yann E. MORIN.

Quoted 48 lines
Quoted 48 lines
fs/cpio/Config.in +6 -3
+	string "dracut configuration files"
 	default "fs/cpio/dracut.conf"
 	help
-	  Dracut configuration file. It determines which parts of the
-	  rootfs get included in the cpio image. See dracut.conf(5) or
-	  https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
+	  Space-separated list of Dracut configuration files. They
+	  determine which parts of the rootfs get included in the
+	  cpio image. See:
+	    dracut.conf(5)
+	    https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
 	  The default configuration file is suitable for busybox init.
 	  It doesn't, however, pivot_root into a full rootfs.
fs/cpio/cpio.mk +14 -5
index fa66b1c710..d671c337df 100644
@@ -50,9 +50,14 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
 ROOTFS_CPIO_DEPENDENCIES += host-dracut
-ROOTFS_CPIO_DRACUT_CONF_FILE = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE))
-ifeq ($(BR_BUILDING):$(ROOTFS_CPIO_DRACUT_CONF_FILE),y:)
-$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE setting)
+ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES))
+ifeq ($(BR_BUILDING),y)
+ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),)
+$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
+ifneq ($(words $(ROOTFS_CPIO_DRACUT_CONF_FILES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_CONF_FILES)))))
+$(error No two dracut config files can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
 endif
 ifeq ($(BR2_LINUX_KERNEL),y)
@@ -63,10 +68,14 @@ ROOTFS_CPIO_OPTS += --no-kernel
 endif
 define ROOTFS_CPIO_CMD
-	mkdir -p $(ROOTFS_CPIO_DIR)/tmp
+	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
+		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
+	)
 	$(HOST_DIR)/bin/dracut \
 		$(ROOTFS_CPIO_OPTS) \
-		-c $(ROOTFS_CPIO_DRACUT_CONF_FILE) \
+		-c /dev/null \
+		--confdir $(ROOTFS_CPIO_DIR)/confdir \
 		--sysroot $(TARGET_DIR) \
 		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
 		-M \
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
#11 lore raw

Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files

Quoted 9 lines · Yann E. MORIN

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Allow users to specify more than one dracut config file to cover tose cases.

[--SNIP--]

Quoted 1 line

Applied to master, thanks.

[--SNIP--]

Quoted 15 lines
Quoted 9 lines

fs/cpio/Config.in endchoice · line 30

Quoted 9 lines
fs/cpio/Config.in +1 -2
index 861e9a929e..94a826f9e4 100644
@@ -29,13 +29,15 @@ endchoice
  if BR2_TARGET_ROOTFS_CPIO_DRACUT
-config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE
-	string "dracut configuration file"
+config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES

When that patch was written, we did not have a release yet with support for dracut, so I did not add a legacy for _CPIO_DRACUT_CONF_FILE when I made it a plural. But 2022.08 does have dracut, so we now need to handle the legacy for BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE (or not make it a plural).

I know that, that's why I first checked if dracut was merged in 2022.08. It
was merged during the stabilisation period but to next, not to master. So, no worries.

Regards,
Arnout

Quoted 44 lines

Regards,
Yann E. MORIN.

Quoted 40 lines
Quoted 40 lines
fs/cpio/Config.in +6 -3
+	string "dracut configuration files"
  	default "fs/cpio/dracut.conf"
  	help
-	  Dracut configuration file. It determines which parts of the
-	  rootfs get included in the cpio image. See dracut.conf(5) or
-	  https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
+	  Space-separated list of Dracut configuration files. They
+	  determine which parts of the rootfs get included in the
+	  cpio image. See:
+	    dracut.conf(5)
+	    https://github.com/dracutdevs/dracut/blob/master/man/dracut.conf.5.asc
  	  The default configuration file is suitable for busybox init.
  	  It doesn't, however, pivot_root into a full rootfs.
fs/cpio/cpio.mk +12 -4
index fa66b1c710..d671c337df 100644
@@ -50,9 +50,14 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y)
  ROOTFS_CPIO_DEPENDENCIES += host-dracut
-ROOTFS_CPIO_DRACUT_CONF_FILE = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE))
-ifeq ($(BR_BUILDING):$(ROOTFS_CPIO_DRACUT_CONF_FILE),y:)
-$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE setting)
+ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES))
+ifeq ($(BR_BUILDING),y)
+ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),)
+$(error No dracut config file name specified, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
+ifneq ($(words $(ROOTFS_CPIO_DRACUT_CONF_FILES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_CONF_FILES)))))
+$(error No two dracut config files can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES setting)
+endif
  endif
  ifeq ($(BR2_LINUX_KERNEL),y)
@@ -63,10 +68,14 @@ ROOTFS_CPIO_OPTS += --no-kernel
  endif
  define ROOTFS_CPIO_CMD
-	mkdir -p $(ROOTFS_CPIO_DIR)/tmp
+	mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir
+	$(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \
+		cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg))
+	)
Quoted 9 lines
Quoted 8 lines

fs/cpio/cpio.mk ROOTFS_CPIO_OPTS += --no-kernel · line 81

Quoted 8 lines
fs/cpio/cpio.mk +2 -1
  	$(HOST_DIR)/bin/dracut \
  		$(ROOTFS_CPIO_OPTS) \
-		-c $(ROOTFS_CPIO_DRACUT_CONF_FILE) \
+		-c /dev/null \
+		--confdir $(ROOTFS_CPIO_DIR)/confdir \
  		--sysroot $(TARGET_DIR) \
  		--tmpdir $(ROOTFS_CPIO_DIR)/tmp \
  		-M \

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

#12 lore raw

Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files

Arnout, All,

On 2022-09-18 10:41 +0200, Arnout Vandecappelle spake thusly:

Quoted 9 lines · Yann E. MORIN
Quoted 5 lines

When that patch was written, we did not have a release yet with support for dracut, so I did not add a legacy for _CPIO_DRACUT_CONF_FILE when I made it a plural. But 2022.08 does have dracut, so we now need to handle the legacy for BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILE (or not make it a plural).

I know that, that's why I first checked if dracut was merged in 2022.08. It
was merged during the stabilisation period but to next, not to master. So, no worries.

Arg... Of coutrse, stupid me... :-/

I'll mark my morning patch as rejected, then.

Thanks for being more acute than I was! :-)

Regards,
Yann E. MORIN.

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
#13 lore raw

PATCH 4/4 support/tests/cpio: extend runtime tests

In reply to Yann E. MORIN

Check that dependencies that are DT_NEEDED by a program are automatically copied by dracut. We use cramfs, the package, as it is small and just depends on libz.

Test extra modules, and test more than one dracut config file.

---
 support/testing/tests/fs/test_cpio.py                 | 11 ++++++++++-
 support/testing/tests/fs/test_cpio/dracut-cramfs.conf |  7 +++++++
 .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 support/testing/tests/fs/test_cpio/dracut-cramfs.conf
 create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
support/testing/tests/fs/test_cpio.py +10 -1
index 9a529f1edd..9c196c1b89 100644
@@ -37,11 +37,16 @@ class TestCpioDracutBase(infra.basetest.BRTest):
         BR2_TOOLCHAIN_EXTERNAL=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
         BR2_INIT_BUSYBOX=y
+        BR2_PACKAGE_CRAMFS=y
         BR2_PACKAGE_PV=y
+        BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES="{}"
         BR2_TARGET_ROOTFS_CPIO=y
         BR2_TARGET_ROOTFS_CPIO_DRACUT=y
+        BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES="{}"
         # BR2_TARGET_ROOTFS_TAR is not set
-        """
+        """.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):
         out = subprocess.check_output(["cpio", "--list"],
@@ -52,6 +57,10 @@ class TestCpioDracutBase(infra.basetest.BRTest):
                                       universal_newlines=True)
         # pv should *not* be included in cpio image
         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,
                              self.builddir)
support/testing/tests/fs/test_cpio/dracut-cramfs.conf new file +7 -0
new file mode 100644
index 0000000000..69e49239fc
@@ -0,0 +1,7 @@
+install_items+="
+/usr/bin/mkcramfs
+"
+
+add_dracutmodules+="
+cramfs
+"
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
#14 lore raw

Re: [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests

Quoted 10 lines · Yann E. MORIN

Check that dependencies that are DT_NEEDED by a program are automatically copied by dracut. We use cramfs, the package, as it is small and just depends on libz.

Test extra modules, and test more than one dracut config file.

I've removed the bits related to patch 2/4 and applied to master, thanks.

Regards,
Arnout

Quoted 61 lines
---
  support/testing/tests/fs/test_cpio.py                 | 11 ++++++++++-
  support/testing/tests/fs/test_cpio/dracut-cramfs.conf |  7 +++++++
  .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
  3 files changed, 28 insertions(+), 1 deletion(-)

create mode 100644 support/testing/tests/fs/test_cpio/dracut-cramfs.conf create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh

support/testing/tests/fs/test_cpio.py +10 -1
index 9a529f1edd..9c196c1b89 100644
@@ -37,11 +37,16 @@ class TestCpioDracutBase(infra.basetest.BRTest):
          BR2_TOOLCHAIN_EXTERNAL=y
          BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
          BR2_INIT_BUSYBOX=y
+        BR2_PACKAGE_CRAMFS=y
          BR2_PACKAGE_PV=y
+        BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES="{}"
          BR2_TARGET_ROOTFS_CPIO=y
          BR2_TARGET_ROOTFS_CPIO_DRACUT=y
+        BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES="{}"
          # BR2_TARGET_ROOTFS_TAR is not set
-        """
+        """.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):
          out = subprocess.check_output(["cpio", "--list"],
@@ -52,6 +57,10 @@ class TestCpioDracutBase(infra.basetest.BRTest):
                                        universal_newlines=True)
          # pv should *not* be included in cpio image
          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,
                               self.builddir)
support/testing/tests/fs/test_cpio/dracut-cramfs.conf new file +7 -0
new file mode 100644
index 0000000000..69e49239fc
@@ -0,0 +1,7 @@
+install_items+="
+/usr/bin/mkcramfs
+"
+
+add_dracutmodules+="
+cramfs
+"
support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh new file +1 -0
new file mode 100755
index 0000000000..60706c8bd9
@@ -0,0 +1,11 @@
+check() {

support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh line 11

Quoted 10 lines
support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh new file +10 -0
+    return 0
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    inst_multiple /usr/bin/cramfsck
+}

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