2 # Copyright (C) 2006 OpenWrt.org
5 export PATH
=/bin
:/sbin
:/usr
/bin
:/usr
/sbin
6 mount none
/proc
-t proc
7 mount none
/sys
-t sysfs
8 size
=$
(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)?mt-l:s}' /proc
/meminfo
)
9 mount none
/tmp
-t tmpfs
-o size
=$size,nosuid
,nodev
,mode
=1777
11 if grep devfs
/proc
/filesystems
> /dev
/null
; then
12 mount none
/dev
-t devfs
14 elif [ -x /sbin
/hotplug2
]; then
15 mount
-t tmpfs tmpfs
/dev
-o size
=512K
16 mknod
/dev
/console c
5 1
19 /sbin
/hotplug2
--no-persistent --coldplug --max_children 1
21 elif [ -x /sbin
/udevd
]; then
22 mount
-n -t tmpfs
-o mode
=0755 udev
/dev
26 if [ -e /proc
/sys
/kernel
/hotplug
]; then
27 echo "" > /proc
/sys
/kernel
/hotplug
36 mount none
/dev
/pts
-t devpts
38 # the root mount point can come from the kernel command line
39 # or it can be overridden in the preinit.arch file
40 trap 'FAILSAFE=true' USR1
41 [ -e /etc
/preinit.arch
] && .
/etc
/preinit.arch
43 echo "$HOTPLUG" > /proc
/sys
/kernel
/hotplug
44 eval ${FAILSAFE:+failsafe}
45 lock
-w /tmp
/.failsafe
47 # if we have no root parameter, just go to running from ramfs
49 export NOMOUNT
="No Root"
53 #if we have a failsafe boot selected, dont bother
54 #trying to find or wait for a root mount point
55 [ -z "$FAILSAFE" ] ||
{
56 exec /bin
/busybox init
59 # Load the modules we have in initramfs, this should
60 # make the media accessible, but, it may take some time
62 load_modules
/etc
/modules
/etc
/modules.d
/*
64 #wait 10 seconds for the disc to show up
65 #usb stick typically takes 4 to 6 seconds
67 #it's quite possible the disc never shows up
68 #if we netbooted this kernel
70 while [ $COUNTER -lt 10 ]; do
72 [ -e $rootfs ] && let COUNTER
=10;
76 export FAILSAFE
="NoDisc"
77 exec /bin
/busybox init
80 # now we'll try mount it, again with a timeout
81 # This will fail if the inserted stick is formatted
82 # in a manner we dont understand
84 while [ $COUNTER -lt 10 ]; do
87 [ $?
-eq "0" ] && let COUNTER
=100;
91 export FAILSAFE
="MountFail"
92 exec /bin
/busybox init
95 #It mounted, lets look for a postinit file, again, give it time
96 #I've seen this take 6 seconds to actually complete
98 while [ $COUNTER -lt 10 ]; do
100 [ -e /mnt
/etc
/banner ] && let COUNTER
=10;
101 let COUNTER
=COUNTER
+1
103 [ -e /mnt
/etc
/banner ] ||
{
104 export FAILSAFE
="No Openwrt FS"
105 exec /bin
/busybox init
110 mount
-o move
/proc
/mnt
/proc
111 mount
-o move
/dev
/mnt
/dev
112 mount
-o move
/dev
/pts
/mnt
/dev
/pts
113 mount
-o move
/tmp
/mnt
/tmp
114 mount
-o move
/sys
/mnt
/sys
115 mount none
/tmp
-t tmpfs
116 exec switch_root
-c /dev
/console
/mnt
/sbin
/init
This page took 0.043738 seconds and 5 git commands to generate.