All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] Fix flashing of eMMC user area with Fastboot
@ 2021-05-19 10:31 Oleh Kravchenko
  2021-05-19 11:13 ` Oleh Kravchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Oleh Kravchenko @ 2021-05-19 10:31 UTC (permalink / raw)
  To: u-boot

'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
but it is wrong.

Fill disk_partition structure with eMMC user partition info
to properly flash data.

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Sean Anderson <sean.anderson@seco.com>
Cc: Tom Rini <trini@konsulko.com>
---


Changes for v2:
   - code cleanup;
Changes for v3:
   - QA passed at https://github.com/u-boot/u-boot/pull/75;
Changes for v4:
   - fixed ugly code;
   - QA passed at https://github.com/u-boot/u-boot/pull/75.

 drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 2f3837e559..a009863e89 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
 			      u32 download_bytes, char *response)
 {
 	struct blk_desc *dev_desc;
-	struct disk_partition info;
+	struct disk_partition info = {0};
 
 #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
 	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
@@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
 	}
 #endif
 
-	if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
+#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;
+
+		strlcpy((char *)&info.name, cmd, sizeof(info.name));
+		info.size	= dev_desc->lba;
+		info.blksz	= dev_desc->blksz;
+	}
+#endif
+
+	if (!info.name[0] &&
+	    fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
 		return;
 
 	if (is_sparse_image(download_buffer)) {
-- 
2.26.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-19 10:31 [PATCH v4] Fix flashing of eMMC user area with Fastboot Oleh Kravchenko
@ 2021-05-19 11:13 ` Oleh Kravchenko
  2021-05-20 14:32 ` Sean Anderson
  2021-08-22 20:54 ` Tom Rini
  2 siblings, 0 replies; 8+ messages in thread
From: Oleh Kravchenko @ 2021-05-19 11:13 UTC (permalink / raw)
  To: u-boot

Hello Sean,
Could you please take a look?

I've updated the patch.

