U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Colin Pinnell McAllister <colinmca242@gmail.com>, u-boot@lists.denx.de
Cc: Colin Pinnell McAllister <colinmca242@gmail.com>
Subject: Re: [PATCH v2] android_ab: fix slot selection
Date: Mon, 08 Jun 2026 11:17:43 +0200	[thread overview]
Message-ID: <87cxy1xufc.fsf@kernel.org> (raw)
In-Reply-To: <20260525003158.11319-1-colinmca242@gmail.com>

On Mon, May 25, 2026 at 00:31, Colin Pinnell McAllister <colinmca242@gmail.com> wrote:

> 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.
>
> 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.
>
> Signed-off-by: Colin Pinnell McAllister <colinmca242@gmail.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

> ---
> 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(-)
>
> diff --git a/boot/android_ab.c b/boot/android_ab.c
> index 13e82dbcb7f..f2b1110aa24 100644
> --- a/boot/android_ab.c
> +++ b/boot/android_ab.c
> @@ -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.34.1

  reply	other threads:[~2026-06-08  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 20:14 [PATCH] android_ab: fix slot selection Colin Pinnell McAllister
2026-04-09 10:21 ` Mattijs Korpershoek
2026-04-09 15:34   ` Pinnell McAllister, Colin
2026-05-13 12:09     ` Mattijs Korpershoek
2026-05-25  0:31 ` [PATCH v2] " Colin Pinnell McAllister
2026-06-08  9:17   ` Mattijs Korpershoek [this message]
2026-06-15  7:15   ` Mattijs Korpershoek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cxy1xufc.fsf@kernel.org \
    --to=mkorpershoek@kernel.org \
    --cc=colinmca242@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox