blob: 25bc7cdbd28bcb10fce089497ab4a04739b20683 [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;
32bootcmd=run finduuid; run distro_bootcmd
33bootdelay=2
34bootlimit=3
35bootm_size=0x10000000
36commit_mmc=
37 if test "${ustate}" = 1 -a "${mmcpart}" != "${mmcpart_committed}"; then
38 setenv mmcpart_committed ${mmcpart};
39 saveenv;
40 fi;
41console=ttymxc0
42fdt_addr=0x83000000
43fdtfile=imx7d-smegw01.dtb
44fit_addr=0x88000000
45image=fitImage
46loadaddr=0x80800000
47loadbootpart=mmc partconf 1 boot_part
48loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image}
49loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}
50mmcargs=
51 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}
52mmcboot=
53 echo Booting...;
54 echo mmcdev: ${mmcdev};
55 run commit_mmc;
56 echo mmcpart: ${mmcpart_committed};
57 run loadpart;
58 echo gptpart: ${gpt_partition_entry};
59 run loadbootpart;
60 if run loadimage; then
61 ;
62 else
63 run altbootcmd;
64 fi;
65 run mmcargs;
66 if bootm ${fit_addr}; then
67 ;
68 else
69 run altbootcmd;
70 fi;
71mmcdev=1
72mmcpart=1
73mmcpart_committed=1
74persist_mmcdev=
75 if test "${mmcdev}" != "${mmcdev_wanted}"; then
76 setenv mmcdev "${mmcdev_wanted}";
77 saveenv;
78 fi;
79setup_boot_menu=
80 if test "${mmcdev}" = 1; then
81 setenv emmc_priority 0;
82 setenv sd_priority 1;
83 else
84 setenv emmc_priority 1;
85 setenv sd_priority 0;
86 fi;
87 setenv bootmenu_${emmc_priority} eMMC=run boot_emmc;
88 setenv bootmenu_${sd_priority} SD=run boot_sd;
89SETUP_BOOT_MENU