Skip to contentSkip to conversation

build initramfs: unclear _mpargs in instmods()

PATCH John Reiser 2 participants 2 messages Aug 29, 2011 – Aug 30, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

The local variable _mpargs in function instmods() in file dracut-functions looks peculiar. The documentation is non-existent, but still ...

First, $_mpargs is not passed to modprobe via for_each_kmod_dep. This is strange because my guess is that "_mpargs" means "extra arguments for modprobe".

Second, the leading "--" will be lopped when a leading pathname is stripped via

	_mod=${_mod##*/}

It seems to me that a leading "--" should inhibit modification.

Here's the corresponding patch to current HEAD (from dracut-013.)

dracut-functions +1 -2
index a3340e4..c28766e 100755
@@ -919,7 +919,6 @@ instmods() {
                 fi
                 ;;
             --*)
-                _mod=${_mod##*/}
                 _mpargs+=" $_mod";;
             i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
             *)  _mod=${_mod##*/}
@@ -942,7 +941,7 @@ instmods() {
                 # ok, load the module, all its dependencies, and any firmware
                 # it may require
                 for_each_kmod_dep install_kmod_with_fw $_mod \
-                    --set-version $kernel ${_moddirname}
+                    --set-version $kernel ${_moddirname} $_mpargs
                 ((_ret+=$?))
                 ;;
         esac
#2 lore raw
In reply to a message not in the archive
Quoted 28 lines · John Reiser

The local variable _mpargs in function instmods() in file dracut-functions looks peculiar. The documentation is non-existent, but still ...

First, $_mpargs is not passed to modprobe via for_each_kmod_dep. This is strange because my guess is that "_mpargs" means "extra arguments for modprobe".

Second, the leading "--" will be lopped when a leading pathname is stripped via

	_mod=${_mod##*/}

It seems to me that a leading "--" should inhibit modification.

Here's the corresponding patch to current HEAD (from dracut-013.)

dracut-functions +0 -1
index a3340e4..c28766e 100755
@@ -919,7 +919,6 @@ instmods() {
                 fi
                 ;;
             --*)
-                _mod=${_mod##*/}
                 _mpargs+=" $_mod";;
             i2o_scsi) shift; continue;; # Do not load this diagnostic-only module
             *)  _mod=${_mod##*/}

dracut-functions instmods() { · line 947

Quoted 8 lines
dracut-functions +1 -1
@@ -942,7 +941,7 @@ instmods() {
                 # ok, load the module, all its dependencies, and any firmware
                 # it may require
                 for_each_kmod_dep install_kmod_with_fw $_mod \
-                    --set-version $kernel ${_moddirname}
+                    --set-version $kernel ${_moddirname} $_mpargs
                 ((_ret+=$?))
                 ;;
         esac

git blame was my friend to find out, what the original intention of $_mpargs was:

modprobe $mpargs --set-version $kernel --show-depends $mod

so, your patch seems to be correct!

Thanks!