--- /dev/null
+# This script is executed in initramfs.
+
+if [ ! -z $1 ]; then
+ NEW_ROOT=$1
+else
+ NEW_ROOT=
+fi
+
+if [ -d $NEW_ROOT/etc/emulator/prerun.d ]; then
+ for i in $NEW_ROOT/etc/emulator/prerun.d/*.sh; do
+ if [ -r $i ]; then
+ . $i
+ fi
+ done
+ unset i
+fi
+
-#!/bin/sh
+if [ ! -z $1 ]; then
+ NEW_ROOT=$1
+ # if NEW_ROOT is passed, it executed by initramfs.
+ # So, we should prepare some core utils.
+ /bin/busybox ln -sf /bin/busybox /bin/ln
+ ln -sf /bin/busybox /bin/sed
+ ln -sf /bin/busybox /bin/grep
+ ln -sf /bin/busybox /bin/cut
+ ln -sf /bin/busybox /bin/tr
+ ln -sf /bin/busybox /bin/expr
+ ln -sf /bin/busybox /bin/readlink
+else
+ NEW_ROOT=
+fi
CMDLINE=/proc/cmdline
-XML=/etc/config/model-config.xml
-
+XML=$(readlink -f $NEW_ROOT/etc/config/model-config.xml)
echo -e "[${_G} model config setting ${C_}]"
# display resolution
-if grep --silent "video=" $CMDLINE ; then
+if grep -q "video=" $CMDLINE ; then
echo -e "[${_G} modify the resolution value of platform features: ${C_}]"
VIDEO=`sed s/.*video=// $CMDLINE | cut -d ' ' -f1`
fi
# dot per inch
-if grep --silent "dpi=" $CMDLINE ; then
+if grep -q "dpi=" $CMDLINE ; then
echo -e "[${_G} modify the dpi value of platform features: ${C_}]"
DPI=`sed s/.*dpi=// $CMDLINE | cut -d ' ' -f1`
[Service]
Type=oneshot
-# platform features
-ExecStartPre=/bin/sh -c '/etc/emulator/model-config.sh'
+# execute prerun scripts.
+# it is not necessary because it is already executed from initramfs.
+# but we execute it again for sure.
+ExecStartPre=/bin/sh -c '. /etc/emulator/prerun'
# W/A for alarm-service
ExecStart=/bin/touch /dev/rtc1