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