Annotation of elwix/config/etc/default/rc, revision 1.3.2.5
1.2 misho 1: #!/bin/sh
2: #
1.3 misho 3: # Boot startup script for ELWIX BaseFS ...
1.2 misho 4: #
1.3.2.5 ! misho 5: # $Id: rc,v 1.3.2.4 2017/06/28 11:59:10 misho Exp $
1.2 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.3.2.4 misho 21: ETCDEV="md1"
22: ETCSIZE="8m"
23:
1.3.2.3 misho 24: FRMDEV2="md4"
1.2 misho 25: FRMSIZE2="21m"
26: FRMFILE2="elwix-firmware2.sys"
27:
28: FRMPATH="/elwix"
29: FIT2CF="/dev/ufs/fit2cf"
30: CFDIR="/elwix/cf"
31:
1.3.2.4 misho 32: ELWIX2="/dev/ufs/elwix2"
1.3.2.5 ! misho 33: ELWIX="/dev/ufs/elwix"
1.3.2.4 misho 34:
1.2 misho 35: umask 022
36:
37: failed_sysvol()
38: {
1.3 misho 39: echo " BaseFS: Failed $1 - $2 ... Go to emergency shell !!!"
1.2 misho 40:
41: exit 127
42: }
43:
44: boot_elwix2()
45: {
1.3 misho 46: echo " BaseFS: Loading ELWIX secondary firmware"
1.2 misho 47:
1.3.2.4 misho 48: mdmfs -s $FRMSIZE2 -S -n -m0 -oasync $FRMDEV2 /elwix/pkg
1.3 misho 49: if test $? -ne 0; then
1.2 misho 50: failed_sysvol "to mount firmware image " $FRMFILE2
51: fi
1.3.2.1 misho 52: cd /elwix/pkg
1.2 misho 53: pax -r -z -pe -f $FRMPATH/$FRMFILE2
1.3 misho 54: if test $? -ne 0; then
1.2 misho 55: failed_sysvol "to load firmware image " $FRMFILE2
56: fi
57: cd -
1.3.2.1 misho 58: mount -ur /elwix/pkg || failed_sysvol mount "secondary firmware"
1.2 misho 59: }
60:
61: #
62: ## main()
63: #
64:
1.3 misho 65: echo "ELWIX>>> Firmware BaseFS boot stage ..."
66:
1.3.2.4 misho 67: if test -c $ELWIX2; then
68: BOOTSLICE=`kenv currdev`
69: if test "${BOOTSLICE#disk0}" != "a:"; then
1.3.2.5 ! misho 70: ELWIX=$ELWIX2
! 71: fi
! 72: fi
! 73:
! 74: if ! mount -o ro $ELWIX $FRMPATH; then
! 75: umount $FRMPATH
! 76: fsck -y $ELWIX 1>/dev/null 2>&1
! 77: if ! mount -o ro $ELWIX $FRMPATH; then
! 78: umount -f $FRMPATH
! 79: fsck -f -y $ELWIX 1>/dev/null 2>&1
! 80: if ! mount -o ro $ELWIX $FRMPATH; then
! 81: failed_sysvol mount "system volume"
! 82: fi
1.3.2.4 misho 83: fi
84: fi
85:
1.3 misho 86: if ! mount -a; then
87: umount -A
88: fsck -y 1>/dev/null 2>&1
89: if ! mount -a; then
90: umount -A -f
91: fsck -f -y 1>/dev/null 2>&1
92: if ! mount -a; then
93: failed_sysvol mount "system volume"
94: fi
95: fi
96: fi
1.2 misho 97:
98: if test -c "$FIT2CF" -a -d "$CFDIR"; then
1.3.2.5 ! misho 99: echo " RootFS: Mount ELWIX flash volume"
! 100: if ! mount -o ro $FIT2CF $CFDIR; then
! 101: umount $CFDIR
! 102: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1
! 103: if ! mount -o ro $FIT2CF $CFDIR; then
! 104: echo "Error:: mount of $FIT2CF to $CFDIR failed!"
! 105: fi
! 106: fi
1.2 misho 107: fi
108:
1.3 misho 109: if test -r "$FRMPATH/$FRMFILE2"; then
1.2 misho 110: boot_elwix2
111: fi
112:
113: exec /etc/rc.init
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>