OSDN Git Service

0-auto-detect: a hack to avoid loading brcmfmac
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
1 #
2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2016/01/23
4 #
5 # License: GNU Public License
6 # We explicitely grant the right to use the scripts
7 # with Android-x86 project.
8 #
9
10 # An auto detect function provided by kinneko
11 auto_detect()
12 {
13         tmp=/tmp/dev2mod
14         echo 'dev2mod() { while read dev; do case $dev in' > $tmp
15         sort -r /lib/modules/`uname -r`/modules.alias | \
16                 sed -n 's/^alias  *\([^ ]*\)  *\(.*\)/\1)modprobe \2;;/p' >> $tmp
17         echo 'esac; done; }' >> $tmp
18         sed -i '/brcmfmac/d' $tmp
19         source $tmp
20         cat /sys/bus/*/devices/*/modalias | dev2mod
21         cat /sys/devices/virtual/wmi/*/modalias | dev2mod
22 }
23
24 load_uvesafb()
25 {
26         [ -x /sbin/v86d ] || ln -s ../android/sbin/v86d /sbin
27         [ -c /dev/fb0 ] || modprobe uvesafb mode_option=${UVESA_MODE:-800x600}-16 ${UVESA_OPTION:-mtrr=3 scroll=redraw}
28 }
29
30 load_modules()
31 {
32         if [ -n "$FOUND" ]; then
33                 [ -n "$PREDEV" ] && modprobe $PREDEV
34                 [ -n "$FB0DEV" -a -z "$UVESA_MODE" ] && modprobe $FB0DEV
35                 [ -n "$LANDEV" ] && modprobe $LANDEV
36                 [ -n "$WIFDEV" ] && modprobe $WIFDEV
37                 [ -n "$SNDDEV" ] && modprobe $SNDDEV
38                 [ -n "$CAMDEV" ] && modprobe $CAMDEV
39         else
40                 auto_detect
41         fi
42
43         # 3G modules
44         for m in $EXTMOD; do
45                 modprobe $m
46         done
47
48         load_uvesafb
49 }