OSDN Git Service

0-auto-detect: don't load all sound/core modules
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
index d975b8f..de9b754 100644 (file)
@@ -1,6 +1,6 @@
 #
 # By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2012/07/10
+# Last updated 2017/01/17
 #
 # License: GNU Public License
 # We explicitely grant the right to use the scripts
@@ -13,55 +13,24 @@ 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
+       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/*/modalias | dev2mod
+       cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | awk '!seen[$0]++' | dev2mod
        cat /sys/devices/virtual/wmi/*/modalias | dev2mod
 }
 
-load_uvesafb()
-{
-       [ -x /sbin/v86d ] || ln -s ../android/sbin/v86d /sbin
-       [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=redraw}
-}
-
-find_network_dev_name()
-{
-       INITRC=init.x86.rc
-       DHCPCD="/system/bin/dhcpcd -o domain_name_servers"
-       rmline=`grep -n "#REMOVE FROM HERE" $INITRC | cut -d':' -f1`
-       rmline=`expr $rmline + 1`
-       sed -i -e "$rmline,\$d" $INITRC
-       for netdev in `ls /sys/class/net`; do
-               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
-}
-
 load_modules()
 {
-       if [ -n "$FOUND" ]; then
-               [ -n "$PREDEV" ] && modprobe $PREDEV
-               [ -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
 
        # 3G modules
        for m in $EXTMOD; do
-               modprobe $m
+               busybox modprobe $m
        done
-
-       load_uvesafb
 }