summaryrefslogtreecommitdiffstats
path: root/boot-scr/boot.txt
blob: 9cdaf101b36887c5ae8f6589dfebc09ebc6f0de3 (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
86
87
88
89
90
setenv kerneladdr 0x82000000
setenv splashzipaddr 0x80400000
setenv splashaddr 0x80800000
setenv status_loading 'status set 18'
setenv status_load_success 'status set 10'
setenv status_load_error 'status set 8'
setenv bootargs mpurate=${mpurate} mux=${mux}

echo "Replicant GTA04"
run status_loading

i2c dev 0

if mmc rescan 0
then
	# Load splash

	if fatload mmc 0 ${splashzipaddr} splash.rgb16z
	then
		unzip ${splashzipaddr} ${splashaddr}
		if lcm init
		then
			lcm power 2
			lcm on
			lcm fb ${splashaddr}
			lcm backlight 255
		fi
	else
		if fatload mmc 0 ${splashaddr} splash
		then
			if lcm init
			then
				lcm power 2
				lcm on
				lcm fb ${splashaddr}
				lcm backlight 255
			fi
		fi
	fi

	# Load kernel

	if status check 1 || ext4load mmc 0:3 ${kerneladdr} .startrecovery
	then
		if fatload mmc 0 ${kerneladdr} recovery.img
		then
			run status_load_success

			lcm backlight 0
			lcm power 0
			lcm off

			bootm ${kerneladdr}
		else
			echo "Loading recovery kernel failed"
			run status_load_error
		fi
	fi

	if fatload mmc 0 ${kerneladdr} boot.img
	then
		run status_load_success

		lcm backlight 0
		lcm power 0
		lcm off

		bootm ${kerneladdr}
	else
		echo "Loading kernel failed"
		run status_load_error

		if fatload mmc 0 ${kerneladdr} recovery.img
		then
			run status_load_success

			lcm backlight 0
			lcm power 0
			lcm off

			bootm ${kerneladdr}
		else
			echo "Loading recovery kernel failed"
			run status_load_error
		fi
	fi
else
	echo "Scanning mmc failed"
	run status_load_error
fi