Refresh the BeagleBone Black image

Barebox won't build (it complains about <linux/list.h> not found and I
cannot easily solve that), so let's go back to U-Boot.

The 2019.01 U-Boot release is buggy in its recognizing of partition
tables (`fatls` complains, for example), and the whole thing reverts to
a "legacy boot", so let's use the latest release, the 2019.07.

I'm also giving up on the g_cdc module because the board that I'm using
has a microUSB header for the debug console.

- FIXME: Properly distinguish between an SD-card boot and an eMMC boot
(right now it is hardcoded to boot from the SD card)
- FIXME: test Rauc updates once eMMC works
- FIXME: activate watchdog from U-Boot

Change-Id: I013f145cf2fe24e41ea0dafd225e3feb1854712c
diff --git a/board/czechlight/beaglebone/rauc.scr.txt b/board/czechlight/beaglebone/rauc.scr.txt
new file mode 100644
index 0000000..8e5ba65
--- /dev/null
+++ b/board/czechlight/beaglebone/rauc.scr.txt
@@ -0,0 +1,35 @@
+echo CzechLight BeagleBone Black RAUC
+
+test -n "${BOOT_A_LEFT}" || setenv BOOT_A_LEFT 3;
+test -n "${BOOT_B_LEFT}" || setenv BOOT_B_LEFT 3;
+test -n "${BOOT_ORDER}" || setenv BOOT_ORDER "A B";
+for BOOT_SLOT in "${BOOT_ORDER}"; do
+  if test "x${rauc_part}" != "x"; then
+    ;
+  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";
+      rauc_part=2;
+      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";
+      rauc_part=4;
+      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} ${scriptaddr} /boot/boot.scr || reset;
+source ${scriptaddr} || reset;