blob: 99d980edfa9b3a23da8fd19d07132f027e3fedb0 [file] [log] [blame]
test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3
test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3
setenv rauc_part
for BOOT_SLOT in "A B"; do
if test "x${rauc_part}" != "x"; then
# 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 slot A, ${BOOT_A_LEFT} attempts remaining"
setenv rauc_part 2
setenv rauc_slot A
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 slot B, ${BOOT_B_LEFT} attempts remaining"
setenv rauc_part 3
setenv rauc_slot B
fi
fi
done
if test -n "${rauc_part}"; then
saveenv
else
echo "No valid slot found, resetting tries to 3"
setenv BOOT_A_LEFT 3
setenv BOOT_B_LEFT 3
saveenv
reset
fi
load mmc 0:${rauc_part} ${fdt_addr_r} /boot/armada-388-clearfog-base.dtb
load mmc 0:${rauc_part} ${kernel_addr_r} /boot/zImage
setenv bootargs root=/dev/mmcblk0p${rauc_part} rauc.slot=${rauc_slot} czechlight=${czechlight}
bootz ${kernel_addr_r} - ${fdt_addr_r}