blob: 0a8fe1d25dcafad6e78cfa12bf61f1262e9aa993 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/bin/sh
# boot from the hard disk partition "$1" (which
# must be given) using options from the rest of
# the command line.
# Use the standard init path (see /etc/init.d/rcS)
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
# Mount required fileystems if necessary
[ -e /proc/cpuinfo ] || mount -t proc proc /proc
[ -e /sys/class ] || mount -t sysfs sysfs /sys
# Load the helper functions
. /etc/default/functions
leds beep -r 2
leds boot system
if test -n "$1"
then
device="$1"
shift
echo "boot: rootfs: mount $* $device"
# prepare the device. This uses tmpfs to avoid dependency
# on non-built-in file systems and because tmpfs can expand
# to bigger than the 10MByte ram0 partition used before.
# The 'device' is currently unused.
if mount -t tmpfs "$@" tmpfs /mnt
then
cd /
# filter out boot (with zimage), linuxrc and anything
# below /var, keep dev or the boot will fail. Take
# care that nothing is mounted at this point!
umount /proc
umount /sys
find . -xdev -print |
sed '\@^./boot/@d;\@^./boot$@d;\@^./linuxrc@d;\@^./var/@d' |
cpio -p -d -m -u /mnt
# busybox find with -xdev will not print the name of the
# mountpoint, so create the empty dir manually if required.
test -d /mnt/mnt || mkdir /mnt/mnt
# checkmount checks for sh, chroot, init, /dev
# and /mnt (i.e. /mnt/mnt in this case).
# minimaldevnodes checks (and creates if required)
# a few mandatory /dev nodes we may need.
if checkmount /mnt && minimaldevnodes /mnt
then
# pivot to /mnt
cd /
swivel mnt mnt
# swivel failed
fi
# Failure: unmount the partition
umount /mnt
# Remount /proc and /sys if necessary
[ -e /proc/cpuinfo ] || mount -t proc proc /proc
[ -e /sys/class ] || mount -t sysfs sysfs /sys
fi
fi
# fallback - use the flash boot
leds beep -f 1000 -r 2
exec /boot/flash
|