| /* SPDX-License-Identifier: GPL-2.0+ */ |
| |
| loadaddr=0x90000000 |
| bootcmd= |
| echo "Booting RAUC A/B system"; |
| setenv devtype mmc; setenv devnum 0; |
| test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B"; |
| test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3; |
| test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3; |
| setenv raucslot; |
| for BOOT_SLOT in "${BOOT_ORDER}"; do |
| if test "x${raucslot}" != "x"; then |
| echo "skip remaining slots..."; |
| elif test "x${BOOT_SLOT}" = "xA"; then |
| if test ${BOOT_A_LEFT} -gt 0; then |
| setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1; |
| echo "Found valid RAUC slot A"; |
| setenv raucslot "rauc.slot=A"; |
| setenv raucpart A; setenv distro_bootpart 6; |
| fi; |
| elif test "x${BOOT_SLOT}" = "xB"; then |
| if test ${BOOT_B_LEFT} -gt 0; then |
| setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1; |
| echo "Found valid RAUC slot B"; |
| setenv raucslot "rauc.slot=B"; |
| setenv raucpart B; setenv distro_bootpart 7; |
| fi; |
| fi; |
| done; |
| if test -n "${raucslot}"; then |
| setenv bootargs console=ttyMSM1 root=PARTLABEL=rootfs_${raucpart} rw rootwait ${raucslot}; |
| saveenv; |
| else |
| echo "No valid RAUC slot found. Resetting tries to 3"; |
| setenv BOOT_A_LEFT 3; |
| setenv BOOT_B_LEFT 3; |
| saveenv; |
| reset; |
| fi; |
| load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/fitImage && bootm; |