summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-03-13 18:11:13 +0000
committerJohn Crispin <john@openwrt.org>2013-03-13 18:11:13 +0000
commit1360067c4a75cd1804710e6f25871f695d3271b2 (patch)
tree215b8f9a4ed27ed32b6bbaa76b9f4c4e41e9094e
parent32ebaf0cec183f87596094b10b2f0ab8e786a9b3 (diff)
downloadmtk-20170518-1360067c4a75cd1804710e6f25871f695d3271b2.zip
mtk-20170518-1360067c4a75cd1804710e6f25871f695d3271b2.tar.gz
mtk-20170518-1360067c4a75cd1804710e6f25871f695d3271b2.tar.bz2
update the /init file to start /sbin/init
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36002
-rwxr-xr-xtarget/linux/generic/base-files/init96
1 files changed, 2 insertions, 94 deletions
diff --git a/target/linux/generic/base-files/init b/target/linux/generic/base-files/init
index b4ef4fe..514be57 100755
--- a/target/linux/generic/base-files/init
+++ b/target/linux/generic/base-files/init
@@ -1,96 +1,4 @@
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
-
-INITRAMFS=1
-
-. /etc/preinit
-
-set_state init
-echo "- init -"
-
-[ -n "$SWITCH_ROOT_TMPFS" ] && {
- mount -o noatime none /mnt -t tmpfs
- ( cd /; find -xdev -type d ) | ( cd /mnt; xargs mkdir -p )
- find / \! -type d -xdev | tar -cT /proc/self/fd/0 | tar -xC /mnt
- mkdir /mnt/proc /mnt/dev /mnt/tmp /mnt/sys
- mount -o noatime,move /proc /mnt/proc
- mount -o noatime,move /dev /mnt/dev
- mount -o noatime,move /tmp /mnt/tmp
- mount -o noatime,move /sys /mnt/sys
- rm -rf /proc /dev /tmp /sys
- exec switch_root -c /dev/console /mnt /sbin/init
-}
-
-# if we have no root parameter, just go to running from ramfs
-[ -z $rootfs ] && {
- export NOMOUNT="No Root"
- exec /sbin/init
-}
-
-#if we have a failsafe boot selected, dont bother
-#trying to find or wait for a root mount point
-[ -z "$FAILSAFE" ] || {
- exec /bin/busybox init
-}
-
-# Load the modules we have in initramfs, this should
-# make the media accessible, but, it may take some time
-. /lib/functions.sh
-load_modules /etc/modules /etc/modules.d/*
-
-#wait 10 seconds for the disc to show up
-#usb stick typically takes 4 to 6 seconds
-#till it's readable
-#it's quite possible the disc never shows up
-#if we netbooted this kernel
-COUNTER=0
-while [ $COUNTER -lt 10 ]; do
- sleep 1
- [ -e $rootfs ] && let COUNTER=10;
- let COUNTER=COUNTER+1
-done
-[ -e $rootfs ] || {
- export FAILSAFE="NoDisc"
- exec /bin/busybox init
-}
-
-# now we'll try mount it, again with a timeout
-# This will fail if the inserted stick is formatted
-# in a manner we dont understand
-COUNTER=0
-while [ $COUNTER -lt 10 ]; do
- sleep 1
- mount -o noatime $rootfs /mnt
- [ $? -eq "0" ] && let COUNTER=100;
- let COUNTER=COUNTER+1
-done
-[ $? -ne "0" ] && {
- export FAILSAFE="MountFail"
- exec /bin/busybox init
-}
-
-#It mounted, lets look for a postinit file, again, give it time
-#I've seen this take 6 seconds to actually complete
-COUNTER=0
-while [ $COUNTER -lt 10 ]; do
- sleep 1
- [ -e /mnt/etc/banner ] && let COUNTER=10;
- let COUNTER=COUNTER+1
-done
-[ -e /mnt/etc/banner ] || {
- export FAILSAFE="No Openwrt FS"
- exec /bin/busybox init
-}
-
-unset rootfs
-
-mount -o noatime,move /proc /mnt/proc
-mount -o noatime,move /dev /mnt/dev
-mount -o noatime,move /dev/pts /mnt/dev/pts
-mount -o noatime,move /tmp /mnt/tmp
-mount -o noatime,move /sys /mnt/sys
-mount -o noatime none /tmp -t tmpfs
-killall -q hotplug2
-exec switch_root -c /dev/console /mnt /sbin/init
-
-set_state done
+export INITRAMFS=1
+exec /sbin/init