3 # By Chih-Wei Huang <cwhuang@linux.org.tw>
4 # Last updated 2010/07/07
6 # License: GNU Public License
7 # We explicitely grant the right to use the scripts
8 # with Android-x86 project.
14 # FIXME: any way to mount ntfs gracefully?
15 mount -o $RW $@ || mount.ntfs-3g -o rw,force $@
18 if [ -n "$DEBUG" ]; then
23 [ -e $LOG ] || busybox mknod $LOG c 1 3
27 busybox mount -t proc proc /proc
28 busybox mount -t sysfs sys /sys
32 export PATH=$PATH:/system/bin
34 if [ -n "$DEBUG" -o -n "$INSTALL" ]; then
35 mknod /dev/tty2 c 4 2 && openvt
36 mknod /dev/tty3 c 4 3 && openvt
38 echo 0 0 0 0 > /proc/sys/kernel/printk
41 echo -n Detecting Android-x86...
46 for device in /dev/sr* /dev/sd[a-z]*; do
47 try_mount ro $device /mnt || continue
49 if [ ! -e ramdisk.img -o ! \( -e system.img -o -e system.sfs \) ]; then
54 mount -t tmpfs tmpfs /android
56 zcat /mnt/$SRC/ramdisk.img | cpio -id > /dev/null
57 if [ -e /mnt/$SRC/system.sfs ]; then
58 mount -o loop /mnt/$SRC/system.sfs /sfs
59 mount -o loop /sfs/system.img system
61 mount -o loop /mnt/$SRC/system.img system
63 mkdir cache mnt mnt/sdcard
64 mount -t tmpfs tmpfs cache
65 echo " found at $device"
68 mountpoint -q /android && break
73 ln -s android/system /
75 ln -s ../system/lib/modules /lib
77 if [ -n "$INSTALL" ]; then
79 zcat /mnt/$SRC/install.img | cpio -iud > /dev/null
82 if [ -n "$DEBUG" -o -n "$BUSYBOX" ]; then
84 system/bin/ln -s android/lib /lib
85 system/bin/ln -s android/bin /bin
86 sed -i 's|\(PATH *\)\(/sbin\)|\1/bin:\2|;s|\(/system\)\(/bin/sh\)|\2|' init.rc
91 ln -s ../android/sbin/hotplug /sbin
94 if [ -n "$DEBUG" ]; then
95 echo -e "\nType 'exit' to continue booting...\n"
100 for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
104 # A target should provide its detect_hardware function.
105 # On success, return 0 with the following values set.
107 # FB0DEV: framebuffer driver
109 # WIFDEV: wifi driver
110 # SNDDEV: sound driver
111 # CAMDEV: camera driver
112 # PREDEV: any module the drivers depend on but can't be loaded automatically
113 # EXTMOD: any other module
115 [ "$AUTO" != "1" ] && detect_hardware && FOUND=1
117 [ -n "$INSTALL" ] && do_install
124 if [ -n "$DEBUG" ]; then
125 echo -e "\nUse Alt-F1/F2/F3 to switch between virtual consoles"
126 echo -e "Type 'exit' to enter Android...\n"
128 # FIXME: all error messages in the shell are sent to $LOG
130 chroot /android /init
132 exec switch_root /android /init
135 sh # avoid kernel panic