summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2022-05-12 11:32:52 -0500
committerAnand Gadiyar <gadiyar@ti.com>2022-05-12 11:49:16 -0500
commitb7ab6e41f8ec83d58ec74ef7e9c22e42e86ab1a7 (patch)
tree7d16ca24ba29e6588c9cef16ce4deaa1f7199d96 /common
parent71d043d5a82668343e4f210f78a63c85602bc44b (diff)
cmd: ab_select: Don't count boot-to-recovery as a boot attempt.
The slot rollback system is intended for normal boot failures after an OTA, and therefore, we should not attempt to change slots based on a failure to boot to recovery (or any other non-normal boot sequence). Signed-off-by: Ram Muthiah <rammuthiah@google.com> Link: https://android-review.googlesource.com/c/platform/external/u-boot/+/1446441 Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Diffstat (limited to 'common')
-rw-r--r--common/android_ab.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/android_ab.c b/common/android_ab.c
index 4943f26d53..80aedfbef8 100644
--- a/common/android_ab.c
+++ b/common/android_ab.c
@@ -181,7 +181,8 @@ static int ab_compare_slots(const struct slot_metadata *a,
return 0;
}
-int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info)
+int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info,
+ bool normal_boot)
{
struct bootloader_control *abc = NULL;
u32 crc32_le;
@@ -268,7 +269,11 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info)
}
}
- if (slot >= 0 && !abc->slot_info[slot].successful_boot) {
+ /* Note that we only count the boot attempt as a valid try when performing
+ * normal boots to Android. Booting to recovery or fastboot does not count
+ * as a normal boot.
+ */
+ if (slot >= 0 && !abc->slot_info[slot].successful_boot && normal_boot) {
log_err("ANDROID: Attempting slot %c, tries remaining %d\n",
BOOT_SLOT_NAME(slot),
abc->slot_info[slot].tries_remaining);