2 # Copyright (C) 2006 OpenWrt.org
8 # if we have no root parameter, just go to running from ramfs
10 export NOMOUNT="No Root"
14 #if we have a failsafe boot selected, dont bother
15 #trying to find or wait for a root mount point
16 [ -z "$FAILSAFE" ] || {
17 exec /bin/busybox init
20 # Load the modules we have in initramfs, this should
21 # make the media accessible, but, it may take some time
23 load_modules /etc/modules /etc/modules.d/*
25 #wait 10 seconds for the disc to show up
26 #usb stick typically takes 4 to 6 seconds
28 #it's quite possible the disc never shows up
29 #if we netbooted this kernel
31 while [ $COUNTER -lt 10 ]; do
33 [ -e $rootfs ] && let COUNTER=10;
37 export FAILSAFE="NoDisc"
38 exec /bin/busybox init
41 # now we'll try mount it, again with a timeout
42 # This will fail if the inserted stick is formatted
43 # in a manner we dont understand
45 while [ $COUNTER -lt 10 ]; do
48 [ $? -eq "0" ] && let COUNTER=100;
52 export FAILSAFE="MountFail"
53 exec /bin/busybox init
56 #It mounted, lets look for a postinit file, again, give it time
57 #I've seen this take 6 seconds to actually complete
59 while [ $COUNTER -lt 10 ]; do
61 [ -e /mnt/etc/banner ] && let COUNTER=10;
64 [ -e /mnt/etc/banner ] || {
65 export FAILSAFE="No Openwrt FS"
66 exec /bin/busybox init
71 mount -o move /proc /mnt/proc
72 mount -o move /dev /mnt/dev
73 mount -o move /dev/pts /mnt/dev/pts
74 mount -o move /tmp /mnt/tmp
75 mount -o move /sys /mnt/sys
76 mount none /tmp -t tmpfs
78 exec switch_root -c /dev/console /mnt /sbin/init