summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/boards/ipe337/env/bin/boot
blob: 62807d211fe9d1b14c2a23722359f91eb8a3832c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

. /env/config

alternate $ageing
ret=$?

if [ $ret = 0 ]; then
	echo "Error when accesing ageing-partition!"
	exit 1
elif [ $ret = 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 || exit 1
	bootm uImage
else
	bootm $act_kernel
fi