blob: 1263ddac8ed0e079a8fbc15ad04713aa2820556d [file] [log] [blame]
Fabio Estevamf4630122023-04-26 13:05:01 -03001// SPDX-License-Identifier: GPL-2.0+
2#ifdef CONFIG_SYS_BOOT_LOCKED
3#define SETUP_BOOT_MENU setup_boot_menu=setenv bootmenu_0 eMMC=run bootcmd
4#else
5#define SETUP_BOOT_MENU setup_boot_menu= \
6 if test "${mmcdev}" = 1; then \
7 setenv emmc_priority 0; \
8 setenv sd_priority 1; \
9 else setenv emmc_priority 1; \
10 setenv sd_priority 0; \
11 fi; \
12 setenv bootmenu_${emmc_priority} eMMC=run boot_emmc; \
13 setenv bootmenu_${sd_priority} SD=run boot_sd;
14#endif
15
16altbootcmd=
17 echo Performing rollback...;
18 if test "${mmcpart_committed}" = 1; then
19 setenv mmcpart 2;
20 setenv mmcpart_committed 2;
21 else
22 setenv mmcpart 1;
23 setenv mmcpart_committed 1;
24 fi;
25 setenv bootcount 0;
26 setenv upgrade_available;
27 setenv ustate 3;
28 saveenv;
29 run bootcmd;
30boot_emmc=setenv mmcdev_wanted 1; run persist_mmcdev; run bootcmd;
31boot_sd=setenv mmcdev_wanted 0; run persist_mmcdev; run bootcmd;
Eduard Strehlauf37cddd2023-06-26 11:31:36 -030032bootcmd=
33 if test "${bootcount}" -gt "${bootlimit}"; then
34 run altbootcmd;
35 else
36 if test "${ustate}" = 1; then
37 setenv upgrade_available 1;
38 saveenv;
39 fi;
40 run mmcboot;
41 fi;
Fabio Estevamf4630122023-04-26 13:05:01 -030042bootdelay=2
43bootlimit=3
44bootm_size=0x10000000
45commit_mmc=
46 if test "${ustate}" = 1 -a "${mmcpart}" != "${mmcpart_committed}"; then
47 setenv mmcpart_committed ${mmcpart};
48 saveenv;
49 fi;
50console=ttymxc0
51fdt_addr=0x83000000
52fdtfile=imx7d-smegw01.dtb
53fit_addr=0x88000000
54image=fitImage
55loadaddr=0x80800000
56loadbootpart=mmc partconf 1 boot_part
57loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image}
58loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}
59mmcargs=
60 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}
61mmcboot=
62 echo Booting...;
63 echo mmcdev: ${mmcdev};
64 run commit_mmc;
65 echo mmcpart: ${mmcpart_committed};
66 run loadpart;
67 echo gptpart: ${gpt_partition_entry};
68 run loadbootpart;
69 if run loadimage; then
70 ;
71 else
72 run altbootcmd;
73 fi;
74 run mmcargs;
75 if bootm ${fit_addr}; then
76 ;
77 else
78 run altbootcmd;
79 fi;
80mmcdev=1
81mmcpart=1
82mmcpart_committed=1
83persist_mmcdev=
84 if test "${mmcdev}" != "${mmcdev_wanted}"; then
85 setenv mmcdev "${mmcdev_wanted}";
86 saveenv;
87 fi;
88setup_boot_menu=
89 if test "${mmcdev}" = 1; then
90 setenv emmc_priority 0;
91 setenv sd_priority 1;
92 else
93 setenv emmc_priority 1;
94 setenv sd_priority 0;
95 fi;
96 setenv bootmenu_${emmc_priority} eMMC=run boot_emmc;
97 setenv bootmenu_${sd_priority} SD=run boot_sd;
98SETUP_BOOT_MENU