OSDN Git Service

initrd: move find_network_dev_name after post_detect.
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 24 Dec 2012 09:19:23 +0000 (17:19 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Sat, 23 Feb 2013 14:51:55 +0000 (22:51 +0800)
initrd/init
initrd/scripts/0-auto-detect

index 5d747c5..f87344c 100755 (executable)
@@ -154,15 +154,7 @@ done
 
 # A target should provide its detect_hardware function.
 # On success, return 0 with the following values set.
-#
-# FB0DEV: framebuffer driver
-# LANDEV: lan driver
-# WIFDEV: wifi driver
-# SNDDEV: sound driver
-# CAMDEV: camera driver
-# PREDEV: any module the drivers depend on but can't be loaded automatically
-# EXTMOD: any other module
-
+# return 1 if it wants to use auto_detect
 [ "$AUTO" != "1" ] && detect_hardware && FOUND=1
 
 [ -n "$INSTALL" ] && do_install
@@ -173,6 +165,7 @@ mount_sdcard
 setup_tslib
 setup_dpi
 post_detect
+find_network_dev_name
 
 if [ -n "$DEBUG" ]; then
        echo -e "\nUse Alt-F1/F2/F3 to switch between virtual consoles"
index 78614a3..ca8fbfc 100644 (file)
@@ -37,15 +37,20 @@ load_uvesafb()
 
 find_network_dev_name()
 {
+       INITRC=init.rc
        DHCPCD="/system/bin/dhcpcd -o domain_name_servers"
-       rmline=`grep -n "#REMOVE FROM HERE" init.rc|cut -d':' -f1`
+       rmline=`grep -n "#REMOVE FROM HERE" $INITRC | cut -d':' -f1`
        rmline=`expr $rmline + 1`
-       sed -i -e "$rmline,\$d" init.rc
+       sed -i -e "$rmline,\$d" $INITRC
        for netdev in `ls /sys/class/net`; do
-               if [ "$netdev" != "lo" -a "$netdev" != "wmaster0" ]; then
-                       echo -e "\nservice dhcpcd_$netdev $DHCPCD -ABKL\n    class main\n    disabled\n    oneshot\n" >> init.rc
-                       echo -e "service iprenew_$netdev $DHCPCD -n\n    class main\n    disabled\n    oneshot" >> init.rc
-               fi
+               case "$netdev" in
+                       lo|ip6tnl*|sit*|tun*|eth0|wlan0|wmaster*)
+                               ;;
+                       *)
+                               echo -e "\nservice dhcpcd_$netdev $DHCPCD -ABDKL\n    class main\n    disabled\n    oneshot\n" >> $INITRC
+                               echo -e "service iprenew_$netdev $DHCPCD -n\n    class main\n    disabled\n    oneshot" >> $INITRC
+                               ;;
+               esac
        done
 }
 
@@ -73,6 +78,4 @@ load_modules()
        [ -c /dev/video0 ] || modprobe vivi
        [ -d /proc/asound/card0 ] || modprobe snd-dummy
        load_uvesafb
-
-       find_network_dev_name
 }