Hi,

Here are two files that implement modprobe  for OpenWrt. Comments are
welcome!

package/base-files/files/sbin/recursive_insmod:

recursive_insmod() {
    local moddir="/lib/modules/$(uname -r)"
    local modname=${1%.ko}

    [ -f "$moddir/$modname.ko" ] || echo modprobe: FATAL: Module
"$moddir/$modname.ko" not found
    [ -f "$moddir/$modname.ko" ] || return

    #echo "strings "$moddir/$modname.ko" | sed -ne '/^depends=/ {
s/.*=//; s/,/ /g; p; q }'"
    local depends="$(/bin/busybox strings "$moddir/$modname.ko" | sed
-ne '/^depends=/ { s/.*=//; s/,/ /g; p; q }')"

    local depend
    for depend in $depends; do
        grep -qE "^$depend " /proc/modules || recursive_insmod "$depend"
    done

    insmod $modname  2> /dev/null
    #echo "insmod $modname"
}

recursive_insmod $*

package/base-files/files/sbin/modprobe:

#!/bin/ash

local arguments="$*"
local module=""
[[ -z "$arguments" ]] && exit


while test $# -gt 0
do
    local line="$1"
    [ ${line:0:1} == "#" ] && shift
    [ ${line:0:1} == "-" ] && shift
    recursive_insmod $1
    shift
done

regards,
thomas

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to