diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2023-06-23 17:05:48 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-07-17 15:39:55 -0400 |
commit | 22cdb3f0f174e926071975cdc5157aa6526b67a7 (patch) | |
tree | 4fb76cd71e0b1c8aaddcac6b4715e5610005ba40 /boot | |
parent | 4837a1dba6f17f21bbb5f32d6e41707ef76b65f8 (diff) | |
download | u-boot-22cdb3f0f174e926071975cdc5157aa6526b67a7.tar.gz u-boot-22cdb3f0f174e926071975cdc5157aa6526b67a7.tar.bz2 u-boot-22cdb3f0f174e926071975cdc5157aa6526b67a7.zip |
android_ab: Add option to skip decrementing tries
It is is sometimes desired to be able to skip decrementing the number of
tries remaining in an Android A/B boot, and instead just check which
slot will be tried later. This can commonly be be the case for platforms
that want to A/B u-boot itself, but are required to boot from a FAT MBR
partition. In these cases, u-boot must do an early check that the MBR
points to the correct A/B boot partition, and if not rewrite the MBR to
point to the correct one and reboot. Decrementing the try count in this
case is not desired because it means that each u-boot might constantly
ping-pong overwriting the MBR and rebooting until all the retries are
used up.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/android_ab.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/boot/android_ab.c b/boot/android_ab.c index 2d7b392666..60ae002978 100644 --- a/boot/android_ab.c +++ b/boot/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 dec_tries) { struct bootloader_control *abc = NULL; u32 crc32_le; @@ -272,8 +273,10 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info) log_err("ANDROID: Attempting slot %c, tries remaining %d\n", BOOT_SLOT_NAME(slot), abc->slot_info[slot].tries_remaining); - abc->slot_info[slot].tries_remaining--; - store_needed = true; + if (dec_tries) { + abc->slot_info[slot].tries_remaining--; + store_needed = true; + } } if (slot >= 0) { |