19.05.21 13:31, Oleh Kravchenko ????:
> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
> but it is wrong.
>
> Fill disk_partition structure with eMMC user partition info
> to properly flash data.
>
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>
>
> Changes for v2:
>    - code cleanup;
> Changes for v3:
>    - QA passed at https://github.com/u-boot/u-boot/pull/75;
> Changes for v4:
>    - fixed ugly code;
>    - QA passed at https://github.com/u-boot/u-boot/pull/75.
>
>  drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
> index 2f3837e559..a009863e89 100644
> --- a/drivers/fastboot/fb_mmc.c
> +++ b/drivers/fastboot/fb_mmc.c
> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>  			      u32 download_bytes, char *response)
>  {
>  	struct blk_desc *dev_desc;
> -	struct disk_partition info;
> +	struct disk_partition info = {0};
>  
>  #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>  	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>  	}
>  #endif
>  
> -	if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
> +#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;
> +
> +		strlcpy((char *)&info.name, cmd, sizeof(info.name));
> +		info.size	= dev_desc->lba;
> +		info.blksz	= dev_desc->blksz;
> +	}
> +#endif
> +
> +	if (!info.name[0] &&
> +	    fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>  		return;
>  
>  	if (is_sparse_image(download_buffer)) {

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-19 10:31 [PATCH v4] Fix flashing of eMMC user area with Fastboot Oleh Kravchenko
  2021-05-19 11:13 ` Oleh Kravchenko
@ 2021-05-20 14:32 ` Sean Anderson
  2021-05-20 14:44   ` Oleh Kravchenko
  2021-08-22 20:54 ` Tom Rini
  2 siblings, 1 reply; 8+ messages in thread
From: Sean Anderson @ 2021-05-20 14:32 UTC (permalink / raw)
  To: u-boot



On 5/19/21 6:31 AM, Oleh Kravchenko wrote:
> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
> but it is wrong.
> 
> Fill disk_partition structure with eMMC user partition info
> to properly flash data.
> 
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> 
> 
> Changes for v2:
>     - code cleanup;
> Changes for v3:
>     - QA passed at https://github.com/u-boot/u-boot/pull/75;
> Changes for v4:
>     - fixed ugly code;
>     - QA passed at https://github.com/u-boot/u-boot/pull/75.
> 
>   drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>   1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
> index 2f3837e559..a009863e89 100644
> --- a/drivers/fastboot/fb_mmc.c
> +++ b/drivers/fastboot/fb_mmc.c
> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>   			      u32 download_bytes, char *response)
>   {
>   	struct blk_desc *dev_desc;
> -	struct disk_partition info;
> +	struct disk_partition info = {0};
>   
>   #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>   	if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>   	}
>   #endif
>   
> -	if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
> +#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;
> +
> +		strlcpy((char *)&info.name, cmd, sizeof(info.name));
> +		info.size	= dev_desc->lba;
> +		info.blksz	= dev_desc->blksz;
> +	}
> +#endif
> +
> +	if (!info.name[0] &&
> +	    fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>   		return;
>   
>   	if (is_sparse_image(download_buffer)) {
> 

Reviewed-by: Sean Anderson <sean.anderson@seco.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-20 14:32 ` Sean Anderson
@ 2021-05-20 14:44   ` Oleh Kravchenko
  2021-05-20 15:00     ` Sean Anderson
  0 siblings, 1 reply; 8+ messages in thread
From: Oleh Kravchenko @ 2021-05-20 14:44 UTC (permalink / raw)
  To: u-boot

Thank you, Sean!

Could you please take a look at this patch too?
https://patchwork.ozlabs.org/project/uboot/patch/20210514210620.24715-1-oleg at kaa.org.ua/

20.05.21 17:32, Sean Anderson ????:
> 
> 
> On 5/19/21 6:31 AM, Oleh Kravchenko wrote:
>> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
>> but it is wrong.
>>
>> Fill disk_partition structure with eMMC user partition info
>> to properly flash data.
>>
>> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>> Cc: Marek Vasut <marex@denx.de>
>> Cc: Sean Anderson <sean.anderson@seco.com>
>> Cc: Tom Rini <trini@konsulko.com>
>> ---
>>
>>
>> Changes for v2:
>> ??? - code cleanup;
>> Changes for v3:
>> ??? - QA passed at https://github.com/u-boot/u-boot/pull/75;
>> Changes for v4:
>> ??? - fixed ugly code;
>> ??? - QA passed at https://github.com/u-boot/u-boot/pull/75.
>>
>> ? drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>> ? 1 file changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
>> index 2f3837e559..a009863e89 100644
>> --- a/drivers/fastboot/fb_mmc.c
>> +++ b/drivers/fastboot/fb_mmc.c
>> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>> ??????????????????? u32 download_bytes, char *response)
>> ? {
>> ????? struct blk_desc *dev_desc;
>> -??? struct disk_partition info;
>> +??? struct disk_partition info = {0};
>> ? ? #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>> ????? if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
>> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>> ????? }
>> ? #endif
>> ? -??? if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>> +#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;
>> +
>> +??????? strlcpy((char *)&info.name, cmd, sizeof(info.name));
>> +??????? info.size??? = dev_desc->lba;
>> +??????? info.blksz??? = dev_desc->blksz;
>> +??? }
>> +#endif
>> +
>> +??? if (!info.name[0] &&
>> +??????? fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>> ????????? return;
>> ? ????? if (is_sparse_image(download_buffer)) {
>>
> 
> Reviewed-by: Sean Anderson <sean.anderson@seco.com>

-- 
Best regards,
Oleh Kravchenko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-20 14:44   ` Oleh Kravchenko
@ 2021-05-20 15:00     ` Sean Anderson
  2021-05-20 15:23       ` Oleh Kravchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Sean Anderson @ 2021-05-20 15:00 UTC (permalink / raw)
  To: u-boot



On 5/20/21 10:44 AM, Oleh Kravchenko wrote:
> Thank you, Sean!
> 
> Could you please take a look at this patch too?
> https://patchwork.ozlabs.org/project/uboot/patch/20210514210620.24715-1-oleg at kaa.org.ua/

You may want to CC Lukas Majewski. I believe he took fastboot patches last time they got merged.

--Sean

> 
> 20.05.21 17:32, Sean Anderson ????:
>>
>>
>> On 5/19/21 6:31 AM, Oleh Kravchenko wrote:
>>> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
>>> but it is wrong.
>>>
>>> Fill disk_partition structure with eMMC user partition info
>>> to properly flash data.
>>>
>>> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
>>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>>> Cc: Marek Vasut <marex@denx.de>
>>> Cc: Sean Anderson <sean.anderson@seco.com>
>>> Cc: Tom Rini <trini@konsulko.com>
>>> ---
>>>
>>>
>>> Changes for v2:
>>>  ??? - code cleanup;
>>> Changes for v3:
>>>  ??? - QA passed at https://github.com/u-boot/u-boot/pull/75;
>>> Changes for v4:
>>>  ??? - fixed ugly code;
>>>  ??? - QA passed at https://github.com/u-boot/u-boot/pull/75.
>>>
>>>  ? drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>>>  ? 1 file changed, 15 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
>>> index 2f3837e559..a009863e89 100644
>>> --- a/drivers/fastboot/fb_mmc.c
>>> +++ b/drivers/fastboot/fb_mmc.c
>>> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>  ??????????????????? u32 download_bytes, char *response)
>>>  ? {
>>>  ????? struct blk_desc *dev_desc;
>>> -??? struct disk_partition info;
>>> +??? struct disk_partition info = {0};
>>>  ? ? #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>>>  ????? if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
>>> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>  ????? }
>>>  ? #endif
>>>  ? -??? if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>> +#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;
>>> +
>>> +??????? strlcpy((char *)&info.name, cmd, sizeof(info.name));
>>> +??????? info.size??? = dev_desc->lba;
>>> +??????? info.blksz??? = dev_desc->blksz;
>>> +??? }
>>> +#endif
>>> +
>>> +??? if (!info.name[0] &&
>>> +??????? fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>  ????????? return;
>>>  ? ????? if (is_sparse_image(download_buffer)) {
>>>
>>
>> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-20 15:00     ` Sean Anderson
@ 2021-05-20 15:23       ` Oleh Kravchenko
  2021-05-26 16:35         ` Oleh Kravchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Oleh Kravchenko @ 2021-05-20 15:23 UTC (permalink / raw)
  To: u-boot

Hello Lukasz,
Could you please review this patch too?

This patch fixes Fastboot behaviour,
when flashing or erasing of eMMC user area was requested.

20.05.21 18:00, Sean Anderson ????:
> 
> 
> On 5/20/21 10:44 AM, Oleh Kravchenko wrote:
>> Thank you, Sean!
>>
>> Could you please take a look at this patch too?
>> https://patchwork.ozlabs.org/project/uboot/patch/20210514210620.24715-1-oleg at kaa.org.ua/
> 
> You may want to CC Lukas Majewski. I believe he took fastboot patches last time they got merged.
> 
> --Sean
> 
>>
>> 20.05.21 17:32, Sean Anderson ????:
>>>
>>>
>>> On 5/19/21 6:31 AM, Oleh Kravchenko wrote:
>>>> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
>>>> but it is wrong.
>>>>
>>>> Fill disk_partition structure with eMMC user partition info
>>>> to properly flash data.
>>>>
>>>> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
>>>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>>>> Cc: Marek Vasut <marex@denx.de>
>>>> Cc: Sean Anderson <sean.anderson@seco.com>
>>>> Cc: Tom Rini <trini@konsulko.com>
>>>> ---
>>>>
>>>>
>>>> Changes for v2:
>>>> ???? - code cleanup;
>>>> Changes for v3:
>>>> ???? - QA passed at https://github.com/u-boot/u-boot/pull/75;
>>>> Changes for v4:
>>>> ???? - fixed ugly code;
>>>> ???? - QA passed at https://github.com/u-boot/u-boot/pull/75.
>>>>
>>>> ?? drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>>>> ?? 1 file changed, 15 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
>>>> index 2f3837e559..a009863e89 100644
>>>> --- a/drivers/fastboot/fb_mmc.c
>>>> +++ b/drivers/fastboot/fb_mmc.c
>>>> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>> ???????????????????? u32 download_bytes, char *response)
>>>> ?? {
>>>> ?????? struct blk_desc *dev_desc;
>>>> -??? struct disk_partition info;
>>>> +??? struct disk_partition info = {0};
>>>> ?? ? #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>>>> ?????? if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
>>>> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>> ?????? }
>>>> ?? #endif
>>>> ?? -??? if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>> +#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;
>>>> +
>>>> +??????? strlcpy((char *)&info.name, cmd, sizeof(info.name));
>>>> +??????? info.size??? = dev_desc->lba;
>>>> +??????? info.blksz??? = dev_desc->blksz;
>>>> +??? }
>>>> +#endif
>>>> +
>>>> +??? if (!info.name[0] &&
>>>> +??????? fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>> ?????????? return;
>>>> ?? ????? if (is_sparse_image(download_buffer)) {
>>>>
>>>
>>> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
>>

-- 
Best regards,
Oleh Kravchenko

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-20 15:23       ` Oleh Kravchenko
@ 2021-05-26 16:35         ` Oleh Kravchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Oleh Kravchenko @ 2021-05-26 16:35 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Lukasz Majewski

Hello Tom,
coud you please cherry-pick this patch?

Lukasz doesn't respond :(

20.05.21 18:23, Oleh Kravchenko пише:
> Hello Lukasz,
> Could you please review this patch too?
>
> This patch fixes Fastboot behaviour,
> when flashing or erasing of eMMC user area was requested.
>
> 20.05.21 18:00, Sean Anderson пише:
>>
>> On 5/20/21 10:44 AM, Oleh Kravchenko wrote:
>>> Thank you, Sean!
>>>
>>> Could you please take a look at this patch too?
>>> https://patchwork.ozlabs.org/project/uboot/patch/20210514210620.24715-1-oleg@kaa.org.ua/
>> You may want to CC Lukas Majewski. I believe he took fastboot patches last time they got merged.
>>
>> --Sean
>>
>>> 20.05.21 17:32, Sean Anderson пише:
>>>>
>>>> On 5/19/21 6:31 AM, Oleh Kravchenko wrote:
>>>>> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
>>>>> but it is wrong.
>>>>>
>>>>> Fill disk_partition structure with eMMC user partition info
>>>>> to properly flash data.
>>>>>
>>>>> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
>>>>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>>>>> Cc: Marek Vasut <marex@denx.de>
>>>>> Cc: Sean Anderson <sean.anderson@seco.com>
>>>>> Cc: Tom Rini <trini@konsulko.com>
>>>>> ---
>>>>>
>>>>>
>>>>> Changes for v2:
>>>>>      - code cleanup;
>>>>> Changes for v3:
>>>>>      - QA passed at https://github.com/u-boot/u-boot/pull/75;
>>>>> Changes for v4:
>>>>>      - fixed ugly code;
>>>>>      - QA passed at https://github.com/u-boot/u-boot/pull/75.
>>>>>
>>>>>    drivers/fastboot/fb_mmc.c | 22 +++++++++++++++-------
>>>>>    1 file changed, 15 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
>>>>> index 2f3837e559..a009863e89 100644
>>>>> --- a/drivers/fastboot/fb_mmc.c
>>>>> +++ b/drivers/fastboot/fb_mmc.c
>>>>> @@ -512,7 +512,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>>>                      u32 download_bytes, char *response)
>>>>>    {
>>>>>        struct blk_desc *dev_desc;
>>>>> -    struct disk_partition info;
>>>>> +    struct disk_partition info = {0};
>>>>>      #ifdef CONFIG_FASTBOOT_MMC_BOOT_SUPPORT
>>>>>        if (strcmp(cmd, CONFIG_FASTBOOT_MMC_BOOT1_NAME) == 0) {
>>>>> @@ -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,7 +594,20 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
>>>>>        }
>>>>>    #endif
>>>>>    -    if (fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>>> +#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;
>>>>> +
>>>>> +        strlcpy((char *)&info.name, cmd, sizeof(info.name));
>>>>> +        info.size    = dev_desc->lba;
>>>>> +        info.blksz    = dev_desc->blksz;
>>>>> +    }
>>>>> +#endif
>>>>> +
>>>>> +    if (!info.name[0] &&
>>>>> +        fastboot_mmc_get_part_info(cmd, &dev_desc, &info, response) < 0)
>>>>>            return;
>>>>>          if (is_sparse_image(download_buffer)) {
>>>>>
>>>> Reviewed-by: Sean Anderson <sean.anderson@seco.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4] Fix flashing of eMMC user area with Fastboot
  2021-05-19 10:31 [PATCH v4] Fix flashing of eMMC user area with Fastboot Oleh Kravchenko
  2021-05-19 11:13 ` Oleh Kravchenko
  2021-05-20 14:32 ` Sean Anderson
@ 2021-08-22 20:54 ` Tom Rini
  2 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2021-08-22 20:54 UTC (permalink / raw)
  To: Oleh Kravchenko; +Cc: u-boot, Pantelis Antoniou, Marek Vasut, Sean Anderson

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On Wed, May 19, 2021 at 01:31:31PM +0300, Oleh Kravchenko wrote:

> 'gpt' and 'mmc0' fastboot partitions have been treated as the same device,
> but it is wrong.
> 
> Fill disk_partition structure with eMMC user partition info
> to properly flash data.
> 
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Sean Anderson <sean.anderson@seco.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-22 20:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 10:31 [PATCH v4] Fix flashing of eMMC user area with Fastboot Oleh Kravchenko
2021-05-19 11:13 ` Oleh Kravchenko
2021-05-20 14:32 ` Sean Anderson
2021-05-20 14:44   ` Oleh Kravchenko
2021-05-20 15:00     ` Sean Anderson
2021-05-20 15:23       ` Oleh Kravchenko
2021-05-26 16:35         ` Oleh Kravchenko
2021-08-22 20:54 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.