All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive
  2022-08-19 17:50 [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut) Yann E. MORIN
@ 2022-08-19 17:50 ` Yann E. MORIN
  2022-09-17 20:13   ` Arnout Vandecappelle
  2022-08-19 17:50 ` [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules Yann E. MORIN
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-08-19 17:50 UTC (permalink / raw)
  To: buildroot; +Cc: Adam Duskett, Yann E. MORIN, Thierry Bultel

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.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
 support/testing/tests/fs/test_cpio.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
index 3f661e370c..9a529f1edd 100644
--- a/support/testing/tests/fs/test_cpio.py
+++ b/support/testing/tests/fs/test_cpio.py
@@ -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 + \
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut)
@ 2022-08-19 17:50 Yann E. MORIN
  2022-08-19 17:50 ` [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive Yann E. MORIN
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Yann E. MORIN @ 2022-08-19 17:50 UTC (permalink / raw)
  To: buildroot; +Cc: Thierry Bultel, Adam Duskett, Yann E . MORIN

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

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules
  2022-08-19 17:50 [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut) Yann E. MORIN
  2022-08-19 17:50 ` [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive Yann E. MORIN
@ 2022-08-19 17:50 ` Yann E. MORIN
  2022-09-17 20:17   ` Arnout Vandecappelle
  2022-08-19 17:51 ` [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files Yann E. MORIN
  2022-08-19 17:51 ` [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests Yann E. MORIN
  3 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-08-19 17:50 UTC (permalink / raw)
  To: buildroot; +Cc: Adam Duskett, Yann E. MORIN, Thierry Bultel

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.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
 package/dracut/Config.in.host | 11 +++++++++++
 package/dracut/dracut.mk      |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/package/dracut/Config.in.host b/package/dracut/Config.in.host
index 18f562b310..5756dbd43f 100644
--- a/package/dracut/Config.in.host
+++ b/package/dracut/Config.in.host
@@ -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
diff --git a/package/dracut/dracut.mk b/package/dracut/dracut.mk
index 2b6a144aac..96fa7db6ba 100644
--- a/package/dracut/dracut.mk
+++ b/package/dracut/dracut.mk
@@ -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
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files
  2022-08-19 17:50 [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut) Yann E. MORIN
  2022-08-19 17:50 ` [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive Yann E. MORIN
  2022-08-19 17:50 ` [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules Yann E. MORIN
@ 2022-08-19 17:51 ` Yann E. MORIN
  2022-09-17 20:17   ` Arnout Vandecappelle
  2022-08-19 17:51 ` [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests Yann E. MORIN
  3 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-08-19 17:51 UTC (permalink / raw)
  To: buildroot; +Cc: Adam Duskett, Yann E. MORIN, Thierry Bultel

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.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
 fs/cpio/Config.in | 12 +++++++-----
 fs/cpio/cpio.mk   | 19 ++++++++++++++-----
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in
index 861e9a929e..94a826f9e4 100644
--- a/fs/cpio/Config.in
+++ b/fs/cpio/Config.in
@@ -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.
diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
index fa66b1c710..d671c337df 100644
--- a/fs/cpio/cpio.mk
+++ b/fs/cpio/cpio.mk
@@ -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 \
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests
  2022-08-19 17:50 [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut) Yann E. MORIN
                   ` (2 preceding siblings ...)
  2022-08-19 17:51 ` [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files Yann E. MORIN
@ 2022-08-19 17:51 ` Yann E. MORIN
  2022-09-17 20:17   ` Arnout Vandecappelle
  3 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-08-19 17:51 UTC (permalink / raw)
  To: buildroot; +Cc: Adam Duskett, Yann E. MORIN, Thierry Bultel

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.

Reported-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
 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

diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
index 9a529f1edd..9c196c1b89 100644
--- a/support/testing/tests/fs/test_cpio.py
+++ b/support/testing/tests/fs/test_cpio.py
@@ -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)
diff --git a/support/testing/tests/fs/test_cpio/dracut-cramfs.conf b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
new file mode 100644
index 0000000000..69e49239fc
--- /dev/null
+++ b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
@@ -0,0 +1,7 @@
+install_items+="
+/usr/bin/mkcramfs
+"
+
+add_dracutmodules+="
+cramfs
+"
diff --git a/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
new file mode 100755
index 0000000000..60706c8bd9
--- /dev/null
+++ b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
@@ -0,0 +1,11 @@
+check() {
+    return 0
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    inst_multiple /usr/bin/cramfsck
+}
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive
  2022-08-19 17:50 ` [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive Yann E. MORIN
@ 2022-09-17 20:13   ` Arnout Vandecappelle
  0 siblings, 0 replies; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-17 20:13 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Adam Duskett, Thierry Bultel



On 19/08/2022 19:50, Yann E. MORIN wrote:
> 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.
> 
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
> Cc: Adam Duskett <aduskett@gmail.com>

  Applied to master, thanks.

  Regards,
  Arnout

> ---
>   support/testing/tests/fs/test_cpio.py | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
> index 3f661e370c..9a529f1edd 100644
> --- a/support/testing/tests/fs/test_cpio.py
> +++ b/support/testing/tests/fs/test_cpio.py
> @@ -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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules
  2022-08-19 17:50 ` [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules Yann E. MORIN
@ 2022-09-17 20:17   ` Arnout Vandecappelle
  2022-09-17 21:19     ` Yann E. MORIN
  0 siblings, 1 reply; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-17 20:17 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Adam Duskett, Thierry Bultel



On 19/08/2022 19:50, Yann E. MORIN wrote:
> 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.
> 
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
> Cc: Adam Duskett <aduskett@gmail.com>
> ---
>   package/dracut/Config.in.host | 11 +++++++++++
>   package/dracut/dracut.mk      |  9 +++++++++
>   2 files changed, 20 insertions(+)
> 
> diff --git a/package/dracut/Config.in.host b/package/dracut/Config.in.host
> index 18f562b310..5756dbd43f 100644
> --- a/package/dracut/Config.in.host
> +++ b/package/dracut/Config.in.host
> @@ -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.

  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

> +
> +endif
> diff --git a/package/dracut/dracut.mk b/package/dracut/dracut.mk
> index 2b6a144aac..96fa7db6ba 100644
> --- a/package/dracut/dracut.mk
> +++ b/package/dracut/dracut.mk
> @@ -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
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files
  2022-08-19 17:51 ` [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files Yann E. MORIN
@ 2022-09-17 20:17   ` Arnout Vandecappelle
  2022-09-17 21:10     ` Yann E. MORIN
  0 siblings, 1 reply; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-17 20:17 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Adam Duskett, Thierry Bultel



On 19/08/2022 19:51, Yann E. MORIN wrote:
> 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.
> 
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
> Cc: Adam Duskett <aduskett@gmail.com>

  Applied to master, thanks.

  Regards,
  Arnout

> ---
>   fs/cpio/Config.in | 12 +++++++-----
>   fs/cpio/cpio.mk   | 19 ++++++++++++++-----
>   2 files changed, 21 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in
> index 861e9a929e..94a826f9e4 100644
> --- a/fs/cpio/Config.in
> +++ b/fs/cpio/Config.in
> @@ -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.
> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> index fa66b1c710..d671c337df 100644
> --- a/fs/cpio/cpio.mk
> +++ b/fs/cpio/cpio.mk
> @@ -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 \
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests
  2022-08-19 17:51 ` [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests Yann E. MORIN
@ 2022-09-17 20:17   ` Arnout Vandecappelle
  0 siblings, 0 replies; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-17 20:17 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Adam Duskett, Thierry Bultel



On 19/08/2022 19:51, Yann E. MORIN wrote:
> 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.
> 
> Reported-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
> Cc: Adam Duskett <aduskett@gmail.com>

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

  Regards,
  Arnout

> ---
>   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
> 
> diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
> index 9a529f1edd..9c196c1b89 100644
> --- a/support/testing/tests/fs/test_cpio.py
> +++ b/support/testing/tests/fs/test_cpio.py
> @@ -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)
> diff --git a/support/testing/tests/fs/test_cpio/dracut-cramfs.conf b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
> new file mode 100644
> index 0000000000..69e49239fc
> --- /dev/null
> +++ b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
> @@ -0,0 +1,7 @@
> +install_items+="
> +/usr/bin/mkcramfs
> +"
> +
> +add_dracutmodules+="
> +cramfs
> +"
> diff --git a/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
> new file mode 100755
> index 0000000000..60706c8bd9
> --- /dev/null
> +++ b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
> @@ -0,0 +1,11 @@
> +check() {
> +    return 0
> +}
> +
> +depends() {
> +    return 0
> +}
> +
> +install() {
> +    inst_multiple /usr/bin/cramfsck
> +}
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files
  2022-09-17 20:17   ` Arnout Vandecappelle
@ 2022-09-17 21:10     ` Yann E. MORIN
  2022-09-18  8:41       ` Arnout Vandecappelle
  0 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-09-17 21:10 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Adam Duskett, Thierry Bultel, buildroot

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:
> On 19/08/2022 19:51, Yann E. MORIN wrote:
> >Allow users to specify more than one dracut config file to cover
> >tose cases.
[--SNIP--]
>  Applied to master, thanks.
[--SNIP--]
> >diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in
> >index 861e9a929e..94a826f9e4 100644
> >--- a/fs/cpio/Config.in
> >+++ b/fs/cpio/Config.in
> >@@ -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.

> >+	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.
> >diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> >index fa66b1c710..d671c337df 100644
> >--- a/fs/cpio/cpio.mk
> >+++ b/fs/cpio/cpio.mk
> >@@ -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 \

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules
  2022-09-17 20:17   ` Arnout Vandecappelle
@ 2022-09-17 21:19     ` Yann E. MORIN
  2022-09-18  8:57       ` Arnout Vandecappelle
  0 siblings, 1 reply; 15+ messages in thread
From: Yann E. MORIN @ 2022-09-17 21:19 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Adam Duskett, Thierry Bultel, buildroot

Arnout, All,

On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:
> On 19/08/2022 19:50, Yann E. MORIN wrote:
> >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--]
>  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.

>  Regards,
>  Arnout
> 
> >+
> >+endif
> >diff --git a/package/dracut/dracut.mk b/package/dracut/dracut.mk
> >index 2b6a144aac..96fa7db6ba 100644
> >--- a/package/dracut/dracut.mk
> >+++ b/package/dracut/dracut.mk
> >@@ -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

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files
  2022-09-17 21:10     ` Yann E. MORIN
@ 2022-09-18  8:41       ` Arnout Vandecappelle
  2022-09-18  8:46         ` Yann E. MORIN
  0 siblings, 1 reply; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-18  8:41 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Adam Duskett, Thierry Bultel, buildroot



On 17/09/2022 23:10, Yann E. MORIN wrote:
> Arnout, All,
> 
> On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:
>> On 19/08/2022 19:51, Yann E. MORIN wrote:
>>> Allow users to specify more than one dracut config file to cover
>>> tose cases.
> [--SNIP--]
>>   Applied to master, thanks.
> [--SNIP--]
>>> diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in
>>> index 861e9a929e..94a826f9e4 100644
>>> --- a/fs/cpio/Config.in
>>> +++ b/fs/cpio/Config.in
>>> @@ -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

> 
> Regards,
> Yann E. MORIN.
> 
>>> +	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.
>>> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
>>> index fa66b1c710..d671c337df 100644
>>> --- a/fs/cpio/cpio.mk
>>> +++ b/fs/cpio/cpio.mk
>>> @@ -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 \
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files
  2022-09-18  8:41       ` Arnout Vandecappelle
@ 2022-09-18  8:46         ` Yann E. MORIN
  0 siblings, 0 replies; 15+ messages in thread
From: Yann E. MORIN @ 2022-09-18  8:46 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Adam Duskett, Thierry Bultel, buildroot

Arnout, All,

On 2022-09-18 10:41 +0200, Arnout Vandecappelle spake thusly:
> On 17/09/2022 23:10, Yann E. MORIN wrote:
> >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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules
  2022-09-17 21:19     ` Yann E. MORIN
@ 2022-09-18  8:57       ` Arnout Vandecappelle
  2022-09-18 19:36         ` Yann E. MORIN
  0 siblings, 1 reply; 15+ messages in thread
From: Arnout Vandecappelle @ 2022-09-18  8:57 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Adam Duskett, Thierry Bultel, buildroot



On 17/09/2022 23:19, Yann E. MORIN wrote:
> Arnout, All,
> 
> On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:
>> On 19/08/2022 19:50, Yann E. MORIN wrote:
>>> 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--]
>>   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.

  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.


> 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.


> 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).


> 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


> So, local modules should really belong to the dracut package, not the
> cpio filesystem.
> 
> Regards,
> Yann E. MORIN.
> 
>>   Regards,
>>   Arnout
>>
>>> +
>>> +endif
>>> diff --git a/package/dracut/dracut.mk b/package/dracut/dracut.mk
>>> index 2b6a144aac..96fa7db6ba 100644
>>> --- a/package/dracut/dracut.mk
>>> +++ b/package/dracut/dracut.mk
>>> @@ -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
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules
  2022-09-18  8:57       ` Arnout Vandecappelle
@ 2022-09-18 19:36         ` Yann E. MORIN
  0 siblings, 0 replies; 15+ messages in thread
From: Yann E. MORIN @ 2022-09-18 19:36 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Thierry Bultel, Adam Duskett, buildroot

Arnout, All,

On 2022-09-18 10:57 +0200, Arnout Vandecappelle spake thusly:
> On 17/09/2022 23:19, Yann E. MORIN wrote:
> >On 2022-09-17 22:17 +0200, Arnout Vandecappelle spake thusly:
> >>On 19/08/2022 19:50, Yann E. MORIN wrote:
> >>>Add an option to the host-dracut package, so users can point to a list
> >>>of modules to install.
[--SNIP--]
> >>  In other words, I think this should be moved to cpio.
> >I beg to differ (of course!). ;-)
[--SNIP--]
>  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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-09-18 19:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 17:50 [Buildroot] [PATCH 0/4] dracut: extend support and tests (branch yem/dracut) Yann E. MORIN
2022-08-19 17:50 ` [Buildroot] [PATCH 1/4] support/test/cpio: test for pv already done by listing the cpio archive Yann E. MORIN
2022-09-17 20:13   ` Arnout Vandecappelle
2022-08-19 17:50 ` [Buildroot] [PATCH 2/4] package/dracut: allow users to provide their own modules Yann E. MORIN
2022-09-17 20:17   ` Arnout Vandecappelle
2022-09-17 21:19     ` Yann E. MORIN
2022-09-18  8:57       ` Arnout Vandecappelle
2022-09-18 19:36         ` Yann E. MORIN
2022-08-19 17:51 ` [Buildroot] [PATCH 3/4] fs/cpio: accept a list of dracut.conf files Yann E. MORIN
2022-09-17 20:17   ` Arnout Vandecappelle
2022-09-17 21:10     ` Yann E. MORIN
2022-09-18  8:41       ` Arnout Vandecappelle
2022-09-18  8:46         ` Yann E. MORIN
2022-08-19 17:51 ` [Buildroot] [PATCH 4/4] support/tests/cpio: extend runtime tests Yann E. MORIN
2022-09-17 20:17   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.