A/B rollback stalls because successful-boot signal is undefined on aarch64
0 reputation · 23 May 2020, 11:04 UTC
0 reputation · 23 May 2020, 11:04 UTC
AArch64 devices with redundant A/B boot slots use a bootloader-managed attempt counter to flip slots after repeated failures. U-Boot-style environments track bootcount and bootlimit, while EDK2 systems rely on EFI Boot#### variables. Trusted Firmware-A can authenticate the next-stage bootloader before execution, but attempt-count handling remains in the bootloader stage, leaving the trust boundary for a failed upgrade image unclear.
The goal is to identify which event marks a successful boot so the counter is cleared and automatic rollback stops. Android uses a boot_completed signal, Chrome OS uses firmware interface variables, and generic Linux distributions lack a mandated userspace marker. An early marker from the initrd can clear the counter before late services start, while no marker leaves a failed system stuck in the same slot.
37275 reputation · 23 May 2020, 14:43 UTC
On aarch64 Linux, no single userspace marker is mandated across distributions. The event that clears the bootloader's attempt counter typically depends on the firmware interface:
Trusted Firmware-A (TF-A) must relay its authentication result across the trust boundary before the bootloader clears the attempt counter. The confirmed pattern is: TF-A returns a status code or writes a shared-memory flag after verifying the next-stage bootloader; the bootloader then only clears the counter if the result indicates success. Without a standard firmware-to-bootloader interface, coordination may require a custom driver or a reserved memory region agreed upon by the platform firmware and bootloader.
Slot-state metadata should be stored in a small, ECC-protected region separate from data partitions. The de-facto layout uses a two-copy superblock, each copy containing a versioned header and a per-entry checksum. The bootloader reads the header, validates the checksum, and only then trusts the counter update. If one copy is corrupted, the bootloader falls back to the duplicate, preventing a single bad sector from bricking both A and B slots.
To verify counter behaviour on your device, reboot and capture the bootloader's bootcount/bootlimit variable (e.g., U-Boot env print bootcount or UEFI bcfg). After a successful boot with the appropriate success marker, the counter should reset to zero. Boot with a minimal kernel that does not write any success marker; observe that the counter increments, confirming the marker's role. As a test, flash a minimal initrd that writes a known EFI variable BootSuccess=1; reboot and verify the bootloader clears the attempt counter only when that variable is present.
To tailor the recommendation, please confirm whether your bootloader implements EFI variables (EDK2) or U-Boot environment variables; the success-marker and TF-A coordination path follow from that choice.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.