[PATCH v2] Fix flashing of eMMC user area with Fastboot

Oleh Kravchenko oleg at kaa.org.ua
Thu May 13 16:32:36 CEST 2021


Hello guys,
Could you please review this patch?

> 13 трав. 2021 р. о 17:23 Oleh Kravchenko <oleg at kaa.org.ua> пише:
> 
> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
> but it is wrong.
> 
> Signed-off-by: Oleh Kravchenko <oleg at kaa.org.ua>
> Cc: Pantelis Antoniou <panto at antoniou-consulting.com>
> Cc: Marek Vasut <marex at denx.de>
> ---
> 
> drivers/fastboot/fb_mmc.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
> index 8e74e50e91..a590c23a79 100644
> --- a/drivers/fastboot/fb_mmc.c
> +++ b/drivers/fastboot/fb_mmc.c
> @@ -532,12 +532,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
> #endif
> 
> #if CONFIG_IS_ENABLED(EFI_PARTITION)
> -#ifndef CONFIG_FASTBOOT_MMC_USER_SUPPORT
>    if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0) {
> -#else
> -    if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME) == 0 ||
> -        strcmp(cmd, CONFIG_FASTBOOT_MMC_USER_NAME) == 0) {
> -#endif
>        dev_desc = fastboot_mmc_get_dev(response);
>        if (!dev_desc)
>            return;
> @@ -599,9 +594,25 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>    }
> #endif
> 
> +    if (IS_ENABLED(CONFIG_FASTBOOT_MMC_USER_SUPPORT) &&
> +        strcmp(cmd, CONFIG_FASTBOOT_MMC_USER_NAME) == 0) {
> +        dev_desc = fastboot_mmc_get_dev(response);
> +        if (!dev_desc)
> +            return;
> +
> +        memset(&info, 0, sizeof(info));
> +        info.start    = 0;
> +        info.size    = dev_desc->lba;
> +        info.blksz    = dev_desc->blksz;
> +        strlcpy((char *)&info.name, cmd, sizeof(info.name));
> +
> +        goto flash_image;
> +    }
> +
>    if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>        return;
> 
> +flash_image:
>    if (is_sparse_image(download_buffer)) {
>        struct fb_mmc_sparse sparse_priv;
>        struct sparse_storage sparse;
> -- 
> 2.26.3
> 



More information about the U-Boot mailing list