#
# By Chih-Wei Huang <cwhuang@linux.org.tw>
-# Last updated 2009/08/14
+# Last updated 2017/01/17
#
# License: GNU Public License
# We explicitely grant the right to use the scripts
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
-}
-
-# 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
-
-asus_info()
-{
- # common for all Eee PC models
- [ -c /dev/fb0 ] || FB0DEV=i915
- EXTMOD=eeepc-laptop
- PREDEV=snd-hda-codec-realtek
- SNDDEV=snd-hda-intel
- CAMDEV=uvcvideo
-
- board=`cat /sys/class/dmi/id/product_name`
- # assume Eee PC models
- case "$board" in
- 700|701|900)
- LANDEV=atl2
- WIFDEV=ath5k
- ;;
- 701SD|900SD)
- LANDEV=atl1e
- WIFDEV=rtl8187se
- ;;
- 900A|904HD|1000HD)
- LANDEV=atl1e
- WIFDEV=ath5k
- ;;
- 901|1000|1000H)
- LANDEV=atl1e
- WIFDEV=rt2860sta
- ;;
- ET1602*)
- FB0DEV=
- UVESA_MODE=${UVESA_MODE:-1366x768}
- LANDEV=r8169
- WIFDEV=rt2860sta
- ;;
- T91)
- FB0DEV=
- UVESA_MODE=${UVESA_MODE:-1024x600}
- LANDEV=atl1e
- WIFDEV=ath9k
- ;;
- A6VM*)
- EXTMOD=asus-laptop
- LANDEV=skge
- WIFDEV=ipw2200
- ;;
- *)
- LANDEV=atl1e
- WIFDEV=ath9k
- ;;
- esac
-}
-
-vbox_info()
-{
- LANDEV=pcnet32
- SNDDEV="snd-sb16 isapnp=0 irq=5"
- VESA=1
-}
-
-qemu_info()
-{
- LANDEV=8139cp
- SNDDEV=snd-ens1370
-}
-
-vmware_info()
-{
- LANDEV=pcnet32
- SNDDEV=snd-ens1371
-}
-
-detect_hardware()
-{
- [ "$AUTO" = "1" ] && return
- case "`cat /sys/class/dmi/id/uevent`" in
- *ASUSTeK*)
- get_info=asus_info
- ;;
- *Acer*AO*)
- get_info=ao_info
- ;;
- *VirtualBox*)
- get_info=vbox_info
- ;;
- *QEMU*)
- get_info=qemu_info
- ;;
- *VMware*)
- get_info=vmware_info
- ;;
- *)
- ;;
- esac
- [ -n "$get_info" ] && $get_info && FOUND=1
-}
-
-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
- for netdev in `ls /sys/class/net`; do
- 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 $netdev" >> init.rc
- echo " group system dhcp" >> init.rc
- echo " disabled" >>init.rc
- echo " oneshot" >> 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
- for m in $PREDEV $EXTMOD; 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=ywrap}
- find_network_dev_name
-# find_wifi_dev_name
+ # 3G modules
+ for m in $EXTMOD; do
+ busybox modprobe $m
+ done
}