linux-omap 2.6.37: update defconfig to make ds1307 builtin
[openembedded.git] / recipes / slugos-init / files / boot / disk
blob1829033d4e35a4fa01e0e18978f13b91d371ad02
1 #!/bin/sh
2 # boot from the hard disk partition "$1" (which
3 # must be given) using options from the rest of
4 # the command line.
6 # Use the standard init path (see /etc/init.d/rcS)
7 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
9 # Mount required fileystems if necessary
10 [ -e /proc/cpuinfo ] || mount -t proc proc /proc
11 [ -e /sys/class ] || mount -t sysfs sysfs /sys
13 # Load the helper functions
14 . /etc/default/functions
15 . /etc/default/modulefunctions
17 leds boot system
19 if test -n "$1"
20 then
21 device="$1"
22 shift
23 # load USB & SCSI storage modules (/proc required!)
24 echo "boot: loading modules required for disk boot"
25 loaddiskmods
26 # waiting for disk
27 if test "$sleep" -gt 0
28 then
29 echo "boot: waiting $sleep seconds for disk"
30 sleep "$sleep"
32 # Attempt to assemble the RAID if necessary
33 if (echo $device | grep -q "^/dev/md")
34 then
35 if test -n "$MDUUID"
36 then
37 echo "boot: assembling RAID array (UUID)"
38 mdadm -Acpartitions --auto=md --uuid="$MDUUID" $device
39 else
40 echo "boot: assembling RAID array (config file)"
41 mdadm -As --auto=md $device
45 # fire the boot
46 echo "boot: rootfs: mount $* $device [$UUID]"
48 # Mount read-write because before exec'ing init
49 # If a UUID is given (in the environment) this
50 # is used in preference to the device, but if
51 # the UUID mount fails a standard device mount
52 # is attempted.
53 if test -n "$UUID" &&
54 mount "$@" UUID="$UUID" /mnt ||
55 mount "$@" "$device" /mnt
56 then
57 # checkmount checks for sh, chroot, init, /dev
58 # and /mnt (i.e. /mnt/mnt in this case).
59 # minimaldevnodes checks (and creates if required)
60 # a few mandatory /dev nodes we may need.
61 if checkmount /mnt && minimaldevnodes /mnt
62 then
63 # pivot to /initrd if available, else /mnt
64 cd /
65 if test -d /mnt/initrd
66 then
67 swivel mnt initrd
68 else
69 swivel mnt mnt
71 # swivel failed
73 # Failure: unmount the partition
74 umount /mnt
75 # Remount /proc and /sys if necessary
76 [ -e /proc/cpuinfo ] || mount -t proc proc /proc
77 [ -e /sys/class ] || mount -t sysfs sysfs /sys
81 # fallback - use the flash boot
82 leds beep -f 1000 -r 2
83 exec /boot/flash