commit:     809f1f547f0ba8bfa38bbd0977ab2c57ec4c4581
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 26 21:35:52 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Aug 26 21:46:37 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=809f1f54

defaults/linuxrc: Disable processing of modules_load file by default

Now that we are using (e)udev with kmod support, we can rely on UDEV to
load required kernel modules.

Old module loading based on modules_load file can still be enabled via
boolean "gk.hw.use-modules_load" kernel command-line option which is inverting
and replacing previous "nodetect" kernel command-line option.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.defaults |  1 +
 defaults/initrd.scripts  | 11 +++++++----
 defaults/linuxrc         | 26 ++++++++++++++++++--------
 doc/genkernel.8.txt      | 17 +++++++++++------
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index 3ac5856..e4c861b 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -73,6 +73,7 @@ IP='dhcp'
 GK_BOOTFONT_DISABLED=0
 GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled"
 GK_HW_LOAD_ALL_MODULES=0
+GK_HW_USE_MODULES_LOAD=0
 GK_INIT_LOG='/tmp/init.log'
 GK_INIT_LOG_COPYTO=
 GK_INIT_LOG_COPYTO_DEFAULT='/genkernel-boot.log'

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index fd87623..29ec123 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -2019,10 +2019,13 @@ iface_name() {
 start_network() {
        good_msg "Starting network ..."
 
-       # Load network modules only when we need them to avoid possible
-       # firmware problems for people not using network that early
-       modules_scan net
-       udevsettle
+       if [ "${GK_HW_USE_MODULES_LOAD}" = '1' ]
+       then
+               # Load network modules only when we need them to avoid possible
+               # firmware problems for people not using network that early
+               modules_scan net
+               udevsettle
+       fi
 
        # At least gk.net.iface can only be processed after sysfs was
        # mounted.

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 9793fde..263f738 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -175,9 +175,6 @@ do
                doload=*)
                        MDOLIST=$(echo ${MDOLIST} ${x#*=} | sed -e 's/^\ 
*//;s/,/ /g')
                ;;
-               nodetect)
-                       NODETECT=1
-               ;;
                noload=*)
                        MLIST=$(echo ${MLIST} ${x#*=} | sed -e 's/^\ *//;s/,/ 
/g')
                        export MLIST
@@ -291,6 +288,14 @@ do
                        fi
                        unset tmp_disabled
                ;;
+               gk.hw.use-modules_load=*)
+                       tmp_disabled=${x#*=}
+                       if is_true "${tmp_disabled}"
+                       then
+                               GK_HW_USE_MODULES_LOAD=1
+                       fi
+                       unset tmp_disabled
+               ;;
                gk.log.disabled=*)
                        tmp_disabled=${x#*=}
                        if is_true "${tmp_disabled}"
@@ -542,26 +547,31 @@ fi
 # Load modules listed in MY_HWOPTS if /lib/modules exists for the running 
kernel
 if [ -z "${DO_modules}" ]
 then
-       good_msg 'Skipping module load; disabled via commandline'
+       good_msg 'Skipping module load; disabled via command-line'
 elif [ -d "/lib/modules/${KV}" ]
 then
-       good_msg 'Loading modules ...'
        if [ -n "${FIRSTMODS}" ]
        then
+               good_msg 'Loading first modules ...'
                # try these modules first -- detected modules for root device:
                modules_load firstmods ${FIRSTMODS}
        fi
 
        # Load appropriate kernel modules
-       if [ "${NODETECT}" != '1' ]
+       if [ "${GK_HW_USE_MODULES_LOAD}" = '1' ]
        then
+               good_msg 'Loading modules ...'
                for modules in ${MY_HWOPTS}
                do
                        modules_scan ${modules}
                done
        fi
-       # Always eval doload=...
-       modules_load extra_load ${MDOLIST}
+
+       if [ -n "${MDOLIST}" ]
+       then
+               good_msg 'Loading modules from command-line ...'
+               modules_load extra_load ${MDOLIST}
+       fi
 else
        good_msg 'Skipping module load; no modules in the ramdisk!'
 fi

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 8c527b0..f0e4414 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -823,6 +823,12 @@ when not set. This will allow remote user to provide 
answer through
     loading of all module groups regardless whether root device is
     already available.
 
+*gk.hw.use-modules_load*=<...>::
+    By default, genkernel relies on UDEV's capability to load required
+    kernel modules. This boolean option allows you to force old module
+    loading depending on modules_load file until *root* device becomes
+    available.
+
 *gk.log.disabled*=<...>::
     By default, any shown message and external command calls will be logged
     to '/tmp/init.log' in initramfs. This boolean option allows you to
@@ -848,15 +854,14 @@ NOTE: Because no user interaction is possible when this 
option is set,
 system will automatically reboot on error after a timeout.
 
 *noload*=<...>::
-    List of modules to skip loading.
-    Separate using commas or spaces.
+List of modules to skip loading.
+Separate using commas or spaces.
 
-*nodetect*::
-    Skipping scanning modules using "modprobe <MODULE> -n".
-    Use *doload=* for specifying a whitelist of exceptions.
+NOTE: This option has only an effect when *gk.hw.use-modules_load* is
+enabled.
 
 *doload*=<...>::
-    List of modules to load despite *nodetect*.
+    List of modules which should always be loaded.
 
 *domodules*::
 *nomodules*::

Reply via email to