blob: da3d892f91d40045d659041c1444225e50290860 [file] [log] [blame]
Sumit Gargb35aa4f2024-04-12 15:24:38 +05301/* SPDX-License-Identifier: GPL-2.0+ */
2
3loadaddr=0x90000000
4bootcmd=
5 echo "Booting RAUC A/B system";
6 setenv devtype mmc; setenv devnum 0;
7 test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B";
8 test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3;
9 test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3;
10 setenv raucslot;
11 for BOOT_SLOT in "${BOOT_ORDER}"; do
12 if test "x${raucslot}" != "x"; then
13 echo "skip remaining slots...";
14 elif test "x${BOOT_SLOT}" = "xA"; then
15 if test ${BOOT_A_LEFT} -gt 0; then
16 setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1;
17 echo "Found valid RAUC slot A";
18 setenv raucslot "rauc.slot=A";
19 setenv raucpart A; setenv distro_bootpart 6;
20 fi;
21 elif test "x${BOOT_SLOT}" = "xB"; then
22 if test ${BOOT_B_LEFT} -gt 0; then
23 setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1;
24 echo "Found valid RAUC slot B";
25 setenv raucslot "rauc.slot=B";
26 setenv raucpart B; setenv distro_bootpart 7;
27 fi;
28 fi;
29 done;
30 if test -n "${raucslot}"; then
31 setenv bootargs console=ttyMSM1 root=PARTLABEL=rootfs_${raucpart} rw rootwait ${raucslot};
32 saveenv;
33 else
34 echo "No valid RAUC slot found. Resetting tries to 3";
35 setenv BOOT_A_LEFT 3;
36 setenv BOOT_B_LEFT 3;
37 saveenv;
38 reset;
39 fi;
40 load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /boot/fitImage && bootm;