ANDROID: Do not attempt to round-robin bootable slots.

This feature does not quite fit within the A/B flow.

The intent of A/B is to provide an automatic rollback option for broken
OTAs. Once an OTA has been applied, the slot may not boot for a number
of reasons (power loss, broken package, etc), and it is important to
make consistent attempts to boot to the new slot rather than find *a*
bootable slot (otherwise, the update may not take).

Note that once a slot has been marked bootable, encryption keys are
upgraded, and old slots will not work. Trying to rotate between slots
is not likely to succeed.

Note that Android ensures that the active slot always has the
highest priority. In the current u-boot implementation, this affords no
possibility of rollback.

To match the expected A/B flow, this patch makes the following changes:
 - When initializing the BCB, set the "_a" slot to have the highest
   priority.
 - Pick the highest priority slot that has been marked successful OR has
   boot tries remaining.
 - If no such slot exists, the system is not bootable.

Bug: 141272741
Test: cuttlefish boots
Change-Id: I72ef74c947fd7b39af2e27d4cfce346f83ddee34

Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1133069/2
Bug: https://baylibre.atlassian.net/browse/RITA-97
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
1 file changed