Annotation of elwix/config/etc/rootfs/rc, revision 1.1.1.1.6.10
1.1 misho 1: #!/bin/sh
2: #
3: # Boot startup script for ELWIX RootFS ...
4: #
1.1.1.1.6.10! misho 5: # $Id: rc,v 1.1.1.1.6.9 2012/10/10 08:58:49 misho Exp $
1.1 misho 6:
7: stty status '^T'
8:
9: trap : 2
10: trap : 3
11: trap : 18
12:
13: HOME=/root
14: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin
15: TERM=xterm
16: BLOCKSIZE=1k
17: EDITOR=vi
18: PAGER=less
19: export HOME PATH TERM BLOCKSIZE EDITOR PAGER
20:
1.1.1.1.6.6 misho 21: FRMDEV="md1"
22: FRMSIZE="82m"
23: FRMFILE="elwix-firmware.sys"
24: FRMPATH="/elwix"
25:
1.1.1.1.6.1 misho 26: FIT2CF="/dev/ufs/fit2cf"
27: CFDIR="/elwix/cf"
28:
1.1 misho 29: umask 022
30:
31: failed_sysvol()
32: {
1.1.1.1.6.10! misho 33: echo " RootFS: Failed $1 - $2 ... Go to emergency shell !!!"
1.1 misho 34:
35: exit 127
36: }
37:
38: boot_elwix()
39: {
1.1.1.1.6.5 misho 40: echo " RootFS: Loading ELWIX system firmware"
1.1.1.1.6.6 misho 41:
42: mdmfs -s $FRMSIZE -S -m0 -oasync $FRMDEV /usr
1.1.1.1.6.10! misho 43: if [ "$?" != "0" ]; then
! 44: failed_sysvol "to mount firmware image " elwix-firmware.sys
! 45: fi
1.1.1.1.6.6 misho 46: cd /usr
1.1.1.1.6.7 misho 47: pax -r -z -pe -f $FRMPATH/$FRMFILE
1.1.1.1.6.10! misho 48: if [ "$?" != "0" ]; then
! 49: failed_sysvol "to load firmware image " elwix-firmware.sys
! 50: fi
1.1.1.1.6.8 misho 51: cd -
52: mount -ur /usr
1.1 misho 53: }
54:
1.1.1.1.6.9 misho 55: mount_usr()
56: {
57: echo " RootFS: Mounting ELWIX system image"
58:
59: mount -t nullfs -r $FRMPATH/usr /usr
1.1.1.1.6.10! misho 60: if [ "$?" != "0" ]; then
! 61: failed_sysvol "to mount system image " elwix-firmware.sys
! 62: fi
1.1.1.1.6.9 misho 63: }
64:
1.1 misho 65: #
66: ## main()
67: #
68:
69: echo "ELWIX>>> Firmware RootFS boot stage ..."
70: echo " RootFS: Mount ELWIX system volume"
71: fsck -q -y 1>/dev/null 2>&1 && mount -a || fsck -y 1>/dev/null 2>&1 && mount -a || \
1.1.1.1.6.1 misho 72: fsck -f -y 1>/dev/null 2>&1 && mount -a || failed_sysvol mount "system volume"
73:
74: if test -c $FIT2CF -a -d $CFDIR; then
75: echo " RootFS: Mount ELWIX flash volume"
76: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
77: fsck -f -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
78: failed_sysvol mount "flash volume"
79: fi
1.1 misho 80:
1.1.1.1.6.10! misho 81: if [ -r $FRMPATH/$FRMFILE ]; then
1.1.1.1.6.5 misho 82: boot_elwix
83: else
1.1.1.1.6.9 misho 84: if [ -d $FRMPATH/usr ]; then
85: mount_usr
86: else
87: echo " RootFS: Skip loading ELWIX system firmware ..."
88: fi
1.1.1.1.6.5 misho 89: fi
1.1 misho 90:
1.1.1.1.6.4 misho 91: exec /etc/rc.init
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>