From: SeokYeon Hwang Date: Mon, 12 Jan 2015 06:47:06 +0000 (+0900) Subject: initramfs: cleaned up X-Git-Tag: submit/tizen/20160422.055611~1^2~97 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F33485%2F1;p=sdk%2Femulator%2Femulator-kernel.git initramfs: cleaned up Using devtmpfs for populating /dev. Removed pre-made dev nodes. Removed pre-linked binaries to busybox. Change-Id: I10be92fe41da52d3b8b05edbffd2a798a199b9ca Signed-off-by: SeokYeon Hwang --- diff --git a/ramfs/busybox b/ramfs/busybox index dfe2d8f3eb11..e33255438e5e 100755 Binary files a/ramfs/busybox and b/ramfs/busybox differ diff --git a/ramfs/init b/ramfs/init index 7e0cd17b3e57..5b8ed28f931a 100644 --- a/ramfs/init +++ b/ramfs/init @@ -1,19 +1,35 @@ -#!/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 diff --git a/ramfs/initramfs b/ramfs/initramfs index 0a3a2b7f6419..9541a8661679 100755 --- a/ramfs/initramfs +++ b/ramfs/initramfs @@ -1,31 +1,14 @@ # 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