2 # SeokYeon Hwang (syeon.hwang@samsung.com)
6 value=" $(/bin/busybox cat /proc/cmdline) "
7 value="${value##* $1=}"
9 [ "$value" != "" ] && echo "$value"
13 echo -e "${COLOR_RED}Error !!! Dropping you to a shell.${NO_COLOR}"
14 /bin/busybox --install -s /bin
15 echo -e "${COLOR_BLUE}Opennng a shell on '/dev/hvc0'.${NO_COLOR}"
16 sh </dev/hvc0 >/dev/hvc0 2>&1 &
18 if [ -z $CONSOLE ]; then
22 echo -e "${COLOR_BLUE}Opening a shell on '/dev/${CONSOLE}'.${NO_COLOR}"
24 exec setsid sh -c 'exec sh < /dev/${CONSOLE} >/dev/${CONSOLE} 2>&1'
28 /bin/busybox mount -t $FSTYPE -o rw $1 $2 || rescue_shell
31 /bin/busybox mkdir -p /dev
32 /bin/busybox mount -t devtmpfs devtmpfs /dev
34 exec >/dev/console 2>&1
36 COLOR_BLUE="\033[1;34m" # light blue
37 COLOR_RED="\033[1;31m" # light red
41 #/bin/busybox ls -la /dev >> /dev/console
43 echo -e "${COLOR_BLUE}Preparing...${NO_COLOR}"
44 /bin/busybox mkdir -p /proc
45 /bin/busybox mount -t proc proc /proc
46 /bin/busybox mkdir -p /sys
47 /bin/busybox mount -t sysfs sys /sys
51 CONSOLE=$(cmdline console)
53 FSTYPE=$(cmdline fstype)
56 if [ -z $FSTYPE]; then
61 echo -e "${COLOR_BLUE}Mount image...${NO_COLOR}"
62 /bin/busybox mkdir -p $NEW_ROOT
66 ROOT=$(/bin/busybox findfs LABEL=emulator-rootfs)
69 ROOT=$(/bin/busybox findfs LABEL=platform)
76 mount_fs $ROOT $NEW_ROOT
78 # mount system data area...
79 SYSDATA=$(/bin/busybox findfs LABEL=emulator-sysdata)
80 if [ ! -z $SYSDATA ]; then
81 mount_fs $SYSDATA $NEW_ROOT/opt
84 USER=$(/bin/busybox findfs LABEL=emulator-user)
85 if [ ! -z $USER ]; then
86 mount_fs $USER $NEW_ROOT/opt/usr
89 echo -e "${COLOR_BLUE}Mount ${ROOT}...${NO_COLOR}"
90 mount_fs $ROOT $NEW_ROOT
93 # execute prerun scrpits...
94 if [ -r $NEW_ROOT/etc/emulator/prerun ]; then
95 echo -e "${COLOR_BLUE}Prerun...${NO_COLOR}"
96 . $NEW_ROOT/etc/emulator/prerun $NEW_ROOT
100 /bin/busybox umount /proc
101 /bin/busybox umount /sys
102 #/bin/busybox umount /dev
104 echo -e "${COLOR_BLUE}Switching root...${NO_COLOR}"
105 if [ -z $INIT ]; then
109 /bin/busybox mkdir -p $NEW_ROOT/dev
110 /bin/busybox mount -t devtmpfs devtmpfs $NEW_ROOT/dev
111 /bin/busybox mkdir -p $NEW_ROOT/sys
112 /bin/busybox mount -t sysfs sys $NEW_ROOT/sys
114 /bin/busybox mount -o remount,ro $NEW_ROOT
116 exec /bin/busybox switch_root -c /dev/console $NEW_ROOT $INIT