[PATCH v2 1/2] bootstd: android: Add missing NULL in the avb partition list

Julien Masson jmasson at baylibre.com
Thu Jan 23 14:39:10 CET 2025


On Thu 23 Jan 2025 at 14:38, Mattijs Korpershoek <mkorpershoek at baylibre.com> wrote:

> When booting an Android build with AVB enabled, it's still possible to
> deactivate the check for development purposes if the bootloader state is
> UNLOCKED.
> 
> This is very useful for development and can be done at flashing time via:
> $ fastboot flash --disable-verity --disable-verification vbmeta vbmeta.img
> 
> However, with bootmeth_android, we cannot boot this way:
> 
>     Scanning bootdev 'mmc at fa10000.bootdev':
>       0  android      ready   mmc          0  mmc at fa10000.bootdev.whole
>     ** Booting bootflow 'mmc at fa10000.bootdev.whole' with android
>     avb_vbmeta_image.c:188: ERROR: Hash does not match!
>     avb_slot_verify.c:732: ERROR: vbmeta_a: Error verifying vbmeta image: HASH_MISMATCH
>     get_partition: can't find partition '_a'
>     avb_slot_verify.c:496: ERROR: _a: Error determining partition size.
>     Verification failed, reason: I/O error occurred while trying to load data
>     Boot failed (err=-5)
>     No more bootdevs
> 
> From the logs we can see that avb tries to read a partition named '_a'.
> It's doing so because the last element of requested_partitions implicitly is
> '\0', but the doc explicitly request it to be NULL instead.
> 
> Add NULL as last element to requested_partitions to avoid this problem.
> 
> Fixes: 125d9f3306ea ("bootstd: Add a bootmeth for Android")
> Signed-off-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>
> ---
>  boot/bootmeth_android.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 19b1f2c377b9a51ff1683259085e1d636c939413..2cd167f80280801618a317a65e93a10e70a0d9ee 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -380,7 +380,7 @@ static int run_avb_verification(struct bootflow *bflow)
>  {
>  	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
>  	struct android_priv *priv = bflow->bootmeth_priv;
> -	const char * const requested_partitions[] = {"boot", "vendor_boot"};
> +	const char * const requested_partitions[] = {"boot", "vendor_boot", NULL};
>  	struct AvbOps *avb_ops;
>  	AvbSlotVerifyResult result;
>  	AvbSlotVerifyData *out_data;
> 
> -- 
> 2.47.1
> 

Reviewed-by: Julien Masson <jmasson at baylibre.com>


More information about the U-Boot mailing list