From: Chih-Wei Huang Date: Fri, 17 Jul 2009 11:00:08 +0000 (+0800) Subject: add auto detect & install scripts X-Git-Tag: android-x86-1.6~34 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=db34883d4909b13b08c80a3ea3509354cffb3a2b;hp=8153f650b810f8f1858774612705b9528643a2e8;p=android-x86%2Fbootable-newinstaller.git add auto detect & install scripts --- diff --git a/boot/isolinux/isolinux.cfg b/boot/isolinux/isolinux.cfg index 4177a1a..a131443 100644 --- a/boot/isolinux/isolinux.cfg +++ b/boot/isolinux/isolinux.cfg @@ -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 diff --git a/initrd/init b/initrd/init index 076513b..29c857d 100755 --- a/initrd/init +++ b/initrd/init @@ -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 index 0000000..021bff8 --- /dev/null +++ b/initrd/scripts/0-auto-detect @@ -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 index 0000000..7609931 --- /dev/null +++ b/initrd/scripts/1-install @@ -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 +}