aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Robbins <drobbins@funtoo.org>2015-02-25 23:08:55 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2017-01-07 16:09:48 -0800
commite249807ef16b86e3223e05d6657698c2a4d77993 (patch)
treefbee7d1ed7750a93a939f20d9a44f501f509e550
parentMakefile: use git for versioning tarball. (diff)
downloadgenkernel-e249807ef16b86e3223e05d6657698c2a4d77993.tar.gz
genkernel-e249807ef16b86e3223e05d6657698c2a4d77993.tar.bz2
genkernel-e249807ef16b86e3223e05d6657698c2a4d77993.zip
Add firstmods boot option (from Funtoo genkernel).
Add firstmods boot option, which allows for a comma-delimited list of modules to try loading first. If rootfstype is specified too, and the block device is visible after these modules are loaded, then the massive module loading is skipped. (cherry picked from commit 7059bfd8c6a4a6ef9c0f3307388d37ad817dd3af) Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r--defaults/initrd.scripts10
-rw-r--r--defaults/linuxrc10
2 files changed, 17 insertions, 3 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 17166e4e..d00e1c7c 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -19,12 +19,14 @@ call_func_timeout()
}
modules_load() {
+ fn=$1
+ shift
for module in $*
do
- echo ${module} >> /etc/modules/extra_load
+ echo ${module} >> /etc/modules/$fn
done
- modules_scan extra_load
+ modules_scan $fn
}
modules_scan() {
@@ -44,6 +46,10 @@ modules_scan() {
printf "%b\n" "${BOLD} ::${NORMAL} Skipping ${x}..."
elif [ "${MLOAD}" = "${MLIST}" ]
then
+ if [ "${ROOTFSTYPE}" != 'auto' ] && [ -b "${REAL_ROOT}" ]; then
+ echo "Root block device found, continuing..."
+ break
+ fi
if [ -n "${DEBUG}" ]; then
printf "%b" "${BOLD} ::${NORMAL} "
printf "%b" "Scanning for ${x}..."
diff --git a/defaults/linuxrc b/defaults/linuxrc
index d09b96f2..db8c4905 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -139,6 +139,10 @@ do
rootdelay|rootwait)
ROOTDELAY=5
;;
+ firstmods=*)
+ FIRSTMODS=${x#*=}
+ FIRSTMODS=$(echo ${MDOLIST} | sed -e 's/,/ /g')
+ ;;
# Module no-loads
doload=*)
MDOLIST=${x#*=}
@@ -363,6 +367,10 @@ then
elif [ -d "/lib/modules/${KV}" ]
then
good_msg 'Loading modules'
+ if [ -n "$FIRSTMODS" ]; then
+ # try these modules first -- detected modules for root device:
+ modules_load firstmods ${FIRSTMODS}
+ fi
# Load appropriate kernel modules
if [ "${NODETECT}" != '1' ]
then
@@ -372,7 +380,7 @@ then
done
fi
# Always eval doload=...
- modules_load ${MDOLIST}
+ modules_load extra_load ${MDOLIST}
else
good_msg 'Skipping module load; no modules in the ramdisk!'
fi