OSDN Git Service

021bff8c32d8e66d471db0e88a2cb82ca24f7a47
[android-x86/bootable-newinstaller.git] / initrd / scripts / 0-auto-detect
1 # TODO: implement a more generic auto detection by scanning /sys
2 # For now we just look up the machine name.
3
4 # FBDEV:  framebuffer driver
5 # LANDEV: lan driver
6 # WIFDEV: wifi driver
7 # SNDDEV: sound driver
8 # CAMDEV: camera driver
9
10 get_asus_info()
11 {
12         board=`cat /sys/class/dmi/id/board_name`
13         # assume Eee PC models
14         case "$board" in
15                 700|701|900)
16                         LANDEV=atl2
17                         WIFDEV=ath5k
18                         ;;
19                 701SD|900SD)
20                         LANDEV=atl1e
21                         WIFDEV=rtl8187se
22                         ;;
23                 900A|904HD)
24                         LANDEV=atl1e
25                         WIFDEV=ath5k
26                         ;;
27                 *)
28                         LANDEV=atl1e
29                         WIFDEV=ath9k
30 #                       WIFDEV=rt2860sta
31                         ;;
32         esac
33
34         # common for all Eee PC models
35         FBDEV=i915
36         SNDDEV="snd-hda-codec-realtek snd-hda-intel"
37         CAMDEV=uvcvideo
38 }
39
40 get_vbox_info()
41 {
42         LANDEV=pcnet32
43         SNDDEV=snd-intel8x0
44 }
45
46 get_qemu_info()
47 {
48         LANDEV=8139cp
49         SNDDEV=snd-ens1370
50 }
51
52 check_product()
53 {
54         grep -q "$1" /sys/class/dmi/id/uevent
55 }
56
57 detect_hardware()
58 {
59         check_product ASUSTeK && get_asus_info
60         check_product VirtualBox && get_vbox_info
61         check_product QEMU && get_qemu_info
62 }
63
64 detect_hardware
65
66 ALL_MODULES="$FBDEV $LANDEV $WIFDEV $SNDDEV $CAMDEV"