blob: 8e5ba65a48eace6d7bdae2e5e88adedd7e143fef [file] [log] [blame]
Jan Kundrát5fb49922019-08-05 18:27:25 +02001echo CzechLight BeagleBone Black RAUC
2
3test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3;
4test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3;
5test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B";
6for BOOT_SLOT in "${BOOT_ORDER}"; do
7 if test "x${rauc_part}" != "x"; then
8 ;
9 elif test "x${BOOT_SLOT}" = "xA"; then
10 if test ${BOOT_A_LEFT} -gt 0; then
11 setexpr BOOT_A_LEFT ${BOOT_A_LEFT} - 1;
12 echo "Found valid slot A, ${BOOT_A_LEFT} attempts remaining";
13 rauc_part=2;
14 rauc_slot=A;
15 fi;
16 elif test "x${BOOT_SLOT}" = "xB"; then
17 if test ${BOOT_B_LEFT} -gt 0; then
18 setexpr BOOT_B_LEFT ${BOOT_B_LEFT} - 1;
19 echo "Found valid slot B, ${BOOT_B_LEFT} attempts remaining";
20 rauc_part=4;
21 rauc_slot=B;
22 fi;
23 fi;
24done;
25if test -n "${rauc_part}"; then
26 saveenv;
27else
28 echo "No valid slot found, resetting tries to 3";
29 setenv BOOT_A_LEFT 3;
30 setenv BOOT_B_LEFT 3;
31 saveenv;
32 reset;
33fi;
34load mmc 0:${rauc_part} ${scriptaddr} /boot/boot.scr || reset;
35source ${scriptaddr} || reset;