|
|
2d7ffa |
From 125bb747c3fd357b95e9833ae4255a370ba3211c Mon Sep 17 00:00:00 2001
|
|
|
2d7ffa |
From: Thomas Renninger <trenn@suse.de>
|
|
|
2d7ffa |
Date: Mon, 8 Sep 2014 12:34:48 +0200
|
|
|
2d7ffa |
Subject: [PATCH] dracut: Introduce --force-drivers parameter and
|
|
|
2d7ffa |
force_drivers=+ config option
|
|
|
2d7ffa |
|
|
|
2d7ffa |
Which will not only add listed drivers, but also enforce that they are
|
|
|
2d7ffa |
tried to be loaded at early boot time.
|
|
|
2d7ffa |
|
|
|
2d7ffa |
This is needed if drivers which are not autoloaded (e.g. loop and a lot
|
|
|
2d7ffa |
others) shall get loaded via initramfs.
|
|
|
2d7ffa |
|
|
|
2d7ffa |
Cherry-picked from: cea907f6bf2fc97933b59e04f4520ca227251574
|
|
|
2d7ffa |
Resolves: #1577626
|
|
|
2d7ffa |
---
|
|
|
2d7ffa |
dracut.8.asc | 13 +++++++++++++
|
|
|
2d7ffa |
dracut.conf.5.asc | 4 ++++
|
|
|
2d7ffa |
dracut.sh | 21 +++++++++++++++++++++
|
|
|
2d7ffa |
3 files changed, 38 insertions(+)
|
|
|
2d7ffa |
|
|
|
2d7ffa |
diff --git a/dracut.8.asc b/dracut.8.asc
|
|
|
2d7ffa |
index e097e769..5af99fa3 100644
|
|
|
2d7ffa |
--- a/dracut.8.asc
|
|
|
2d7ffa |
+++ b/dracut.8.asc
|
|
|
2d7ffa |
@@ -136,6 +136,19 @@ example:
|
|
|
2d7ffa |
----
|
|
|
2d7ffa |
===============================
|
|
|
2d7ffa |
|
|
|
2d7ffa |
+**--force-drivers** _<list of kernel modules>_::
|
|
|
2d7ffa |
+ See add-drivers above. But in this case it is ensured that the drivers
|
|
|
2d7ffa |
+ are tried to be loaded early via modprobe.
|
|
|
2d7ffa |
++
|
|
|
2d7ffa |
+[NOTE]
|
|
|
2d7ffa |
+===============================
|
|
|
2d7ffa |
+If [LIST] has multiple arguments, then you have to put these in quotes. For
|
|
|
2d7ffa |
+example:
|
|
|
2d7ffa |
+----
|
|
|
2d7ffa |
+# dracut --force-drivers "kmodule1 kmodule2" ...
|
|
|
2d7ffa |
+----
|
|
|
2d7ffa |
+===============================
|
|
|
2d7ffa |
+
|
|
|
2d7ffa |
**--omit-drivers** _<list of kernel modules>_::
|
|
|
2d7ffa |
specify a space-separated list of kernel modules not to add to the
|
|
|
2d7ffa |
initramfs.
|
|
|
2d7ffa |
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
|
|
|
2d7ffa |
index f4ad49d2..90120115 100644
|
|
|
2d7ffa |
--- a/dracut.conf.5.asc
|
|
|
2d7ffa |
+++ b/dracut.conf.5.asc
|
|
|
2d7ffa |
@@ -54,6 +54,10 @@ Space-separated lists have to have a leading and trailing space!
|
|
|
2d7ffa |
Specify a space-separated list of kernel modules to add to the initramfs.
|
|
|
2d7ffa |
The kernel modules have to be specified without the ".ko" suffix.
|
|
|
2d7ffa |
|
|
|
2d7ffa |
+*force_drivers+=*" __<list of kernel modules>__ "::
|
|
|
2d7ffa |
+ See add_drivers above. But in this case it is ensured that the drivers
|
|
|
2d7ffa |
+ are tried to be loaded early via modprobe.
|
|
|
2d7ffa |
+
|
|
|
2d7ffa |
*omit_drivers+=*" __<kernel modules>__ "::
|
|
|
2d7ffa |
Specify a space-separated list of kernel modules not to add to the
|
|
|
2d7ffa |
initramfs. The kernel modules have to be specified without the ".ko" suffix.
|
|
|
2d7ffa |
diff --git a/dracut.sh b/dracut.sh
|
|
|
2d7ffa |
index 9dadece0..a34ca2a6 100755
|
|
|
2d7ffa |
--- a/dracut.sh
|
|
|
2d7ffa |
+++ b/dracut.sh
|
|
|
2d7ffa |
@@ -81,6 +81,10 @@ Creates initial ramdisk images for preloading modules
|
|
|
2d7ffa |
exclusively include in the initramfs.
|
|
|
2d7ffa |
--add-drivers [LIST] Specify a space-separated list of kernel
|
|
|
2d7ffa |
modules to add to the initramfs.
|
|
|
2d7ffa |
+ --force-drivers [LIST] Specify a space-separated list of kernel
|
|
|
2d7ffa |
+ modules to add to the initramfs and make sure they
|
|
|
2d7ffa |
+ are tried to be loaded via modprobe same as passing
|
|
|
2d7ffa |
+ rd.driver.pre=DRIVER kernel parameter.
|
|
|
2d7ffa |
--omit-drivers [LIST] Specify a space-separated list of kernel
|
|
|
2d7ffa |
modules not to add to the initramfs.
|
|
|
2d7ffa |
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
|
|
2d7ffa |
@@ -308,6 +312,7 @@ rearrange_params()
|
|
|
2d7ffa |
--long add: \
|
|
|
2d7ffa |
--long force-add: \
|
|
|
2d7ffa |
--long add-drivers: \
|
|
|
2d7ffa |
+ --long force-drivers: \
|
|
|
2d7ffa |
--long omit-drivers: \
|
|
|
2d7ffa |
--long modules: \
|
|
|
2d7ffa |
--long omit: \
|
|
|
2d7ffa |
@@ -476,6 +481,7 @@ while :; do
|
|
|
2d7ffa |
-a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
--force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
--add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
+ --force-drivers) push force_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
--omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
-m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
-o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
|
|
2d7ffa |
@@ -928,6 +934,13 @@ if (( ${#add_drivers_l[@]} )); then
|
|
|
2d7ffa |
fi
|
|
|
2d7ffa |
add_drivers=${add_drivers/-/_}
|
|
|
2d7ffa |
|
|
|
2d7ffa |
+if (( ${#force_drivers_l[@]} )); then
|
|
|
2d7ffa |
+ while pop force_drivers_l val; do
|
|
|
2d7ffa |
+ force_drivers+=" $val "
|
|
|
2d7ffa |
+ done
|
|
|
2d7ffa |
+fi
|
|
|
2d7ffa |
+force_drivers=${force_drivers/-/_}
|
|
|
2d7ffa |
+
|
|
|
2d7ffa |
if (( ${#omit_drivers_l[@]} )); then
|
|
|
2d7ffa |
while pop omit_drivers_l val; do
|
|
|
2d7ffa |
omit_drivers+=" $val "
|
|
|
2d7ffa |
@@ -944,6 +957,7 @@ fi
|
|
|
2d7ffa |
omit_drivers_corrected=""
|
|
|
2d7ffa |
for d in $omit_drivers; do
|
|
|
2d7ffa |
[[ " $drivers $add_drivers " == *\ $d\ * ]] && continue
|
|
|
2d7ffa |
+ [[ " $drivers $force_drivers " == *\ $d\ * ]] && continue
|
|
|
2d7ffa |
omit_drivers_corrected+="$d|"
|
|
|
2d7ffa |
done
|
|
|
2d7ffa |
omit_drivers="${omit_drivers_corrected%|}"
|
|
|
2d7ffa |
@@ -1389,6 +1403,13 @@ if [[ $no_kernel != yes ]]; then
|
|
|
2d7ffa |
if [[ $add_drivers ]]; then
|
|
|
2d7ffa |
hostonly='' instmods -c $add_drivers
|
|
|
2d7ffa |
fi
|
|
|
2d7ffa |
+ if [[ $force_drivers ]]; then
|
|
|
2d7ffa |
+ hostonly='' instmods -c $force_drivers
|
|
|
2d7ffa |
+ rm -f $initdir/etc/cmdline.d/20-force_driver.conf
|
|
|
2d7ffa |
+ for mod in $force_drivers; do
|
|
|
2d7ffa |
+ echo "rd.driver.pre=$mod" >>$initdir/etc/cmdline.d/20-force_drivers.conf
|
|
|
2d7ffa |
+ done
|
|
|
2d7ffa |
+ fi
|
|
|
2d7ffa |
if [[ $filesystems ]]; then
|
|
|
2d7ffa |
hostonly='' instmods -c $filesystems
|
|
|
2d7ffa |
fi
|