-#!/bin/sh
+#!/bin/busybox sh
# SeokYeon Hwang (syeon.hwang@samsung.com)
-COLOR='\033[1;34m' # light blue
-NO_COLOR='\033[0m'
+COLOR_BLUE="\033[1;34m" # light blue
+COLOR_GREEN="\033[1;32m" # light green
+COLOR_RED="\033[1;31m" # light red
+NO_COLOR="\033[0m"
-echo -e "${COLOR}Mount proc filesystem${NO_COLOR}"
-mount -t proc proc /proc
+NEW_ROOT="/new_root"
-echo -e "${COLOR}Mount emulator image${NO_COLOR}"
-mount -o rw /dev/vda /new_root
+/bin/busybox mkdir -p /dev
+/bin/busybox mount -t devtmpfs devtmpfs /dev
-echo -e "${COLOR}Mount dev filesystem${NO_COLOR}"
-/bin/mkdir -p /new_root/dev
-/bin/mount -t devtmpfs devtmpfs /new_root/dev
-/bin/mkdir -p /new_root/sys
+exec &> /dev/console
-echo -e "${COLOR}Switching root${NO_COLOR}"
-exec switch_root -c /dev/console /new_root /sbin/init
+# for debugging...
+#/bin/busybox ls -la /dev >> /dev/console
+
+echo -e "${COLOR_GREEN}Preparing...${NO_COLOR}"
+/bin/busybox mkdir -p /proc
+/bin/busybox mount -t proc proc /proc
+/bin/busybox mkdir -p /sys
+/bin/busybox mount -t sysfs sys /sys
+
+# mount root...
+echo -e "${COLOR_GREEN}Mount image...${NO_COLOR}"
+/bin/busybox mount -o rw /dev/vda $NEW_ROOT
+
+# clean up...
+/bin/busybox umount /proc
+/bin/busybox umount /sys
+
+# switch root...
+echo -e "${COLOR_GREEN}Switching root...${NO_COLOR}"
+exec /bin/busybox switch_root -c /dev/console $NEW_ROOT /sbin/init
# SeokYeon Hwang (syeon.hwang@samsung.com)
-dir /dev 0755 0 0
-
-nod /dev/console 0600 0 0 c 5 1
-nod /dev/zero 0600 0 0 c 1 5
-nod /dev/mem 0600 0 0 c 1 1
-nod /dev/vda 0600 0 0 b 254 0
+# init script
+file /init ramfs/init 0755 0 0
-dir /root 0700 0 0
-dir /sbin 0755 0 0
+# busybox
dir /bin 0755 0 0
-dir /new_root 0755 0 0
-dir /proc 0755 0 0
-
-file /sbin/v86d ramfs/v86d 0755 0 0
-file /init ramfs/init 0755 0 0
file /bin/busybox ramfs/busybox 0755 0 0
-slink /bin/sh /bin/busybox 0755 0 0
-slink /sbin/init /bin/busybox 0755 0 0
-slink /bin/mount /bin/busybox 0755 0 0
-slink /bin/switch_root /bin/busybox 0755 0 0
-slink /bin/mkdir /bin/busybox 0755 0 0
-
-#slink /bin/insmod /bin/busybox 0755 0 0
-#slink /bin/cat /bin/busybox 0755 0 0
-#slink /bin/cp /bin/busybox 0755 0 0
-#slink /bin/mknod /bin/busybox 0755 0 0
-#slink /bin/ln /bin/busybox 0755 0 0
+# vesafb user driver
+# We don't use vesafb anymore, but it is useful for debugging.
+dir /sbin 0755 0 0
+file /sbin/v86d ramfs/v86d 0755 0 0