OSDN Git Service

0-auto-detect: disable modules auto loading
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
1 #
2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2016/08/14
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)busybox modprobe \2;;/p' >> $tmp
17         echo 'esac; done; }' >> $tmp
18         sed -i '/brcmfmac/d' $tmp
19         source $tmp
20         cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | awk '!seen[$0]++' | dev2mod
21         cat /sys/devices/virtual/wmi/*/modalias | dev2mod
22 }
23
24 load_modules()
25 {
26         if [ "$AUTO_LOAD" = "old" ]; then
27                 auto_detect
28         fi
29
30         # 3G modules
31         for m in $EXTMOD; do
32                 busybox modprobe $m
33         done
34 }