File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / etc / uboot / rc
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Thu Mar 11 13:59:51 2021 UTC (3 years, 7 months ago) by misho
Branches: MAIN
CVS tags: elwix2_8, elwix2_7, HEAD, ELWIX2_7, ELWIX2_6
ver 2.6

#!/bin/sh
#
# Boot startup script for ELWIX UbootFS ...
#
# $Id: rc,v 1.3 2021/03/11 13:59:51 misho Exp $

stty status '^T'

trap : 2
trap : 3
trap : 18

HOME=/root
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
TERM=xterm
BLOCKSIZE=1k
EDITOR=vi
PAGER=less
export HOME PATH TERM BLOCKSIZE EDITOR PAGER

FRMDEV2="md3"
FRMSIZE2="21m"
FRMFILE2="elwix-firmware2.sys"

FRMPATH="/elwix"
FIT2CF="/dev/ufs/fit2cf"
CFDIR="/elwix/cf"

umask 022

failed_sysvol()
{
	echo " RootFS: Failed $1 - $2 ... Go to emergency shell !!!"

	exit 127
}

boot_elwix2()
{
	echo " UbootFS: Loading ELWIX secondary firmware"

	mdmfs -s $FRMSIZE2 -S -m0 -oasync $FRMDEV2 /elwix/pkg
	if [ "$?" != "0" ]; then
		failed_sysvol "to mount firmware image " $FRMFILE2
	fi
	cd /elwix/pkg
	pax -r -z -pe -f $FRMPATH/$FRMFILE2
	if [ "$?" != "0" ]; then
		failed_sysvol "to load firmware image " $FRMFILE2
	fi
	cd -
	mount -ur /elwix/pkg || failed_sysvol mount "secondary firmware"
}

#
## main()
#

echo "ELWIX>>> Firmware UbootFS boot stage ..."
echo " UbootFS: Mount ELWIX system volume"
fsck -y 1>/dev/null 2>&1 && mount -a || fsck -y 1>/dev/null 2>&1 && mount -a || \
	fsck -f -y 1>/dev/null 2>&1 && mount -a || failed_sysvol mount "system volume"

if test -c "$FIT2CF" -a -d "$CFDIR"; then
	echo " UbootFS: Mount ELWIX flash volume"
	fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
		failed_sysvol mount "flash volume"
fi

if [ -r $FRMPATH/$FRMFILE2 ]; then
	boot_elwix2
fi

exec /etc/rc.init

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>