diff options
-rwxr-xr-x | 1 | 6 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | modules-load | 17 |
3 files changed, 20 insertions, 4 deletions
diff --git a/1 b/1 index 4b895fd..30b7980 100755 --- a/1 +++ b/1 @@ -138,10 +138,8 @@ cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true install -m0664 -o root -g utmp /dev/null /run/utmp rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot -if [ -n "$MODULES" ]; then - msg "Loading kernel modules: ${MODULES} ...\n" - modprobe -ab ${MODULES} -fi +msg "Loading kernel modules: ${MODULES} ...\n" +modules-load ${MODULES} dmesg >/var/log/dmesg.log diff --git a/Makefile b/Makefile index 5af25a0..315b4b4 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ install: install -m755 halt ${DESTDIR}/${PREFIX}/bin install -m755 pause ${DESTDIR}/${PREFIX}/bin install -m755 shutdown.sh ${DESTDIR}/${PREFIX}/bin/shutdown + install -m755 modules-load ${DESTDIR}/${PREFIX}/bin/modules-load install -m755 zzz ${DESTDIR}/${PREFIX}/bin ln -s zzz ${DESTDIR}/${PREFIX}/bin/ZZZ ln -s halt ${DESTDIR}/${PREFIX}/bin/poweroff diff --git a/modules-load b/modules-load new file mode 100755 index 0000000..00eca9f --- /dev/null +++ b/modules-load @@ -0,0 +1,17 @@ +#!/bin/sh +# modules-load [-n] [-v] - modules-load.d(5) compatible kernel module loader + +{ +# Parameters passed as modules-load= or rd.modules-load= in kernel command line. +sed -nr 's/,/\n/;s/(.* |^)(rd\.)?modules-load=([^ ]*).*/\3/p' /proc/cmdline + +# Find files /{etc,run,usr/lib}/modules-load.d/*.conf in that order. +find -L /etc/modules-load.d /run/modules-load.d /usr/lib/modules-load.d \ + -maxdepth 1 -name '*.conf' -printf '%p %P\n' 2>/dev/null | +# Load each basename only once. + sort -k2 -s | uniq -f1 | cut -d' ' -f1 | +# Read the files, output all non-empty, non-comment lines. + xargs -r -d'\n' grep -h -v -e '^[#;]' -e '^$' +} | +# Call modprobe on the list of modules +xargs -r -d'\n' modprobe -ab "$@" |