OSDN Git Service

add auto detect & install scripts
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 17 Jul 2009 11:00:08 +0000 (19:00 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 17 Jul 2009 11:00:08 +0000 (19:00 +0800)
boot/isolinux/isolinux.cfg
initrd/init
initrd/scripts/0-auto-detect [new file with mode: 0644]
initrd/scripts/1-install [new file with mode: 0644]

index 4177a1a..a131443 100644 (file)
@@ -15,12 +15,12 @@ menu color hotkey 7 #ffffffff #ff000000
 label live
        menu label Live CD - Run Android without installation
        kernel /kernel
-       append initrd=/initrd.img root=/dev/ram0 androidboot.hardware=eeepc
+       append initrd=/initrd.img root=/dev/ram0 androidboot.hardware=eeepc quiet
 
 label vesa
        menu label Live CD - VESA mode
        kernel /kernel
-       append initrd=/initrd.img root=/dev/ram0 androidboot.hardware=eeepc vga=788
+       append initrd=/initrd.img root=/dev/ram0 androidboot.hardware=eeepc vga=788 quiet
 
 label debug
        menu label Live CD - Debug mode
index 076513b..29c857d 100755 (executable)
@@ -43,38 +43,53 @@ while [ 1 ]; do
                        mount --move /sfs system
                fi
                mkdir cache sdcard
-               mount -t tmpfs tmpfs data
                mount -t tmpfs tmpfs cache
-               mount -t tmpfs tmpfs sdcard
                echo " found at $device"
                break
        done
        mountpoint -q /android && break
        sleep 1
        echo -n .
+       if [ -n "$DEBUG" ]; then
+               echo -e "\nType 'exit' to continue booting...\n"
+               sh
+       fi
 done
 
 ln -s android/system /
 
 ln -s ../system/lib/modules /lib
 
-# load framebuffer driver
-if [ ! -e /dev/fb0 ]; then
-       modprobe drm
-       # TODO: auto detect and load correct driver
-       modprobe i915
+if [ -n "$DATA" ]; then
+       mount $DATA data
+elif [ -d /mnt/$SRC/data ]; then
+       mount --bind /mnt/$SRC/data data
+else
+       mount -t tmpfs tmpfs data
+fi
+if [ -n "$SDCARD" ]; then
+       mount $SDCARD sdcard
+elif [ -d /mnt/$SRC/sdcard ]; then
+       mount --bind /mnt/$SRC/sdcard sdcard
+else
+       mount -t tmpfs tmpfs sdcard
 fi
 
-# load lan driver
-# TODO
-# load wifi driver
-# TODO
+# load scripts
+for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
+       source $s
+done
+
+for m in $ALL_MODULES; do
+       modprobe $m
+done
+
+[ -n "$INSTALL" ] && install_hd
 
 if [ -n "$DEBUG" ]; then
        echo -e "\nUse Alt-F1/F2/F3 to switch between virtual consoles"
        echo -e "Type 'exit' to enter Android...\n"
 
-
        # FIXME: all error messages in the shell are sent to $LOG
        sh
        chroot /android /init
diff --git a/initrd/scripts/0-auto-detect b/initrd/scripts/0-auto-detect
new file mode 100644 (file)
index 0000000..021bff8
--- /dev/null
@@ -0,0 +1,66 @@
+# TODO: implement a more generic auto detection by scanning /sys
+# For now we just look up the machine name.
+
+# FBDEV:  framebuffer driver
+# LANDEV: lan driver
+# WIFDEV: wifi driver
+# SNDDEV: sound driver
+# CAMDEV: camera driver
+
+get_asus_info()
+{
+       board=`cat /sys/class/dmi/id/board_name`
+       # assume Eee PC models
+       case "$board" in
+               700|701|900)
+                       LANDEV=atl2
+                       WIFDEV=ath5k
+                       ;;
+               701SD|900SD)
+                       LANDEV=atl1e
+                       WIFDEV=rtl8187se
+                       ;;
+               900A|904HD)
+                       LANDEV=atl1e
+                       WIFDEV=ath5k
+                       ;;
+               *)
+                       LANDEV=atl1e
+                       WIFDEV=ath9k
+#                      WIFDEV=rt2860sta
+                       ;;
+       esac
+
+       # common for all Eee PC models
+       FBDEV=i915
+       SNDDEV="snd-hda-codec-realtek snd-hda-intel"
+       CAMDEV=uvcvideo
+}
+
+get_vbox_info()
+{
+       LANDEV=pcnet32
+       SNDDEV=snd-intel8x0
+}
+
+get_qemu_info()
+{
+       LANDEV=8139cp
+       SNDDEV=snd-ens1370
+}
+
+check_product()
+{
+       grep -q "$1" /sys/class/dmi/id/uevent
+}
+
+detect_hardware()
+{
+       check_product ASUSTeK && get_asus_info
+       check_product VirtualBox && get_vbox_info
+       check_product QEMU && get_qemu_info
+}
+
+detect_hardware
+
+ALL_MODULES="$FBDEV $LANDEV $WIFDEV $SNDDEV $CAMDEV"
diff --git a/initrd/scripts/1-install b/initrd/scripts/1-install
new file mode 100644 (file)
index 0000000..7609931
--- /dev/null
@@ -0,0 +1,4 @@
+install_hd()
+{
+       dialog --title " WARNING " --msgbox '\n  Installation is not implemented yet.\n  Press OK to run live version.' 8 45
+}