summaryrefslogtreecommitdiffstats
path: root/boot-scr/replicant-boot.txt
blob: 0786c78f842ae7f53f9e394a38a65f42019ac040 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
VERSION=0001
STATUS=OK

setenv loadaddr 0x80300000
setenv status_flashing 'status set 3'
setenv status_flash_ok 'status set 2 ; STATUS=OK'
setenv status_flash_er 'status set 1 ; STATUS=ERROR'
setenv status_loading 'status set 18'
setenv status_load_ok 'status set 10'
setenv status_load_er 'status set 8'

echo "Replicant GTA04 boot.scr"

if test "${replicant_bootscr_version}" != "${VERSION}" || status check 1
then
	run status_flashing

	mmc rescan 0

	# Flashing bootloader.img
	if fatload mmc 0 0x80300000 bootloader.img
	then
		echo "Flashing: bootloader.img"
		nandecc sw
		nand erase 80000 1e0000
		nand write 0x80300000 80000 150000
		saveenv
	else
		run status_flash_er
	fi

	if fatload mmc 0 0x80300000 boot.scr
	then
		echo "Flashing: boot.scr"
		nandecc sw
		nand write 0x80300000 250000 10000
	else
		run status_flash_er
	fi

	if fatload mmc 0 0x80300000 boot.img
	then
		echo "Flashing: boot.img"
		nandecc sw
		nand erase 280000 400000
		nand write 0x80300000 280000 400000
	else
		run status_flash_er
	fi

	if test "${STATUS}" = "OK"
	then
		setenv replicant_bootscr_version "${VERSION}"
		saveenv
		run status_flash_ok
	fi
else
	if test "x${replicant_sdcard_boot}" = "xyes"
	then
		echo "Loading kernel from sdcard"
		run status_loading
		if mmc rescan 0
		then
			if ext2load mmc 0 ${loadaddr} boot.img
			then
				run status_load_ok
				bootm ${loadaddr}
			else
				run status_load_er
			fi
		else
			run status_load_er
		fi
	else
		echo "Loading kernel from NAND"
		run status_loading
		if nand read ${loadaddr} 280000 400000
		then
			run status_load_ok
			bootm ${loadaddr}
		else
			run status_load_er
		fi
	fi
fi