[U-Boot] [PATCH] cmd: avb: Fix requested partitions list

Igor Opaniuk igor.opaniuk at gmail.com
Mon Aug 12 11:13:55 UTC 2019


Hi Sam,

On Fri, Aug 9, 2019 at 7:16 PM Sam Protsenko <semen.protsenko at linaro.org> wrote:
>
> The requested_partitions[] array should contain only boot partitions.
> Usually it's only 'boot' partition, as can be seen in [1]. Also, seems
> like the requested_partitions[] are only used when there is no 'vbmeta'
> partition [2], which is not a regular use-case.
>
> Make requested_partitions[] contain only 'boot' partition as it was
> supposed to be, and also make that array to be a local in
> do_avb_verify_part() function, as nobody else needs that.
>
> [1] https://android.googlesource.com/platform/external/avb/+/master/test/avb_slot_verify_unittest.cc#108
> [2] https://android.googlesource.com/platform/external/avb/+/master/libavb/avb_slot_verify.c#1461
>
> Signed-off-by: Sam Protsenko <semen.protsenko at linaro.org>
> ---
>  cmd/avb.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/cmd/avb.c b/cmd/avb.c
> index d1942d6605..8f2bb85fce 100644
> --- a/cmd/avb.c
> +++ b/cmd/avb.c
> @@ -14,11 +14,6 @@
>  #define AVB_BOOTARGS   "avb_bootargs"
>  static struct AvbOps *avb_ops;
>
> -static const char * const requested_partitions[] = {"boot",
> -                                            "system",
> -                                            "vendor",
> -                                            NULL};
> -
>  int do_avb_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  {
>         unsigned long mmc_dev;
> @@ -231,6 +226,7 @@ int do_avb_get_uuid(cmd_tbl_t *cmdtp, int flag,
>  int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
>                        int argc, char *const argv[])
>  {
> +       const char * const requested_partitions[] = {"boot", NULL};
>         AvbSlotVerifyResult slot_result;
>         AvbSlotVerifyData *out_data;
>         char *cmdline;
> --
> 2.20.1
>
Thanks for the patch.

Current snapshot of libavb in U-boot is a bit out-dated (~2 years) and
before introducing patches that can leverage new features from the mainline
libavb(taking into account that you're referring to Jul 30, 2019 patch
36d41d9223 ("Add AVB_SLOT_VERIFY_FLAGS_NO_VBMETA_PARTITION flag"))
it makes sense to update libavb in U-boot first:

The best approach I see here (just to summarize what we've already discussed):
1. Update libavb to the latest stable version
2. Check if `avb verify` still behaves as expected on non-AB setups.
3. Introduce support of AB slots and different fixes like this one

Thanks

-- 
Best regards - Freundliche GrĂ¼sse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk


More information about the U-Boot mailing list