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
18 elif [ -x /sbin
/udevd
]; then
19 mount
-n -t tmpfs
-o mode
=0755 udev
/dev
23 if [ -e /proc
/sys
/kernel
/hotplug
]; then
24 echo "" > /proc
/sys
/kernel
/hotplug
33 mount none
/dev
/pts
-t devpts
35 # the root mount point can come from the kernel command line
36 # or it can be overridden in the preinit.arch file
37 [ -f /etc
/preinit.arch
] && .
/etc
/preinit.arch
39 # if we have no root parameter, just go to running from ramfs
41 export NOMOUNT
="No Root"
45 #if we have a failsafe boot selected, dont bother
46 #trying to find or wait for a root mount point
47 [ -z "$FAILSAFE" ] ||
{
48 exec /bin
/busybox init
51 # Load the modules we have in initramfs, this should
52 # make the media accessible, but, it may take some time
54 load_modules
/etc
/modules
/etc
/modules.d
/*
56 #wait 10 seconds for the disc to show up
57 #usb stick typically takes 4 to 6 seconds
59 #it's quite possible the disc never shows up
60 #if we netbooted this kernel
62 while [ $COUNTER -lt 10 ]; do
64 [ -e $rootfs ] && let COUNTER
=10;
68 export FAILSAFE
="NoDisc"
69 exec /bin
/busybox init
72 # now we'll try mount it, again with a timeout
73 # This will fail if the inserted stick is formatted
74 # in a manner we dont understand
76 while [ $COUNTER -lt 10 ]; do
79 [ $?
-eq "0" ] && let COUNTER
=100;
83 export FAILSAFE
="MountFail"
84 exec /bin
/busybox init
87 #It mounted, lets look for a postinit file, again, give it time
88 #I've seen this take 6 seconds to actually complete
90 while [ $COUNTER -lt 10 ]; do
92 [ -e /mnt
/etc
/banner ] && let COUNTER
=10;
95 [ -e /mnt
/etc
/banner ] ||
{
96 export FAILSAFE
="No Openwrt FS"
97 exec /bin
/busybox init
102 mount
-o move
/proc
/mnt
/proc
103 mount
-o move
/dev
/mnt
/dev
104 mount
-o move
/dev
/pts
/mnt
/dev
/pts
105 mount
-o move
/tmp
/mnt
/tmp
106 mount
-o move
/sys
/mnt
/sys
107 mount none
/tmp
-t tmpfs
108 exec switch_root
-c /dev
/console
/mnt
/sbin
/init
This page took 0.078883 seconds and 5 git commands to generate.