Fabio Estevam | f463012 | 2023-04-26 13:05:01 -0300 | [diff] [blame] | 1 | // 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 | |
| 16 | altbootcmd= |
| 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; |
| 30 | boot_emmc=setenv mmcdev_wanted 1; run persist_mmcdev; run bootcmd; |
| 31 | boot_sd=setenv mmcdev_wanted 0; run persist_mmcdev; run bootcmd; |
| 32 | bootcmd=run finduuid; run distro_bootcmd |
| 33 | bootdelay=2 |
| 34 | bootlimit=3 |
| 35 | bootm_size=0x10000000 |
| 36 | commit_mmc= |
| 37 | if test "${ustate}" = 1 -a "${mmcpart}" != "${mmcpart_committed}"; then |
| 38 | setenv mmcpart_committed ${mmcpart}; |
| 39 | saveenv; |
| 40 | fi; |
| 41 | console=ttymxc0 |
| 42 | fdt_addr=0x83000000 |
| 43 | fdtfile=imx7d-smegw01.dtb |
| 44 | fit_addr=0x88000000 |
| 45 | image=fitImage |
| 46 | loadaddr=0x80800000 |
| 47 | loadbootpart=mmc partconf 1 boot_part |
| 48 | loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image} |
| 49 | loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed} |
| 50 | mmcargs= |
| 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} |
| 52 | mmcboot= |
| 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; |
| 71 | mmcdev=1 |
| 72 | mmcpart=1 |
| 73 | mmcpart_committed=1 |
| 74 | persist_mmcdev= |
| 75 | if test "${mmcdev}" != "${mmcdev_wanted}"; then |
| 76 | setenv mmcdev "${mmcdev_wanted}"; |
| 77 | saveenv; |
| 78 | fi; |
| 79 | setup_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; |
| 89 | SETUP_BOOT_MENU |