commit:     e249807ef16b86e3223e05d6657698c2a4d77993
Author:     Daniel Robbins <drobbins <AT> funtoo <DOT> org>
AuthorDate: Thu Feb 26 06:08:55 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Jan  8 00:09:48 2017 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=e249807e

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 <AT> gentoo.org>

 defaults/initrd.scripts | 10 ++++++++--
 defaults/linuxrc        | 10 +++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 17166e4..d00e1c7 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 d09b96f..db8c490 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

Reply via email to