This patch allows to configure kernel modules parameters with uci. 

For a kernel module 'kmod' which can be loaded with 'param1' and
'param2' like :

insmod kmod param1=val1 param2=val2

A config file '/etc/config/kmod' can be created with the following
content :

$ cat /etc/config/kmod
config kernel-module options
   option param1 val1
   option param2 val2

The name of the section MUST be 'options' with this patch.

For example, the ath_pci kernel module can be configured
in /etc/config/ath_pci with :

$ cat /etc/config/ath_pci
config kernel-module options
   option countrycode 250
   option outdoor 1


Please note that currently 'uci show config.section' is broken, so it
is not fully functionnal with the current trunk. I sent a patch for uci
to nbd concerning this issue. 
As it is, it will just ignore parameters but still load modules.

I also updated the corresponding (old) issue in Trac :
https://dev.openwrt.org/cgi-bin/trac.fcgi/ticket/1458#comment:1


Signed-off-by: Frédéric Moulins <[EMAIL PROTECTED]>

diff --git a/package/base-files/files/etc/functions.sh 
b/package/base-files/files/etc/functions.sh
--- a/package/base-files/files/etc/functions.sh
+++ b/package/base-files/files/etc/functions.sh
@@ -141,7 +141,13 @@
 load_modules() {
        [ -d /etc/modules.d ] && {
                cd /etc/modules.d
-               sed 's/^[^#]/insmod &/' $* | ash 2>&- || :
+               for mod in $(sed 's/^#.*//' $*) 
+               do 
+                       uci show $mod.options 2>/dev/null \
+                       | sed -n 's/[^.]*\.[^.]*\.\([^.]*=[^.]*\)/\1/p' \
+                       | xargs insmod $mod 2>/dev/null \
+                       || :
+               done
        }
 }
 
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to