Newer
Older
barebox / board / ipe337 / env / bin / boot
@Wolfram Sang Wolfram Sang on 15 Feb 2008 878 bytes add alternate mechanism & flash scripts - part2
#!/bin/sh

. /env/config

. /env/bin/_alternate
if [ $? = 2 ]; then
	act_kernel=/dev/nor0.kernel0
	act_rootfs=/dev/mtdblock5
else
	act_kernel=/dev/nor0.kernel1
	act_rootfs=/dev/mtdblock6
fi
echo "-> Active kernel: $act_kernel"
echo "-> Active system: $act_rootfs"
echo

if [ x$1 = xflash ]; then
	root=flash
	kernel=flash
fi

if [ x$1 = xnet ]; then
	root=net
	kernel=net
fi

if [ x$ip = xdhcp ]; then
	bootargs="$bootargs ip=dhcp"
else
	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
fi

if [ x$root = xflash ]; then
	bootargs="$bootargs root=$act_rootfs rootfstype=jffs2"
else
	bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp"
fi

bootargs="$bootargs mtdparts=physmap-flash.0:$mtdparts"

if [ $kernel = net ]; then
	if [ x$ip = xdhcp ]; then
		dhcp
	fi
	tftp $uimage uImage
	bootm uImage
else
	bootm $act_kernel
fi