install_kmod_with_fw() {
local modname=${1##*/} fwdir found
modname=${modname%.ko}
- inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
+ inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
+ return 0 # no need to go further if the module is already installed
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
found=''
for fwdir in $fw_dir; do
# The behaviour of this function can vary depending on whether $hostonly is set.
# If it is, we will only look at modules that are already in memory.
# If it is not, we will look at all kernel modules
-# This function returns the full filenames of modules that match
+# This function returns the full filenames of modules that match $1
filter_kernel_modules () (
if [[ $hostonly = '' ]]; then
- for modname in $(find "$srcmods/kernel/drivers" -name '*.ko'); do
- "$1" "$modname" && echo "$modname"
- done
+ filtercmd='find "$srcmods/kernel/drivers" -name "*.ko"'
else
- while read modname rest; do
- modname=$(modinfo -F filename -k $kernel $modname)
- "$1" "$modname" && echo "$modname"
- done </proc/modules
+ filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
fi
+ for modname in $(eval $filtercmd); do
+ "$1" "$modname" && echo "$modname"
+ done
)
# install kernel modules along with all their dependencies.
[[ $no_kernel = yes ]] && return
local mod mpargs modpath modname cmd
while (($# > 0)); do
- mod=${1%.ko}
+ mod=${1##*/}
+ mod=${mod%.ko}
case $mod in
=*) # This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
# Must never run this diagnostic-only module
shift; continue;
;;
- *) mod=${mod##*/}
- # if we are already installed, skip this module and go on
+ *) # if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
# If we are building a host-specific initramfs and this