Annotation of elwix/config/etc/rootfs/rc, revision 1.1.1.1.6.11
1.1 misho 1: #!/bin/sh
2: #
3: # Boot startup script for ELWIX RootFS ...
4: #
1.1.1.1.6.11! misho 5: # $Id: rc,v 1.1.1.1.6.10 2012/10/10 09:14:25 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"
1.1.1.1.6.11! misho 22: FRMSIZE="40m"
1.1.1.1.6.6 misho 23: FRMFILE="elwix-firmware.sys"
24:
1.1.1.1.6.11! misho 25: FRMDEV2="md2"
! 26: FRMSIZE2="42m"
! 27: FRMFILE2="elwix-firmware2.sys"
! 28:
! 29: FRMPATH="/elwix"
1.1.1.1.6.1 misho 30: FIT2CF="/dev/ufs/fit2cf"
31: CFDIR="/elwix/cf"
32:
1.1 misho 33: umask 022
34:
35: failed_sysvol()
36: {
1.1.1.1.6.10 misho 37: echo " RootFS: Failed $1 - $2 ... Go to emergency shell !!!"
1.1 misho 38:
39: exit 127
40: }
41:
42: boot_elwix()
43: {
1.1.1.1.6.5 misho 44: echo " RootFS: Loading ELWIX system firmware"
1.1.1.1.6.6 misho 45:
46: mdmfs -s $FRMSIZE -S -m0 -oasync $FRMDEV /usr
1.1.1.1.6.10 misho 47: if [ "$?" != "0" ]; then
1.1.1.1.6.11! misho 48: failed_sysvol "to mount firmware image " $FRMFILE
1.1.1.1.6.10 misho 49: fi
1.1.1.1.6.6 misho 50: cd /usr
1.1.1.1.6.7 misho 51: pax -r -z -pe -f $FRMPATH/$FRMFILE
1.1.1.1.6.10 misho 52: if [ "$?" != "0" ]; then
1.1.1.1.6.11! misho 53: failed_sysvol "to load firmware image " $FRMFILE
1.1.1.1.6.10 misho 54: fi
1.1.1.1.6.8 misho 55: cd -
56: mount -ur /usr
1.1 misho 57: }
58:
1.1.1.1.6.11! misho 59: boot_elwix2()
! 60: {
! 61: echo " RootFS: Loading ELWIX secondary firmware"
! 62:
! 63: mdmfs -s $FRMSIZE2 -S -m0 -oasync $FRMDEV2 /usr/local
! 64: if [ "$?" != "0" ]; then
! 65: failed_sysvol "to mount firmware image " $FRMFILE2
! 66: fi
! 67: cd /usr/local
! 68: pax -r -z -pe -f $FRMPATH/$FRMFILE2
! 69: if [ "$?" != "0" ]; then
! 70: failed_sysvol "to load firmware image " $FRMFILE2
! 71: fi
! 72: cd -
! 73: mount -ur /usr/local
! 74: }
! 75:
1.1.1.1.6.9 misho 76: mount_usr()
77: {
78: echo " RootFS: Mounting ELWIX system image"
79:
80: mount -t nullfs -r $FRMPATH/usr /usr
1.1.1.1.6.10 misho 81: if [ "$?" != "0" ]; then
1.1.1.1.6.11! misho 82: failed_sysvol "to mount system image " $FRMFILE
1.1.1.1.6.10 misho 83: fi
1.1.1.1.6.9 misho 84: }
85:
1.1 misho 86: #
87: ## main()
88: #
89:
90: echo "ELWIX>>> Firmware RootFS boot stage ..."
91: echo " RootFS: Mount ELWIX system volume"
92: 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 93: fsck -f -y 1>/dev/null 2>&1 && mount -a || failed_sysvol mount "system volume"
94:
95: if test -c $FIT2CF -a -d $CFDIR; then
96: echo " RootFS: Mount ELWIX flash volume"
97: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
98: fsck -f -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
99: failed_sysvol mount "flash volume"
100: fi
1.1 misho 101:
1.1.1.1.6.10 misho 102: if [ -r $FRMPATH/$FRMFILE ]; then
1.1.1.1.6.5 misho 103: boot_elwix
104: else
1.1.1.1.6.9 misho 105: if [ -d $FRMPATH/usr ]; then
106: mount_usr
107: else
108: echo " RootFS: Skip loading ELWIX system firmware ..."
109: fi
1.1.1.1.6.5 misho 110: fi
1.1 misho 111:
1.1.1.1.6.11! misho 112: if [ -r $FRMPATH/$FRMFILE2 ]; then
! 113: boot_elwix2
! 114: fi
! 115:
1.1.1.1.6.4 misho 116: exec /etc/rc.init
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>