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