3 # By Chih-Wei Huang <cwhuang@linux.org.tw>
4 # Last updated 2009/07/18
6 # License: GNU Public License
7 # We explicitely grant the right to use the scripts
8 # with Android-x86 project.
11 if [ -n "$DEBUG" ]; then
16 [ -e $LOG ] || busybox mknod $LOG c 1 3
20 busybox mount -t proc proc /proc
21 busybox mount -t sysfs sys /sys
25 export PATH=$PATH:/system/bin
27 if [ -n "$DEBUG" ]; then
28 mknod /dev/tty2 c 4 2 && openvt
29 mknod /dev/tty3 c 4 3 && openvt
32 echo -n Detecting Android...
37 for device in /dev/sr* /dev/sd[a-z]*; do
38 mount $device /mnt || continue
40 if [ ! -e ramdisk.img -o ! -e system.img ]; then
44 mount -t tmpfs tmpfs /android
46 zcat /mnt/$SRC/ramdisk.img | cpio -id > /dev/null
47 mount -o loop,ro /mnt/$SRC/system.img /sfs
48 if [ -e /sfs/system.img ]; then
49 mount -o loop,ro /sfs/system.img system
51 mount --move /sfs system
54 mount -t tmpfs tmpfs cache
55 echo " found at $device"
58 mountpoint -q /android && break
61 if [ -n "$DEBUG" ]; then
62 echo -e "\nType 'exit' to continue booting...\n"
67 ln -s android/system /
69 ln -s ../system/lib/modules /lib
71 if [ -b "$DATA" ]; then
73 elif [ -b "/dev/$DATA" ]; then
75 elif [ -d /mnt/$SRC/data ]; then
76 mount --bind /mnt/$SRC/data data
78 mount -t tmpfs tmpfs data
80 if [ -b "$SDCARD" ]; then
82 elif [ -b "/dev/$SDCARD" ]; then
83 mount /dev/$SDCARD sdcard
84 elif [ -n "$SDCARD" ]; then
85 # TODO: SDCARD is specified but does not exist.
86 # Set it to mountd.conf
89 if [ -d /mnt/$SRC/sdcard ]; then
90 mount --bind /mnt/$SRC/sdcard sdcard
92 mount -t tmpfs tmpfs sdcard
97 for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
103 [ -n "$INSTALL" ] && install_hd
105 if [ -n "$DEBUG" ]; then
106 echo -e "\nUse Alt-F1/F2/F3 to switch between virtual consoles"
107 echo -e "Type 'exit' to enter Android...\n"
109 # FIXME: all error messages in the shell are sent to $LOG
111 chroot /android /init
113 exec switch_root /android /init
116 sh # aviod kernel panic