android_ab: fix slot selection
PATCH 1/1 android_ab: fix slot selection
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have tries_remaining == 0 and successful_boot == 1 will be disregarded when picking the slot to attempt.
Update the selection logic so slots marked successful remain eligible even when their tries counter is zero. Also include the successful_boot state in the unbootable-slot debug output.
---
An alternative would be to keep the existing behavior and update the comment in boot/android_ab.c:276 to remove the successful_boot condition. I do prefer updating the logic to match the documented rules. Currently, the userspace AB code will need to increment the tries counter for a slot that has booted successfully but has no tries left.
boot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
boot/android_ab.c +5 -2
@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ",
--
2.53.0
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
Hi Colin,
Thank you for the patch.
Sorry for the late review. For some reason I have not been cc'ed so I missed this.
Please use ./scripts/get_maintainer.pl -f boot/android_ab.c next time you send a patch.
See: https://docs.u-boot.org/en/latest/CONTRIBUTE.html#contributions
Quoted 5 lines · Colin Pinnell McAllister
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have
tries_remaining== 0 andsuccessful_boot== 1 will be disregarded when picking the slot to attempt.
Can you please give me more references to the boot selection rules? Is this just the code comment that's mentioned (boot/android_ab.c:276) ?
I've checked:
* https://source.android.com/docs/core/ota/ab
* https://source.android.com/docs/core/ota/ab/ab_implement
and it's unclear to me from that.
Then, I've looked a bit at the default bootcontrol AIDL hal at:
https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/boot/aidl/default/Android.bp
It seems to be using libboot_control as a static library. libboot_control tells us that a slot is considered unbootable when:tries_remaining != 0;
Quoted 4 lines
Update the selection logic so slots marked successful remain eligible even when their tries counter is zero. Also include the
successful_bootstate in the unbootable-slot debug output.
What happens if the tries counter is zero and we attempt to boot with dec_tries=true? In that case, we will decrement tries_remaining which is an uint8_t (see: android_bootloader_message.h).
Quoted 45 lines
Signed-off-by Colin Pinnell McAllister <[email protected]>---
An alternative would be to keep the existing behavior and update the comment in
boot/android_ab.c:276to remove thesuccessful_bootcondition. I do prefer updating the logic to match the documented rules. Currently, the userspace AB code will need to increment the tries counter for a slot that has booted successfully but has no tries left.boot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)boot/android_ab.c +5
-3@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ", --2.53.0
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
Hi Mattijs,
Thank you for the response! This wasn't a critical change, so no worries about the delay.
Outlook is kind of terrible for replying inline...I should have used my gmail account for this patch. My responses to you message are below.
Quoted 1 line
Please use
./scripts/get_maintainer.pl-fboot/android_ab.cnext time you send a patch.
ack
Quoted 2 lines
Can you please give me more references to the boot selection rules? Is this just the code comment that's mentioned (
boot/android_ab.c:276) ?
Yes, that is correct. I do not have any other references to cite.
Quoted 3 lines
It seems to be using
libboot_controlas a static library.libboot_controltells us that a slot is considered unbootable when:tries_remaining!= 0;
I also see that tries_remaining is set to 1 on successful boot:
https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/boot/1.1/default/boot_control/libboot_control.cpp;l=260?q=libboot_control
This is what we also currently do when marking a boot as successful. However, it is unclear if this is a requirement in the spec and what the behavior in u-boot should be if successful_boot == 1 and tries_remaining == 0.
Quoted 3 lines
What happens if the tries counter is zero and we attempt to boot with dec_tries=true? In that case, we will decrement
tries_remainingwhich is anuint8_t(see:android_bootloader_message.h).
As I read the code, dec_tries only decrements tries_remaining if successful_boot == 0. So in the case where dec_tries == true, tries_remaining == 0, and successful_boot == 1, the decrement would be skipped, which aligns with the behavior for a case where tries_remaining > 0.
I'm not too picky with a solution here. A valid alternative solution would be to simply update the comment at android_ab.c:276. I do think I prefer aligning the code to match the comment as it makes more sense to be able to boot a slot when successful_boot == 1, regardless of tries_remaining. However, if that goes against the spec, simply fixing the comment makes more sense.
Please let me know what you think and what solution is preferred.
Best,
Colin
________________________________________
From: Mattijs Korpershoek <[email protected]>
Sent: Thursday, April 9, 2026 05:21
To: Pinnell McAllister, Colin <[email protected]>; [email protected] <[email protected]>
Cc: Pinnell McAllister, Colin <[email protected]>
Subject: Re: [PATCH] android_ab: fix slot selection
Hi Colin,
Thank you for the patch.
Sorry for the late review. For some reason I have not been cc'ed so I missed this.
Please use ./scripts/get_maintainer.pl -f boot/android_ab.c next time
you send a patch.
See: https://urldefense.com/v3/__https://docs.u-boot.org/en/latest/CONTRIBUTE.html*contributions__;Iw!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclGX-d_1n$
Quoted 5 lines · Colin Pinnell McAllister
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have
tries_remaining== 0 andsuccessful_boot== 1 will be disregarded when picking the slot to attempt.
Can you please give me more references to the boot selection rules? Is this just the code comment that's mentioned (boot/android_ab.c:276) ?
I've checked:
* https://urldefense.com/v3/__https://source.android.com/docs/core/ota/ab__;!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclOK45V17$
* https://urldefense.com/v3/__https://source.android.com/docs/core/ota/ab/ab_implement__;!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclDWZu3M8$
and it's unclear to me from that.
Then, I've looked a bit at the default bootcontrol AIDL hal at:
https://urldefense.com/v3/__https://android.googlesource.com/platform/hardware/interfaces/*/refs/heads/main/boot/aidl/default/Android.bp__;Kw!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclARJQAuu$
It seems to be using libboot_control as a static library. libboot_control tells us that a slot is considered unbootable when:tries_remaining != 0;
Quoted 4 lines
Update the selection logic so slots marked successful remain eligible even when their tries counter is zero. Also include the
successful_bootstate in the unbootable-slot debug output.
What happens if the tries counter is zero and we attempt to boot with dec_tries=true? In that case, we will decrement tries_remaining which is an uint8_t (see: android_bootloader_message.h).
Quoted 38 lines
Signed-off-by Colin Pinnell McAllister <[email protected]>---
An alternative would be to keep the existing behavior and update the comment in
boot/android_ab.c:276to remove thesuccessful_bootcondition. I do prefer updating the logic to match the documented rules. Currently, the userspace AB code will need to increment the tries counter for a slot that has booted successfully but has no tries left.boot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)boot/android_ab.c +5
-3@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ", --2.53.0
Quoted 7 lines
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
Hi Colin,
Quoted 5 lines · Colin
Hi Mattijs,
Thank you for the response! This wasn't a critical change, so no worries about the delay.
Outlook is kind of terrible for replying inline...I should have used my gmail account for this patch. My responses to you message are below.
I agree that Outlook is not very good here.
I can't seem to be able to apply the patch:
$ b4 shazam -s -l --check [email protected] Looking up [email protected] Checking for newer revisions Grabbing search results from lore.kernel.org Analyzing 3 messages in the thread Looking for additional code-review trailers on lore.kernel.org Analyzing 0 code-review messages Checking attestation on all messages, may take a moment... Retrieving patchwork CI status, may take a moment... --- ✓ [PATCH] android_ab: fix slot selection + Link: https://patch.msgid.link/[email protected] + Signed-off-by: Mattijs Korpershoek <[email protected]> ● checkpatch.pl: 196: ERROR: code indent should use tabs where possible ● checkpatch.pl: 196: WARNING: please, no spaces at the start of a line ● checkpatch.pl: 197: ERROR: code indent should use tabs where possible ● checkpatch.pl: 197: WARNING: please, no spaces at the start of a line ● checkpatch.pl: 201: ERROR: code indent should use tabs where possible ● checkpatch.pl: 201: WARNING: please, no spaces at the start of a line ● checkpatch.pl: 203: ERROR: code indent should use tabs where possible ● checkpatch.pl: 203: WARNING: please, no spaces at the start of a line ● checkpatch.pl: 204: ERROR: code indent should use tabs where possible ● checkpatch.pl: 204: WARNING: please, no spaces at the start of a line --- ✓ Signed: DKIM/garmin.com --- Total patches: 1
Can you resend it?
More information below.
Quoted 23 lines
Quoted 2 lines
Please use
./scripts/get_maintainer.pl-fboot/android_ab.cnext time you send a patch.ack
Quoted 2 lines
Can you please give me more references to the boot selection rules? Is this just the code comment that's mentioned (
boot/android_ab.c:276) ?Yes, that is correct. I do not have any other references to cite.
Quoted 3 lines
It seems to be using
libboot_controlas a static library.libboot_controltells us that a slot is considered unbootable when:tries_remaining!= 0;I also see that
tries_remainingis set to 1 on successful boot:
https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/boot/1.1/default/boot_control/libboot_control.cpp;l=260?q=libboot_controlThis is what we also currently do when marking a boot as successful. However, it is unclear if this is a requirement in the spec and what the behavior in u-boot should be if
successful_boot== 1 andtries_remaining== 0.Quoted 3 lines
What happens if the tries counter is zero and we attempt to boot with dec_tries=true? In that case, we will decrement
tries_remainingwhich is anuint8_t(see:android_bootloader_message.h).
Quoted 5 lines
As I read the code,
dec_triesonly decrementstries_remainingifsuccessful_boot== 0. So in the case wheredec_tries== true,tries_remaining== 0, andsuccessful_boot== 1, the decrement would be skipped, which aligns with the behavior for a case wheretries_remaining> 0.I'm not too picky with a solution here. A valid alternative solution would be to simply update the comment at android_ab.c:276. I do think I prefer aligning the code to match the comment as it makes more sense to be able to boot a slot when
successful_boot== 1, regardless oftries_remaining. However, if that goes against the spec, simply fixing the comment makes more sense.Please let me know what you think and what solution is preferred.
I've looked at another implementation of A/B slot booting in Qualcomm's bootloader (EDK2):
We can see in FindBootableSlot() that it's possible to boot a slot with successful_boot == 1 and tries_remaining == 0
Therefore, I believe your patch is correct.
Again, sorry for the long delays. I'll do my best to be a bit more response once you have resend this patch in an applicable format (with proper whitespacing and such)
Consider tooling such as b4 to help you with sending:
https://b4.docs.kernel.org/en/latest/contributor/overview.html
https://people.kernel.org/monsieuricon/sending-a-kernel-patch-with-b4-part-1
Thanks!
Mattijs
Quoted 105 lines
Best,
Colin________________________________________
From: Mattijs Korpershoek <[email protected]>
Sent: Thursday, April 9, 2026 05:21
To: Pinnell McAllister, Colin <[email protected]>; [email protected] <[email protected]>
Cc: Pinnell McAllister, Colin <[email protected]>
Subject: Re: [PATCH]android_ab: fix slot selectionHi Colin,
Thank you for the patch.
Sorry for the late review. For some reason I have not been cc'ed so I missed this.Please use
./scripts/get_maintainer.pl-fboot/android_ab.cnext time
you send a patch.
See: https://urldefense.com/v3/__https://docs.u-boot.org/en/latest/CONTRIBUTE.html*contributions__;Iw!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclGX-d_1n$Quoted 5 lines · Colin Pinnell McAllister
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have
tries_remaining== 0 andsuccessful_boot== 1 will be disregarded when picking the slot to attempt.Can you please give me more references to the boot selection rules? Is this just the code comment that's mentioned (
boot/android_ab.c:276) ?I've checked:
* https://urldefense.com/v3/__https://source.android.com/docs/core/ota/ab__;!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclOK45V17$
* https://urldefense.com/v3/__https://source.android.com/docs/core/ota/ab/ab_implement__;!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclDWZu3M8$
and it's unclear to me from that.Then, I've looked a bit at the default bootcontrol AIDL hal at:
https://urldefense.com/v3/__https://android.googlesource.com/platform/hardware/interfaces/*/refs/heads/main/boot/aidl/default/Android.bp__;Kw!!EJc4YC3iFmQ!Tlm_0_94q_aNcwZ072h7OjCsbyXAaN6bx5DgRMsDkFUXhf8ofhAJ1slRLYnu1EpkNnuaZHqRBDVgEpNOTGCclARJQAuu$It seems to be using
libboot_controlas a static library.libboot_controltells us that a slot is considered unbootable when:tries_remaining!= 0;Quoted 4 lines
Update the selection logic so slots marked successful remain eligible even when their tries counter is zero. Also include the
successful_bootstate in the unbootable-slot debug output.What happens if the tries counter is zero and we attempt to boot with dec_tries=true? In that case, we will decrement
tries_remainingwhich is anuint8_t(see:android_bootloader_message.h).Quoted 38 lines
Signed-off-by Colin Pinnell McAllister <[email protected]>---
An alternative would be to keep the existing behavior and update the comment in
boot/android_ab.c:276to remove thesuccessful_bootcondition. I do prefer updating the logic to match the documented rules. Currently, the userspace AB code will need to increment the tries counter for a slot that has booted successfully but has no tries left.boot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)boot/android_ab.c +5
-3@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ", --2.53.0
Quoted 7 lines
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
________________________________
CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be Garmin confidential and/or Garmin legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
PATCH v2 1/1 android_ab: fix slot selection
In reply to Colin Pinnell McAllisterThe boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have tries_remaining == 0 and successful_boot == 1 will be disregarded when picking the slot to attempt.
Updates the selection logic so slots marked successful remain eligible even when their tries counter is zero. Debug message now also includes the successful_boot value.
---
Changes in v2:
* No changes, just sending the patch from a gmail address
boot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
boot/android_ab.c +5 -2
@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ",
Signature · 1 line
2.34.1
Quoted 11 lines · Colin Pinnell McAllister
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have
tries_remaining== 0 andsuccessful_boot== 1 will be disregarded when picking the slot to attempt.Updates the selection logic so slots marked successful remain eligible even when their tries counter is zero. Debug message now also includes the
successful_bootvalue.Signed-off-by Colin Pinnell McAllister <[email protected]>
Quoted 30 lines
---
Changes in v2:
* No changes, just sending the patch from a gmail addressboot/android_ab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)boot/android_ab.c +5
-2@@ -289,11 +289,14 @@ int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info, slot =-1 ;for (i =0 ; i < abc->nb_slot; ++i) {if (abc->slot_info[i].verity_corrupted || - !abc->slot_info[i].tries_remaining) { + (!abc->slot_info[i].tries_remaining && + !abc->slot_info[i].successful_boot)) {log_debug ("ANDROID: unbootable slot %d tries: %d, " , i, abc->slot_info[i].tries_remaining); -log_debug ("corrupt: %d\n" , +log_debug ("corrupt: %d, " , abc->slot_info[i].verity_corrupted); +log_debug ("successful: %d\n" , + abc->slot_info[i].successful_boot);continue ; } log_debug("ANDROID: bootable slot %d pri: %d, tries: %d, ",Signature · 1 line
2.34.1
Hi,
Quoted 11 lines · Colin Pinnell McAllister
The boot selection rules state that a slot is bootable if it is not corrupted and either has tries remaining or has already booted successfully. However, slots that have
tries_remaining== 0 andsuccessful_boot== 1 will be disregarded when picking the slot to attempt.Updates the selection logic so slots marked successful remain eligible even when their tries counter is zero. Debug message now also includes the
successful_bootvalue.[...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] android_ab: fix slot selection
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/e41e97e6e6061fec5a2fb069eaad662cf6359a93
--
Mattijs