U-Boot: drive the USB download screens from the recovery branch
ci / test (push) Canceled after 0s
ci / mcdc (push) Canceled after 0s
ci / bench (push) Canceled after 0s
ci / qemu-tools (push) Canceled after 0s
ci / kernel-symbols (push) Canceled after 0s
ci / patches-apply (push) Canceled after 0s
ci / prune-artifacts (push) Canceled after 0s
ci / quality (push) Canceled after 0s
ci / kernel-build (push) Canceled after 0s
ci / badges (push) Canceled after 0s

flare_ab_boot_failed() ended the recovery branch and the
reset-did-not-take fallback with run_command("download") followed by
hang(). When download returned, the unit stopped silently at the splash.
The sad-face draw result was never logged: do_download() ignores the
rockchip_show_bmp() return, which can be -ENOMEM after the failed FIT
loads.

flare_ab_usb_download() draws logo_recovery.bmp, logs the return code,
runs download, and on return paints the screen again and re-enters
download after a pause. It never returns, and the unit never calls
hang() on these paths.

The no-committed escalation message no longer says both committed slots
failed when the other slot was never committed.

This does not establish the cause of the p54 splash-only screen. The
recovery FIT may boot, or the draw may fail with -ENOMEM; the bench
serial lines (shown=N, download returned N) tell which. The do_reset()
defect is separate (flare-edge#4554).

Refs flare-edge#3118 (cause 3), flare-edge#4554, flare-edge#4564,
flare-edge#4565, flare-edge#4568

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdKQBPu4qHGnopkHjchmwz
This commit is contained in:
BFE Engineering
2026-11-10 14:42:46 -06:00
co-authored by Claude Haiku 5.5
parent 34d383e1ed
commit 8be6ac3625
@@ -142,10 +142,10 @@ index 52cd612d1..a81071566 100644
obj-$(CONFIG_AUTOBOOT) += autoboot.o
diff --git a/sysdrv/source/uboot/u-boot/common/flare_ab.c b/sysdrv/source/uboot/u-boot/common/flare_ab.c
new file mode 100644
index 000000000..903f5b66f
index 000000000..2b41ab8ca
--- /dev/null
+++ b/sysdrv/source/uboot/u-boot/common/flare_ab.c
@@ -0,0 +1,673 @@
@@ -0,0 +1,709 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * flare-edge A/B slot boot for U-Boot proper.
@@ -175,6 +175,9 @@ index 000000000..903f5b66f
+#include <part.h>
+#include <flare_ab.h>
+#include <android_avb/avb_ab_flow.h>
+#if defined(CONFIG_DRM_ROCKCHIP)
+#include <video_rockchip.h>
+#endif
+
+/*
+ * Per-power-session boot-attempt escalation (warehouse deployment).
@@ -553,7 +556,12 @@ index 000000000..903f5b66f
+ return other;
+ }
+
+ printf("FLARE-AB: both committed slots failed this power session, recovery\n");
+ if (slot_is_bootable(&ab_data.slots[other]) &&
+ ab_data.slots[other].successful_boot)
+ printf("FLARE-AB: both committed slots failed this power session, recovery\n");
+ else
+ printf("FLARE-AB: slot %s failed %d attempts this session, no committed alternative, recovery\n",
+ pref ? "_b" : "_a", FLARE_AB_SLOT_TRIES);
+ flare_ab_force_recovery = 1;
+ return pref;
+}
@@ -731,6 +739,36 @@ index 000000000..903f5b66f
+ udelay(100000);
+}
+
+/*
+ * USB download: the terminal state of every failed boot with no slot or
+ * recovery FIT left (decision 2026-11-06, flare-edge#3118 cause 3).
+ *
+ * The sad-face screen is logo_recovery.bmp. rockchip_show_bmp() can fail
+ * (-ENOMEM when the heap cannot hold the decode scratch after the failed FIT
+ * loads), and do_download() ignores that return, so the splash would stay up
+ * with no serial line saying why. The draw is made here and its result is
+ * logged. do_download() paints the same image again as its first step.
+ *
+ * `download` serves rockusb and is not expected to return. If it does (the
+ * USB session ended), the screen is painted again and download is re-entered
+ * after a pause, so the unit stays USB-flashable and never stops silently at
+ * the splash. This function does not return.
+ */
+static void flare_ab_usb_download(void)
+{
+ int rc;
+
+ for (;;) {
+#if defined(CONFIG_DRM_ROCKCHIP)
+ rc = rockchip_show_bmp("logo_recovery.bmp");
+ printf("FLARE-AB: logo_recovery.bmp shown=%d\n", rc);
+#endif
+ rc = run_command("download", 0);
+ printf("FLARE-AB: download returned %d, re-entering\n", rc);
+ udelay(1000000);
+ }
+}
+
+void flare_ab_boot_failed(void)
+{
+ if (!flare_ab_enabled())
@@ -747,8 +785,7 @@ index 000000000..903f5b66f
+ * it over the existing USB port.
+ */
+ printf("FLARE-AB: recovery FIT unbootable, entering USB download\n");
+ run_command("download", 0);
+ hang();
+ flare_ab_usb_download();
+ }
+
+ /*
@@ -771,8 +808,7 @@ index 000000000..903f5b66f
+ * USB plug, logo_recovery.bmp), where a host can reflash the unit.
+ */
+ printf("FLARE-AB: reset did not take, entering USB download\n");
+ run_command("download", 0);
+ hang();
+ flare_ab_usb_download();
+}
+
+void flare_ab_update_root_partition(void)
@@ -872,7 +908,7 @@ index 182c03771..ad73662eb 100644
return -1;
diff --git a/sysdrv/source/uboot/u-boot/include/flare_ab.h b/sysdrv/source/uboot/u-boot/include/flare_ab.h
new file mode 100644
index 000000000..d009525e0
index 000000000..6e51b405e
--- /dev/null
+++ b/sysdrv/source/uboot/u-boot/include/flare_ab.h
@@ -0,0 +1,73 @@