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

Oleh Kravchenko oleg at kaa.org.ua
Tue May 18 15:24:49 CEST 2021


Hello Tom,

18.05.21 15:21, Tom Rini пише:
> On Tue, May 18, 2021 at 01:41:06PM +0300, Oleh Kravchenko wrote:
>
>> Any updates on these?
> Sorry, my reading of what you and Sean were saying left me with the
> impression no code changes were needed in the end, is that not the case?

Sean has proposed to flash and erase by mapping through 0.0:0 (user),
0.1:0 (boot0), 0.2:0 (boot1).
This works.

But as I understand, we also can flash and erase eMMC hardware
partitions by configuration defined labels:
- CONFIG_FASTBOOT_MMC_BOOT1_NAME
- CONFIG_FASTBOOT_MMC_BOOT2_NAME
- CONFIG_FASTBOOT_MMC_USER_NAME
Currently, this feature is broken, and these patches fix that.

>> 15.05.21 00:26, Oleh Kravchenko пише:
>>> Hello guys,
>>> Could you please review and merge this patch?
>>>
>>> PR successfully passed CI:
>>> https://github.com/u-boot/u-boot/pull/75
>>>
>>> 15.05.21 00:15, Oleh Kravchenko пише:
>>>> '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>
>>>> ---
>>>> Changes for v2:
>>>>    - code cleanup;
>>>> Changes for v3:
>>>>    - QA passed at https://github.com/u-boot/u-boot/pull/75;
>>>>
>>>>  drivers/fastboot/fb_mmc.c | 25 ++++++++++++++++++++-----
>>>>  1 file changed, 20 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
>>>> index 2f3837e559..647d3f6c1b 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,29 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>>  	}
>>>>  #endif
>>>>  
>>>> +#if CONFIG_IS_ENABLED(FASTBOOT_MMC_USER_SUPPORT)
>>>> +	if (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 write_image;
>>>> +	}
>>>> +#endif
>>>> +
>>>>  	if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>>  		return;
>>>>  
>>>> +#if CONFIG_IS_ENABLED(FASTBOOT_MMC_USER_SUPPORT)
>>>> +write_image:
>>>> +#endif
>>>> +
>>>>  	if (is_sparse_image(download_buffer)) {
>>>>  		struct fb_mmc_sparse sparse_priv;
>>>>  		struct sparse_storage sparse;
>>>>


More information about the U-Boot mailing list