]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: Introduce --force-drivers parameter and force_drivers=+ config option
authorThomas Renninger <trenn@suse.de>
Mon, 8 Sep 2014 10:34:48 +0000 (12:34 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 8 Sep 2014 10:37:52 +0000 (12:37 +0200)
Which will not only add listed drivers, but also enforce that they are
tried to be loaded at early boot time.

This is needed if drivers which are not autoloaded (e.g. loop and a lot
others) shall get loaded via initramfs.

dracut.8.asc
dracut.conf.5.asc
dracut.sh

index 44530bd372fb8df9e109023b5f15e5719e564de3..986e73bcd7b9efd7d8bcf0ae8e92267e32775817 100644 (file)
@@ -136,6 +136,19 @@ example:
 ----
 ===============================
 
+**--force-drivers** _<list of kernel modules>_::
+    See add-drivers above. But in this case it is ensured that the drivers
+    are tried to be loaded early via modprobe.
++
+[NOTE]
+===============================
+If [LIST] has multiple arguments, then you have to put these in quotes. For
+example:
+----
+# dracut --force-drivers "kmodule1 kmodule2"  ...
+----
+===============================
+
 **--omit-drivers** _<list of kernel modules>_::
     specify a space-separated list of kernel modules not to add to the
     initramfs.
index 92599518fbbe4581eb94bc9a239bce63f4034970..71d5c7114019c7655f0c0b9f07191ffeaba52156 100644 (file)
@@ -49,6 +49,10 @@ Configuration files must have the extension .conf; other extensions are ignored.
     Specify a space-separated list of kernel modules to add to the initramfs.
     The kernel modules have to be specified without the ".ko" suffix.
 
+*force_drivers+=*" __<list of kernel modules>__ "::
+    See add_drivers above. But in this case it is ensured that the drivers
+    are tried to be loaded early via modprobe.
+
 *omit_drivers+=*" __<kernel modules>__ "::
     Specify a space-separated list of kernel modules not to add to the
     initramfs. The kernel modules have to be specified without the ".ko" suffix.
index 35c69efe017bc7c184eb708ad3451ebc301ebaea..afbc075781bbb3961d1741b679af66973745fc59 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -79,6 +79,10 @@ Creates initial ramdisk images for preloading modules
                          exclusively include in the initramfs.
   --add-drivers [LIST]  Specify a space-separated list of kernel
                          modules to add to the initramfs.
+  --force-drivers [LIST] Specify a space-separated list of kernel
+                         modules to add to the initramfs and make sure they
+                         are tried to be loaded via modprobe same as passing
+                         rd.driver.pre=DRIVER kernel parameter.
   --omit-drivers [LIST] Specify a space-separated list of kernel
                          modules not to add to the initramfs.
   --filesystems [LIST]  Specify a space-separated list of kernel filesystem
@@ -300,6 +304,7 @@ rearrange_params()
         --long add: \
         --long force-add: \
         --long add-drivers: \
+        --long force-drivers: \
         --long omit-drivers: \
         --long modules: \
         --long omit: \
@@ -466,6 +471,7 @@ while :; do
         -a|--add)      push add_dracutmodules_l  "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
         --force-add)   push force_add_dracutmodules_l  "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
         --add-drivers) push add_drivers_l        "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
+        --force-drivers) push force_drivers_l    "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
         --omit-drivers) push omit_drivers_l      "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
         -m|--modules)  push dracutmodules_l      "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
         -o|--omit)     push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
@@ -907,6 +913,13 @@ if (( ${#add_drivers_l[@]} )); then
 fi
 add_drivers=${add_drivers/-/_}
 
+if (( ${#force_drivers_l[@]} )); then
+    while pop force_drivers_l val; do
+        force_drivers+=" $val "
+    done
+fi
+force_drivers=${force_drivers/-/_}
+
 if (( ${#omit_drivers_l[@]} )); then
     while pop omit_drivers_l val; do
         omit_drivers+=" $val "
@@ -923,6 +936,7 @@ fi
 omit_drivers_corrected=""
 for d in $omit_drivers; do
     [[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
+    [[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
     omit_drivers_corrected+="$d|"
 done
 omit_drivers="${omit_drivers_corrected%|}"
@@ -1337,6 +1351,13 @@ if [[ $no_kernel != yes ]]; then
     if [[ $add_drivers ]]; then
         hostonly='' instmods -c $add_drivers
     fi
+    if [[ $force_drivers ]]; then
+        hostonly='' instmods -c $force_drivers
+        rm -f $initdir/etc/cmdline.d/20-force_driver.conf
+        for mod in $force_drivers; do
+            echo "rd.driver.pre=$mod" >>$initdir/etc/cmdline.d/20-force_drivers.conf
+        done
+    fi
     if [[ $filesystems ]]; then
         hostonly='' instmods -c $filesystems
     fi