2 # Copyright (C) 2006 OpenWrt.org
11 [ -n "$SWITCH_ROOT_TMPFS" ] && {
12 mount none
/mnt
-t tmpfs
13 ( cd /; find -xdev -type d
) |
( cd /mnt
; xargs mkdir
-p )
14 find / \
! -type d
-xdev |
tar -cT /proc
/self
/fd
/0 |
tar -xC /mnt
15 mkdir
/mnt
/proc
/mnt
/dev
/mnt
/tmp
/mnt
/sys
16 mount
-o move
/proc
/mnt
/proc
17 mount
-o move
/dev
/mnt
/dev
18 mount
-o move
/tmp
/mnt
/tmp
19 mount
-o move
/sys
/mnt
/sys
20 rm -rf /proc
/dev
/tmp
/sys
21 exec switch_root
-c /dev
/console
/mnt
/sbin
/init
24 # if we have no root parameter, just go to running from ramfs
26 export NOMOUNT
="No Root"
30 #if we have a failsafe boot selected, dont bother
31 #trying to find or wait for a root mount point
32 [ -z "$FAILSAFE" ] ||
{
33 exec /bin
/busybox init
36 # Load the modules we have in initramfs, this should
37 # make the media accessible, but, it may take some time
39 load_modules
/etc
/modules
/etc
/modules.d
/*
41 #wait 10 seconds for the disc to show up
42 #usb stick typically takes 4 to 6 seconds
44 #it's quite possible the disc never shows up
45 #if we netbooted this kernel
47 while [ $COUNTER -lt 10 ]; do
49 [ -e $rootfs ] && let COUNTER
=10;
53 export FAILSAFE
="NoDisc"
54 exec /bin
/busybox init
57 # now we'll try mount it, again with a timeout
58 # This will fail if the inserted stick is formatted
59 # in a manner we dont understand
61 while [ $COUNTER -lt 10 ]; do
64 [ $?
-eq "0" ] && let COUNTER
=100;
68 export FAILSAFE
="MountFail"
69 exec /bin
/busybox init
72 #It mounted, lets look for a postinit file, again, give it time
73 #I've seen this take 6 seconds to actually complete
75 while [ $COUNTER -lt 10 ]; do
77 [ -e /mnt
/etc
/banner ] && let COUNTER
=10;
80 [ -e /mnt
/etc
/banner ] ||
{
81 export FAILSAFE
="No Openwrt FS"
82 exec /bin
/busybox init
87 mount
-o move
/proc
/mnt
/proc
88 mount
-o move
/dev
/mnt
/dev
89 mount
-o move
/dev
/pts
/mnt
/dev
/pts
90 mount
-o move
/tmp
/mnt
/tmp
91 mount
-o move
/sys
/mnt
/sys
92 mount none
/tmp
-t tmpfs
94 exec switch_root
-c /dev
/console
/mnt
/sbin
/init
This page took 0.046192 seconds and 5 git commands to generate.