2 # Copyright (C) 2006 OpenWrt.org
4 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
5 mount none
/proc
-t proc
6 mount none
/sys
-t sysfs
8 if grep devfs
/proc
/filesystems
> /dev
/null
; then
9 mount none
/dev
-t devfs
11 elif [ -x /sbin
/hotplug2
]; then
12 mount
-t tmpfs tmpfs
/dev
-o size
=512K
13 mknod
/dev
/console c
5 1
16 /sbin
/hotplug2
--no-persistent --coldplug --max_children 1
19 mount none
/dev
/pts
-t devpts
21 # the root mount point can come from the kernel command line
22 # or it can be overridden in the preinit.arch file
23 [ -f /etc
/preinit.arch
] && .
/etc
/preinit.arch
25 # if we have no root parameter, just go to running from ramfs
27 export NOMOUNT
="No Root"
31 #if we have a failsafe boot selected, dont bother
32 #trying to find or wait for a root mount point
33 [ -z "$FAILSAFE" ] ||
{
34 exec /bin
/busybox init
37 # Load the modules we have in initramfs, this should
38 # make the media accessible, but, it may take some time
40 load_modules
/etc
/modules
/etc
/modules.d
/*
42 #wait 10 seconds for the disc to show up
43 #usb stick typically takes 4 to 6 seconds
45 #it's quite possible the disc never shows up
46 #if we netbooted this kernel
48 while [ $COUNTER -lt 10 ]; do
50 [ -e $rootfs ] && let COUNTER
=10;
54 export FAILSAFE
="NoDisc"
55 exec /bin
/busybox init
58 # now we'll try mount it, again with a timeout
59 # This will fail if the inserted stick is formatted
60 # in a manner we dont understand
62 while [ $COUNTER -lt 10 ]; do
65 [ $?
-eq "0" ] && let COUNTER
=100;
69 export FAILSAFE
="MountFail"
70 exec /bin
/busybox init
73 #It mounted, lets look for a postinit file, again, give it time
74 #I've seen this take 6 seconds to actually complete
76 while [ $COUNTER -lt 10 ]; do
78 [ -e /mnt
/etc
/banner ] && let COUNTER
=10;
81 [ -e /mnt
/etc
/banner ] ||
{
82 export FAILSAFE
="No Openwrt FS"
83 exec /bin
/busybox init
88 mount
-o move
/proc
/mnt
/proc
89 mount
-o move
/dev
/mnt
/dev
90 mount
-o move
/dev
/pts
/mnt
/dev
/pts
91 mount
-o move
/tmp
/mnt
/tmp
92 mount
-o move
/sys
/mnt
/sys
93 mount none
/tmp
-t tmpfs
94 exec switch_root
-c /dev
/console
/mnt
/sbin
/init
This page took 0.046982 seconds and 5 git commands to generate.