@@ -2,9 +2,6 @@
set -e
-# try to load module in case that hasn't been done yet
-modprobe dm-mod >/dev/null 2>&1
-
case "$1" in
start|"")
echo "Setting up DMRAID devices..."
@@ -21,4 +21,16 @@ define DMRAID_INSTALL_INIT_SYSV
$(TARGET_DIR)/etc/init.d/S20dmraid
endef
+ifeq ($(BR2_LINUX_KERNEL),y)
+define DMRAID_GEN_MODULES_CONF
+ $(INSTALL) -d -m 755 $(TARGET_DIR)/etc/modules-load.d
+ { \
+ find $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED)/kernel/drivers/md -name 'dm[_-]mod.ko*'; \
+ } 2> /dev/null | { \
+ sed 's:^.*/::; s:\.ko[^ ]*::'; \
+ } > $(TARGET_DIR)/etc/modules-load.d/20-dmraid.conf
+endef
+DMRAID_TARGET_FINALIZE_HOOKS += DMRAID_GEN_MODULES_CONF
+endif
+
$(eval $(autotools-package))