~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 1263ddac8ed0e079a8fbc15ad04713aa2820556d (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
91
92
93
94
95
96
97
98
// SPDX-License-Identifier: GPL-2.0+
#ifdef CONFIG_SYS_BOOT_LOCKED
#define SETUP_BOOT_MENU setup_boot_menu=setenv bootmenu_0 eMMC=run bootcmd
#else
#define SETUP_BOOT_MENU setup_boot_menu= \
			if test "${mmcdev}" = 1; then \
				setenv emmc_priority 0; \
				setenv sd_priority 1; \
			else setenv emmc_priority 1; \
				setenv sd_priority 0; \
			fi; \
			setenv bootmenu_${emmc_priority} eMMC=run boot_emmc; \
			setenv bootmenu_${sd_priority} SD=run boot_sd;
#endif

altbootcmd=
	echo Performing rollback...;
	if test "${mmcpart_committed}" = 1; then
		setenv mmcpart 2;
		setenv mmcpart_committed 2;
	else
		setenv mmcpart 1;
		setenv mmcpart_committed 1;
	fi;
	setenv bootcount 0;
	setenv upgrade_available;
	setenv ustate 3;
	saveenv;
	run bootcmd;
boot_emmc=setenv mmcdev_wanted 1; run persist_mmcdev; run bootcmd;
boot_sd=setenv mmcdev_wanted 0; run persist_mmcdev; run bootcmd;
bootcmd=
	if test "${bootcount}" -gt "${bootlimit}"; then
		run altbootcmd;
	else
		if test "${ustate}" = 1; then
			setenv upgrade_available 1;
			saveenv;
		fi;
		run mmcboot;
	fi;
bootdelay=2
bootlimit=3
bootm_size=0x10000000
commit_mmc=
	if test "${ustate}" = 1 -a "${mmcpart}" != "${mmcpart_committed}"; then
		setenv mmcpart_committed ${mmcpart};
		saveenv;
	fi;
console=ttymxc0
fdt_addr=0x83000000
fdtfile=imx7d-smegw01.dtb
fit_addr=0x88000000
image=fitImage
loadaddr=0x80800000
loadbootpart=mmc partconf 1 boot_part
loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image}
loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}
mmcargs=
	setenv bootargs console=${console},${baudrate} root=/dev/mmcblk${mmcdev}p${gpt_partition_entry} rootwait rw SM_ROOT_DEV=${mmcdev} SM_ROOT_PART=${gpt_partition_entry} SM_BOOT_PART=${boot_part}
mmcboot=
	echo Booting...;
	echo mmcdev: ${mmcdev};
	run commit_mmc;
	echo mmcpart: ${mmcpart_committed};
	run loadpart;
	echo gptpart: ${gpt_partition_entry};
	run loadbootpart;
	if run loadimage; then
		;
	else
		run altbootcmd;
	fi;
	run mmcargs;
	if bootm ${fit_addr}; then
		;
	else
		run altbootcmd;
	fi;
mmcdev=1
mmcpart=1
mmcpart_committed=1
persist_mmcdev=
	if test "${mmcdev}" != "${mmcdev_wanted}"; then
		setenv mmcdev "${mmcdev_wanted}";
		saveenv;
	fi;
setup_boot_menu=
	if test "${mmcdev}" = 1; then
		setenv emmc_priority 0;
		setenv sd_priority 1;
	else
		setenv emmc_priority 1;
		setenv sd_priority 0;
	fi;
	setenv bootmenu_${emmc_priority} eMMC=run boot_emmc;
	setenv bootmenu_${sd_priority} SD=run boot_sd;
SETUP_BOOT_MENU