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