OSDN Git Service

0-auto-detect: don't load all sound/core modules
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
1 #
2 # By Chih-Wei Huang <cwhuang@linux.org.tw>
3 # Last updated 2017/01/17
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         for f in $(grep -Eh "drm_kms|sound.core" /lib/modules/`uname -r`/modules.dep | cut -d. -f1); do
19                 sed -i "/$(basename $f | sed 's/-/_/g')/d" $tmp
20         done
21         source $tmp
22         cat /sys/bus/*/devices/*/uevent | grep MODALIAS | sed 's/^MODALIAS=//' | awk '!seen[$0]++' | dev2mod
23         cat /sys/devices/virtual/wmi/*/modalias | dev2mod
24 }
25
26 load_modules()
27 {
28         if [ "$AUTO_LOAD" = "old" ]; then
29                 auto_detect
30         fi
31
32         # 3G modules
33         for m in $EXTMOD; do
34                 busybox modprobe $m
35         done
36 }