dracut: add --kmoddir directory, where to look for kernel modules
authorHarald Hoyer <harald@eeepc.(none)>
Tue, 21 Jul 2009 15:25:12 +0000 (17:25 +0200)
committerHarald Hoyer <harald@eeepc.(none)>
Tue, 21 Jul 2009 15:25:12 +0000 (17:25 +0200)
       -k, --kmoddir [DIR]
              specify the directory, where to look for kernel modules

dracut
dracut-functions
dracut.8

diff --git a/dracut b/dracut
index ee8f6eb..ac40bf9 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -22,6 +22,7 @@ Creates initial ramdisk images for preloading modules
   -a, --add [LIST]      Add a space-separated list of dracut modules.
   -d, --drivers [LIST]  Specify a space-separated list of kernel modules to
                          include in the initramfs.
+  -k, --kmoddir [DIR]   Specify the directory, where to look for kernel modules
   -h, --help            This message
   --debug               Output debug information of the build process
   -v, --verbose         Verbose output during the build process
@@ -48,6 +49,7 @@ while (($# > 0)); do
        -o|--omit) omit_dracutmodules_l="$2"; shift;;
        -a|--add) add_dracutmodules_l="$2"; shift;;
        -d|--drivers) drivers_l="$2"; shift;;
+       -k|--kmoddir) drivers_dir_l="$2"; shift;;
        -h|--help) usage; exit 1 ;;
        --debug) debug="yes";;
        -v|--verbose) beverbose="yes";;
@@ -79,6 +81,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
 [[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
 [[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
 [[ $drivers_l ]] && drivers=$drivers_l
+[[ $drivers_dir_l ]] && drivers_dir=$drivers_l
 [[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
 
 [[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
@@ -115,7 +118,7 @@ trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
 # Need to be able to have non-root users read stuff (rpcbind etc)
 chmod 755 "$initdir"
 
-export initdir hookdirs dsrc dracutmodules drivers debug beverbose
+export initdir hookdirs dsrc dracutmodules drivers drivers_dir debug beverbose
 
 # Create some directory structure first
 for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do 
index 43373a0..dc7021a 100755 (executable)
@@ -267,7 +267,9 @@ check_modules() {
 # install kernel modules, and handle installing all their dependencies as well.
 instmods() {
     local mod mpargs modpath modname cmd
-    local srcmods="/lib/modules/$kernel/"
+    local srcmods
+    srcmods="/lib/modules/$kernel/"
+    [ -n "$drivers_dir" ] && srcmods="$drivers_dir"
     while (($# > 0)); do
        mod=${1%.ko}
        case $mod in
index fdec919..4d62cfe 100644 (file)
--- a/dracut.8
+++ b/dracut.8
@@ -30,6 +30,9 @@ add a space-separated list of dracut modules.
 .BR \-d ", " \-\-drivers " \fILIST\fR"
 specify a space-separated list of kernel modules to include in the initramfs.
 .TP
+.BR \-k ", " \-\-kmoddir " \fI[DIR]\fR   
+specify the directory, where to look for kernel modules
+.TP
 .BR \-h ", " \-\-help
 display help text and exit. 
 .TP