Return to rc CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / rootfs |
1.1 misho 1: #!/bin/sh 2: # 3: # Boot startup script for ELWIX RootFS ... 4: # 1.8 ! misho 5: # $Id: rc,v 1.7.2.8 2020/06/11 00:56:32 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.8 ! misho 21: ETCDEV="md1" ! 22: ETCSIZE="8m" ! 23: ! 24: VARDEV="md2" ! 25: VARSIZE="16m" ! 26: 1.7 misho 27: FRMDEV="md3" 1.8 ! misho 28: FRMSIZE="96m" 1.2 misho 29: FRMFILE="elwix-firmware.sys" 30: 1.7 misho 31: FRMDEV2="md4" 1.8 ! misho 32: FRMSIZE2="32m" 1.2 misho 33: FRMFILE2="elwix-firmware2.sys" 34: 35: FRMPATH="/elwix" 1.8 ! misho 36: FRM2PATH="/elwix/pkg" 1.2 misho 37: FIT2CF="/dev/ufs/fit2cf" 38: CFDIR="/elwix/cf" 39: 1.8 ! misho 40: ELWIX2="/dev/ufs/elwix2" ! 41: ELWIX="/dev/ufs/elwix" ! 42: 1.1 misho 43: umask 022 44: 45: failed_sysvol() 46: { 1.2 misho 47: echo " RootFS: Failed $1 - $2 ... Go to emergency shell !!!" 1.1 misho 48: 49: exit 127 50: } 51: 52: boot_elwix() 53: { 1.2 misho 54: echo " RootFS: Loading ELWIX system firmware" 55: 1.8 ! misho 56: mdmfs -s $FRMSIZE -S -n -m0 -oasync $FRMDEV /usr 1.2 misho 57: if [ "$?" != "0" ]; then 58: failed_sysvol "to mount firmware image " $FRMFILE 1.1 misho 59: fi 1.2 misho 60: cd /usr 61: pax -r -z -pe -f $FRMPATH/$FRMFILE 62: if [ "$?" != "0" ]; then 63: failed_sysvol "to load firmware image " $FRMFILE 64: fi 65: cd - 66: mount -ur /usr 67: } 1.1 misho 68: 1.2 misho 69: boot_elwix2() 70: { 71: echo " RootFS: Loading ELWIX secondary firmware" 72: 1.8 ! misho 73: mdmfs -s $FRMSIZE2 -S -n -m0 -oasync $FRMDEV2 $FRM2PATH 1.2 misho 74: if [ "$?" != "0" ]; then 75: failed_sysvol "to mount firmware image " $FRMFILE2 76: fi 1.8 ! misho 77: cd $FRM2PATH 1.2 misho 78: pax -r -z -pe -f $FRMPATH/$FRMFILE2 79: if [ "$?" != "0" ]; then 80: failed_sysvol "to load firmware image " $FRMFILE2 81: fi 82: cd - 1.8 ! misho 83: mount -ur $FRM2PATH 1.2 misho 84: } 85: 86: mount_usr() 87: { 88: echo " RootFS: Mounting ELWIX system image" 89: 90: mount -t nullfs -r $FRMPATH/usr /usr 91: if [ "$?" != "0" ]; then 92: failed_sysvol "to mount system image " $FRMFILE 93: fi 1.1 misho 94: } 95: 96: # 97: ## main() 98: # 99: 100: echo "ELWIX>>> Firmware RootFS boot stage ..." 1.7 misho 101: 1.8 ! misho 102: mount -ttmpfs tmpfs /tmp ! 103: mdmfs -s $VARSIZE -S -n $VARDEV /var ! 104: ! 105: if test -c $ELWIX2; then ! 106: BOOTSLICE=`kenv currdev` ! 107: if test "${BOOTSLICE#disk0}" != "a:"; then ! 108: ELWIX=$ELWIX2 ! 109: fi ! 110: fi ! 111: ! 112: if ! mount -o ro $ELWIX $FRMPATH 1>/dev/null 2>&1; then ! 113: umount $FRMPATH 1>/dev/null 2>&1 ! 114: fsck -y $ELWIX 1>/dev/null 2>&1 ! 115: if ! mount -o ro $ELWIX $FRMPATH 1>/dev/null 2>&1; then ! 116: umount -f $FRMPATH 1>/dev/null 2>&1 ! 117: fsck -f -y $ELWIX 1>/dev/null 2>&1 ! 118: if ! mount -o ro $ELWIX $FRMPATH; then ! 119: failed_sysvol mount "storage volume" 1.7 misho 120: fi 121: fi 122: fi 1.2 misho 123: 1.4 misho 124: if test -c "$FIT2CF" -a -d "$CFDIR"; then 1.2 misho 125: echo " RootFS: Mount ELWIX flash volume" 1.8 ! misho 126: if ! mount -o ro $FIT2CF $CFDIR; then ! 127: umount $CFDIR ! 128: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 ! 129: if ! mount -o ro $FIT2CF $CFDIR; then ! 130: echo "Error:: mount of $FIT2CF to $CFDIR failed!" ! 131: fi ! 132: fi 1.2 misho 133: fi 134: 135: if [ -r $FRMPATH/$FRMFILE ]; then 136: boot_elwix 137: else 138: if [ -d $FRMPATH/usr ]; then 139: mount_usr 140: else 141: echo " RootFS: Skip loading ELWIX system firmware ..." 142: fi 143: fi 1.1 misho 144: 1.2 misho 145: if [ -r $FRMPATH/$FRMFILE2 ]; then 146: boot_elwix2 147: fi 1.1 misho 148: 1.8 ! misho 149: cd /elwix ! 150: mdmfs -s $ETCSIZE -S -n -m0 -oasync $ETCDEV /etc ! 151: pax -rw -pe etc / ! 152: 1.2 misho 153: exec /etc/rc.init