add missing kconfig symbol
[openwrt.git] / target / linux / generic-2.6 / base-files / init
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 INITRAMFS=1
5
6 . /etc/preinit
7
8 # if we have no root parameter, just go to running from ramfs
9 [ -z $rootfs ] && {
10 export NOMOUNT="No Root"
11 exec /sbin/init
12 }
13
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
18 }
19
20 # Load the modules we have in initramfs, this should
21 # make the media accessible, but, it may take some time
22 . /etc/functions.sh
23 load_modules /etc/modules /etc/modules.d/*
24
25 #wait 10 seconds for the disc to show up
26 #usb stick typically takes 4 to 6 seconds
27 #till it's readable
28 #it's quite possible the disc never shows up
29 #if we netbooted this kernel
30 COUNTER=0
31 while [ $COUNTER -lt 10 ]; do
32 sleep 1
33 [ -e $rootfs ] && let COUNTER=10;
34 let COUNTER=COUNTER+1
35 done
36 [ -e $rootfs ] || {
37 export FAILSAFE="NoDisc"
38 exec /bin/busybox init
39 }
40
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
44 COUNTER=0
45 while [ $COUNTER -lt 10 ]; do
46 sleep 1
47 mount $rootfs /mnt
48 [ $? -eq "0" ] && let COUNTER=100;
49 let COUNTER=COUNTER+1
50 done
51 [ $? -ne "0" ] && {
52 export FAILSAFE="MountFail"
53 exec /bin/busybox init
54 }
55
56 #It mounted, lets look for a postinit file, again, give it time
57 #I've seen this take 6 seconds to actually complete
58 COUNTER=0
59 while [ $COUNTER -lt 10 ]; do
60 sleep 1
61 [ -e /mnt/etc/banner ] && let COUNTER=10;
62 let COUNTER=COUNTER+1
63 done
64 [ -e /mnt/etc/banner ] || {
65 export FAILSAFE="No Openwrt FS"
66 exec /bin/busybox init
67 }
68
69 unset rootfs
70
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
77 killall -q hotplug2
78 exec switch_root -c /dev/console /mnt /sbin/init
This page took 0.061894 seconds and 5 git commands to generate.