From eb6e466c102306cfcb1b459d91aa5440f6b8a621 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Tue, 20 Sep 2022 20:37:11 +0200 Subject: [PATCH] fs/cpio: allow users to provide their own dracut modules Dracut modules can only be looked for in HOST_DIR/lib/dracut/modules.d/ as dracut does not offer the possibility to look elsewhere. Installing files in HOST_DIR/ can do done either from a host-package, or via a post-built script; there is no overlay like there is for target/. This is a bit cumbersome. Additional modules are most probably developped in a relatively tight loop with the configuration files, so it makes sense to expose both close together. Add an option to the fs/cpio filesystem, so users can point to a list of modules to install. Signed-off-by: Yann E. MORIN Cc: Arnout Vandecappelle (Essensium/Mind) Cc: Thierry Bultel Cc: Adam Duskett Signed-off-by: Thomas Petazzoni --- fs/cpio/Config.in | 5 +++++ fs/cpio/cpio.mk | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/cpio/Config.in b/fs/cpio/Config.in index bec2d9dca2..4d38276c88 100644 --- a/fs/cpio/Config.in +++ b/fs/cpio/Config.in @@ -29,6 +29,11 @@ endchoice if BR2_TARGET_ROOTFS_CPIO_DRACUT +config BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES + string "extra dracut modules" + help + Space-separated list of directories containing dracut modules. + config BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES string "dracut configuration files" default "fs/cpio/dracut.conf" diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk index 061f4a18f1..00ab6a8f82 100644 --- a/fs/cpio/cpio.mk +++ b/fs/cpio/cpio.mk @@ -50,6 +50,13 @@ else ifeq ($(BR2_TARGET_ROOTFS_CPIO_DRACUT),y) ROOTFS_CPIO_DEPENDENCIES += host-dracut +ROOTFS_CPIO_DRACUT_MODULES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES)) +ifeq ($(BR_BUILDING),y) +ifneq ($(words $(ROOTFS_CPIO_DRACUT_MODULES)),$(words $(sort $(notdir $(ROOTFS_CPIO_DRACUT_MODULES))))) +$(error No two dracut modules can have the same basename, check your BR2_TARGET_ROOTFS_CPIO_DRACUT_MODULES setting) +endif +endif + ROOTFS_CPIO_DRACUT_CONF_FILES = $(call qstrip,$(BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES)) ifeq ($(BR_BUILDING),y) ifeq ($(ROOTFS_CPIO_DRACUT_CONF_FILES),) @@ -68,11 +75,14 @@ ROOTFS_CPIO_OPTS += --no-kernel endif define ROOTFS_CPIO_CMD - mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir + mkdir -p $(ROOTFS_CPIO_DIR)/tmp $(ROOTFS_CPIO_DIR)/confdir $(HOST_DIR)/lib/dracut/modules.d touch $(ROOTFS_CPIO_DIR)/empty-config $(foreach cfg,$(ROOTFS_CPIO_DRACUT_CONF_FILES), \ cp $(cfg) $(ROOTFS_CPIO_DIR)/confdir/$(notdir $(cfg)) ) + $(foreach m,$(ROOTFS_CPIO_DRACUT_MODULES), \ + cp -a $(m)/* $(HOST_DIR)/lib/dracut/modules.d/ + ) $(HOST_DIR)/bin/dracut \ $(ROOTFS_CPIO_OPTS) \ -c $(ROOTFS_CPIO_DIR)/empty-config \