File:  [ELWIX - Embedded LightWeight unIX -] / elwix / Attic / install2ub.sh
Revision 1.1.2.1: download - view: text, annotated - select for diffs - revision graph
Tue May 14 08:22:23 2013 UTC (11 years, 1 month ago) by misho
Branches: elwix1_9_mips
added new script for uboot

#!/bin/sh
#
# ELWIX install script for u-boot image
#
# (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
#    by Michael Pounov <misho@elwix.org>
#
# $Id: install2ub.sh,v 1.1.2.1 2013/05/14 08:22:23 misho Exp $
#

[ -r ./config/rc.elwix ] && . ./config/rc.elwix
if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
	echo
	echo "ELWIX project is not configured !?!"
	echo
	exit 1
fi

if [ "${USER}" != "root" ]; then
	echo
	echo "ELWIX project is not configured - install must build under root !?!"
	echo
	exit 1
fi

UB_K=""

cleanUB()
{
	echo "+++ Clean ELWIX U-boot images ..."

	rm -rf ${UB_OBJS}
	install -d ${UB_OBJS}
}

prepareUB()
{
	echo "+++ Prepare ELWIX U-boot kernel ..."

	cp ${KERNEL} ${UB_OBJS}
	${DEST}/cross_exec.sh objcopy -O binary ${UB_KERNEL} ${UB_KERNEL}.bin
}

compUB()
{
	echo "+++ Compress ELWIX U-boot kernel ..."

	case ${UB_COMPRESS} in
		gzip)
			gzip --force --best ${UB_KERNEL}.bin
			UB_K="${UB_KERNEL}.bin.gz"
			;;
		*)
			echo "Error:: not supported compress method ..."
			exit 1
			;;
	esac
}

mkimgUB()
{
	echo "+++ Make ELWIX U-boot kernel image ..."

	mkimage -A ${TARGET} -O linux -T kernel -C ${UB_COMPRESS} \
		-a ${UB_LOADADDR} -e ${UB_ENTRYADDR} -n "ELWIX version ${VERSION} kernel" \
		-d ${UB_K} ${UB_K}.ub
}

instUB()
{
	echo "+++ Install ELWIX U-boot kernel image into release directory ..."

	install ${UB_K}.ub ${REL}
}

### main()

if [ ! -x ${DEST}/cross_exec.sh ]; then
	echo
	echo "Error:: ELWIX cross-toolchain not ready ... First execute ./build_world.sh"
	echo
	exit 1
fi

cleanUB
prepareUB
compUB
mkimgUB
instUB

echo "ELWIX U-boot images install complete."

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