initramfs: introduced prerun scripts. 59/34359/2
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 26 Jan 2015 06:37:13 +0000 (15:37 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 26 Jan 2015 06:40:06 +0000 (22:40 -0800)
It is very useful for manipulating some files on rootfs before init.
(Configuration files, ...)

Change-Id: I356a9190b80d3c46fb8f84e8f91d346c24263901
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
ramfs/init

index fa63b8c..b67b248 100644 (file)
@@ -9,9 +9,6 @@ cmdline() {
     [ "$value" != "" ] && echo "$value"
 }
 
-/bin/busybox mkdir -p /dev
-/bin/busybox mount -t devtmpfs devtmpfs /dev
-
 rescue_shell() {
     echo -e "${COLOR_RED}Error !!! Dropping you to a shell.${NO_COLOR}"
     /bin/busybox --install -s /bin
@@ -31,6 +28,9 @@ mount_fs() {
     /bin/busybox mount -o rw $1 $2 || rescue_shell
 }
 
+/bin/busybox mkdir -p /dev
+/bin/busybox mount -t devtmpfs devtmpfs /dev
+
 exec >/dev/console 2>&1
 
 COLOR_BLUE="\033[1;34m" # light blue
@@ -84,6 +84,12 @@ else
     mount_fs $ROOT $NEW_ROOT
 fi
 
+# execute prerun scrpits...
+if [ -r $NEW_ROOT/etc/emulator/prerun ]; then
+    echo -e "${COLOR_BLUE}Prerun...${NO_COLOR}"
+    . $NEW_ROOT/etc/emulator/prerun $NEW_ROOT
+fi
+
 # clean up...
 /bin/busybox umount /proc
 /bin/busybox umount /sys