]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut: add "--omit-driver"
authorHarald Hoyer <harald@redhat.com>
Wed, 15 Feb 2012 13:53:18 +0000 (14:53 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 15 Feb 2012 14:46:23 +0000 (15:46 +0100)
dracut
dracut-functions
dracut.8.xml
dracut.conf.5.xml

diff --git a/dracut b/dracut
index fb46d70200fef044a5803888651084aa6e315613..526594c45ac20cb58869770af98529177cbd50ce 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -40,8 +40,10 @@ Creates initial ramdisk images for preloading modules
   -a, --add [LIST]      Add a space-separated list of dracut modules.
   -d, --drivers [LIST]  Specify a space-separated list of kernel modules to
                         exclusively include in the initramfs.
-  --add-drivers [LIST]  Specify a space-separated list of kernel
+  --add-drivers [LIST] Specify a space-separated list of kernel
                         modules to add to the initramfs.
+  --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
                         modules to exclusively include in the generic
                         initramfs.
@@ -210,6 +212,7 @@ while (($# > 0)); do
         -a|--add)      push_arg add_dracutmodules_l  "$@" || shift;;
         --force-add)   push_arg force_add_dracutmodules_l  "$@" || shift;;
         --add-drivers) push_arg add_drivers_l        "$@" || shift;;
+        --omit-drivers) push_arg omit_drivers_l      "$@" || shift;;
         -m|--modules)  push_arg dracutmodules_l      "$@" || shift;;
         -o|--omit)     push_arg omit_dracutmodules_l "$@" || shift;;
         -d|--drivers)  push_arg drivers_l            "$@" || shift;;
@@ -341,13 +344,6 @@ if (( ${#force_add_dracutmodules_l[@]} )); then
     done
 fi
 
-
-if (( ${#add_drivers_l[@]} )); then
-    while pop add_drivers_l val; do
-        add_drivers+=" $val "
-    done
-fi
-
 if (( ${#fscks_l[@]} )); then
     while pop fscks_l val; do
         fscks+=" $val "
@@ -387,13 +383,6 @@ if (( ${#omit_dracutmodules_l[@]} )); then
     done
 fi
 
-if (( ${#drivers_l[@]} )); then
-    drivers=''
-    while pop drivers_l val; do
-        drivers+="$val "
-    done
-fi
-
 if (( ${#filesystems_l[@]} )); then
     filesystems=''
     while pop filesystems_l val; do
@@ -466,6 +455,37 @@ fi
 dracutfunctions=$dracutbasedir/dracut-functions
 export dracutfunctions
 
+if (( ${#drivers_l[@]} )); then
+    drivers=''
+    while pop drivers_l val; do
+        drivers+="$val "
+    done
+fi
+drivers=${drivers/-/_}
+
+if (( ${#add_drivers_l[@]} )); then
+    while pop add_drivers_l val; do
+        add_drivers+=" $val "
+    done
+fi
+add_drivers=${add_drivers/-/_}
+
+if (( ${#omit_drivers_l[@]} )); then
+    while pop omit_drivers_l val; do
+        omit_drivers+=" $val "
+    done
+fi
+omit_drivers=${omit_drivers/-/_}
+
+unset omit_drivers_corrected
+for d in $omit_drivers; do
+    strstr " $drivers $add_drivers " " $d " && continue
+    omit_drivers_corrected+=" $d "
+done
+omit_drivers=$omit_drivers_corrected
+unset omit_drivers_corrected
+
+
 ddebug "Executing $0 $dracut_args"
 
 [[ $do_list = yes ]] && {
@@ -604,7 +624,7 @@ done
 
 export initdir dracutbasedir dracutmodules drivers \
     fw_dir drivers_dir debug no_kernel kernel_only \
-    add_drivers mdadmconf lvmconf filesystems \
+    add_drivers omit_drivers mdadmconf lvmconf filesystems \
     use_fstab fstab_lines libdir usrlibdir fscks nofscks cttyhack \
     stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
     debug host_fs_types host_devs sshkey
index 434ffa27102d54c4e2e48eae4fc89178f9f685e8..41d752e5d972fd765e04e3887b82646783211900 100755 (executable)
@@ -927,6 +927,17 @@ install_kmod_with_fw() {
     # no need to go further if the module is already installed
     [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \
         && return 0
+
+    if [[ $omit_drivers ]]; then
+        local _kmod=${1##*/}
+        _kmod=${_kmod%.ko}
+        _kmod=${_kmod/-/_}
+        if strstr " $omit_drivers " " $_kmod " ; then
+            dinfo "Omitting driver $_kmod"
+            return 1
+        fi
+    fi
+
     inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" \
         || return $?
 
index 88c97c3a19c32110f3a104c4c6c503ebcf30f525..de1a0bfdaa6bc1a84314f67adaf3bf9ffa62d175 100644 (file)
@@ -196,6 +196,20 @@ The kernel modules have to be specified without the &quot;.ko&quot; suffix. This
            </para>
           </listitem>
         </varlistentry>
+        <varlistentry>
+          <term>
+            <option>--omit-drivers&nbsp;<replaceable>&lt;list of kernel modules&gt;</replaceable></option>
+          </term>
+          <listitem>
+            <para>specify a space-separated list of kernel modules not to add to the initramfs.
+The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
+           <para>
+             If [LIST] has multiple arguments, then you have to put these in quotes.
+             For example:
+             <screen># dracut --omit-drivers "kmodule1 kmodule2"  ...</screen>
+           </para>
+          </listitem>
+        </varlistentry>
         <varlistentry>
           <term>
             <option>--filesystems&nbsp;<replaceable>&lt;list of filesystems&gt;</replaceable></option>
index e24078bdfa6afbf7dfd55aea281c7223b0e16a79..760c892577de20fbf02171968c0690f38fb2a608 100644 (file)
@@ -82,6 +82,16 @@ The kernel modules have to be specified without the &quot;.ko&quot; suffix.</par
         <listitem>
           <para>Specify a space-separated list of kernel
 modules to add to the initramfs.
+The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <envar>omit_drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
+        </term>
+        <listitem>
+          <para>Specify a space-separated list of kernel
+modules not to add to the initramfs.
 The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
         </listitem>
       </varlistentry>