OSDN Git Service

0-auto-detect: don't load all sound/core modules
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
index 6d03549..de9b754 100644 (file)
@@ -1,73 +1,36 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2009/12/10
+# Last updated 2017/01/17
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
 # with Android-x86 project.
 #
 
-error()
-{
-       echo $*
-       return 1
-}
-
 # An auto detect function provided by kinneko
 auto_detect()
 {
        tmp=/tmp/dev2mod
        echo 'dev2mod() { while read dev; do case $dev in' > $tmp
        sort -r /lib/modules/`uname -r`/modules.alias | \
-               sed -n 's/^alias  *\([^ ]*\)  *\(.*\)/\1)modprobe \2;;/p' >> $tmp
+               sed -n 's/^alias  *\([^ ]*\)  *\(.*\)/\1)busybox modprobe \2;;/p' >> $tmp
        echo 'esac; done; }' >> $tmp
-       source $tmp
-       cat /sys/bus/*/devices/*/modalias | dev2mod
-}
-
-find_network_dev_name()
-{
-       wififound=0
-       rmline=`grep -n "#REMOVE FROM HERE" init.rc|cut -d':' -f1`
-       rmline=`expr $rmline + 1`
-       sed -i -e "$rmline,\$d" init.rc
-       dhcpcdopts="-o domain_name_servers -BKL"
-       for netdev in `ls /sys/class/net`; do
-               if [ $netdev = "lo" -o $netdev = "wmaster0" ]; then
-                       continue
-               fi              
-               w=/sys/class/net/$netdev
-               if [ -d $w/wireless -o -d $w/phy80211 ]; then
-                       if [ $wififound -eq 0 ]; then
-                               sed -i "s|\(^ *service wpa_supplicant .*\)\(-i.*\)\( -c.*$\)|\1-i $netdev\3|g" init.rc
-                               wififound=1
-                       fi
-               fi
-               echo "service dhcpcd$netdev /system/bin/dhcpcd $dhcpcdopts $netdev" >> init.rc
-               echo -e "   group system dhcp\n   disabled\n   oneshot\n" >> init.rc
+       for f in $(grep -Eh "drm_kms|sound.core" /lib/modules/`uname -r`/modules.dep | cut -d. -f1); do
+               sed -i "/$(basename $f | sed 's/-/_/g')/d" $tmp
        done
+       source $tmp
+       cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | awk '!seen[$0]++' | dev2mod
+       cat /sys/devices/virtual/wmi/*/modalias | dev2mod
 }
 
 load_modules()
 {
-       if [ -n "$FOUND" ]; then
-               BTDEV="bnep rfcomm sco btusb"
-               for m in $PREDEV $EXTMOD $BTDEV; do
-                       modprobe $m
-               done
-               [ -n "$FB0DEV" -a -z "$UVESA_MODE" ] && modprobe $FB0DEV
-               [ -n "$LANDEV" ] && modprobe $LANDEV
-               [ -n "$WIFDEV" ] && modprobe $WIFDEV
-               [ -n "$SNDDEV" ] && modprobe $SNDDEV
-               [ -n "$CAMDEV" ] && modprobe $CAMDEV
-       else
+       if [ "$AUTO_LOAD" = "old" ]; then
                auto_detect
        fi
 
-       mdev -s
-       [ -c /dev/video0 ] || modprobe vivi
-       [ -d /proc/asound/card0 ] || modprobe snd-dummy
-       [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=redraw}
-       find_network_dev_name
-#      find_wifi_dev_name
+       # 3G modules
+       for m in $EXTMOD; do
+               busybox modprobe $m
+       done
 }