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 -o ro $device /mnt || continue
40 if [ ! -e ramdisk.img -o ! \( -e system.img -o -e system.sfs \) ]; then
44 mount -t tmpfs tmpfs /android
46 zcat /mnt/$SRC/ramdisk.img | cpio -id > /dev/null
47 if [ -e /mnt/$SRC/system.sfs ]; then
48 mount -o loop /mnt/$SRC/system.sfs /sfs
49 mount -o loop /sfs/system.img system
51 mount -o loop /mnt/$SRC/system.img system
54 mount -t tmpfs tmpfs cache
55 echo " found at $device"
58 mountpoint -q /android && break
63 ln -s android/system /
65 ln -s ../system/lib/modules /lib
67 if [ -n "$DEBUG" -o -n "$BUSYBOX" ]; then
69 system/bin/ln -s android/lib /lib
70 system/bin/ln -s android/bin /bin
71 sed -i 's|\(PATH *\)\(/sbin\)|\1/bin:\2|;s|\(/system\)\(/bin/sh\)|\2|' init.rc
72 mv /sbin/* /android/sbin
77 if [ -n "$DEBUG" ]; then
78 echo -e "\nType 'exit' to continue booting...\n"
83 for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
89 [ -n "$INSTALL" ] && install_hd
94 if [ -n "$DEBUG" ]; then
95 echo -e "\nUse Alt-F1/F2/F3 to switch between virtual consoles"
96 echo -e "Type 'exit' to enter Android...\n"
98 # FIXME: all error messages in the shell are sent to $LOG
100 chroot /android /init
102 exec switch_root /android /init
105 sh # aviod kernel panic