Fix flashing of eMMC user area with Fastboot
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
'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.
---
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(-)
drivers/fastboot/fb_mmc.c +15 -7
@@ -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_SUPPORTif (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)) {
Signature · 1 line
2.26.3
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
Hello Sean,
Could you please take a look?
I've updated the patch.
19.05.21 13:31, Oleh Kravchenko ????:
Quoted 73 lines
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)drivers/fastboot/fb_mmc.c +15
-7@@ -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_SUPPORTif (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)) {
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
In reply to Oleh KravchenkoQuoted 64 lines · Oleh Kravchenko
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)drivers/fastboot/fb_mmc.c +8
-7@@ -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_SUPPORTif (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));
drivers/fastboot/fb_mmc.c void fastboot_mmc_flash_write(const char *cmd, void *download_buffer, · line 613
Quoted 10 lines
drivers/fastboot/fb_mmc.c +7
-0+ 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)) {
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
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 ????:
Quoted 75 lines · Oleh Kravchenko
Quoted 67 lines
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)drivers/fastboot/fb_mmc.c +1
-1@@ -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) {drivers/fastboot/fb_mmc.c +0
-0@@ -532,12 +532,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,? #endif
? ? #ifCONFIG_IS_ENABLED(EFI_PARTITION)-#ifndefCONFIG_FASTBOOT_MMC_USER_SUPPORT????? if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME)== 0) {drivers/fastboot/fb_mmc.c +0
-4-#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;drivers/fastboot/fb_mmc.c +0
-0@@ -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)drivers/fastboot/fb_mmc.c +14
-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)Quoted 3 lines
????????? return;
? ????? if (is_sparse_image(download_buffer)) {Reviewed-by Sean Anderson <[email protected]>
Signature · 2 lines
Best regards, Oleh Kravchenko
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
Quoted 4 lines · Oleh Kravchenko
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
Quoted 78 lines
20.05.21 17:32, Sean Anderson ????:
Quoted 75 lines · Oleh Kravchenko
Quoted 60 lines
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)
drivers/fastboot/fb_mmc.c +8
-6@@ -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));drivers/fastboot/fb_mmc.c void fastboot_mmc_flash_write(const char *cmd, void *download_buffer, · line 613
Quoted 10 lines
drivers/fastboot/fb_mmc.c +7
-0+??????? 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 <[email protected]>
PATCH v4 1/1 Fix flashing of eMMC user area with Fastboot
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 ????:
Quoted 90 lines · Oleh Kravchenko
Quoted 4 lines
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
Quoted 78 lines
20.05.21 17:32, Sean Anderson ????:
Quoted 75 lines · Oleh Kravchenko
Quoted 67 lines
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)drivers/fastboot/fb_mmc.c +1
-1@@ -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) {drivers/fastboot/fb_mmc.c +0
-0@@ -532,12 +532,7 @@ void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,?? #endif
?? ? #ifCONFIG_IS_ENABLED(EFI_PARTITION)-#ifndefCONFIG_FASTBOOT_MMC_USER_SUPPORT?????? if (strcmp(cmd, CONFIG_FASTBOOT_GPT_NAME)== 0) {drivers/fastboot/fb_mmc.c +0
-4-#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;drivers/fastboot/fb_mmc.c +0
-0@@ -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)drivers/fastboot/fb_mmc.c +14
-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)Quoted 3 lines
?????????? return;
?? ????? if (is_sparse_image(download_buffer)) {Reviewed-by Sean Anderson <[email protected]>
Signature · 2 lines
Best regards, Oleh Kravchenko
Hello Tom,
coud you please cherry-pick this patch?
Lukasz doesn't respond :(
20.05.21 18:23, Oleh Kravchenko пише:
Quoted 91 lines
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 пише:
Quoted 84 lines · Oleh Kravchenko
Quoted 4 lines
Thank you, Sean!
Could you please take a look at this patch too?
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/You may want to CC Lukas Majewski. I believe he took fastboot patches last time they got merged.
--Sean
Quoted 74 lines
20.05.21 17:32, Sean Anderson пише:
Quoted 73 lines · Oleh Kravchenko
Quoted 60 lines
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>---
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(-)drivers/fastboot/fb_mmc.c +8
-6@@ -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));drivers/fastboot/fb_mmc.c void fastboot_mmc_flash_write(const char *cmd, void *download_buffer, · line 613
Quoted 10 lines
drivers/fastboot/fb_mmc.c +7
-0+ 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 <[email protected]>
Quoted 6 lines · Oleh Kravchenko
'gpt' and 'mmc0' fastboot partitions have been treated as the same device, but it is wrong.
Fill
disk_partitionstructure with eMMC user partition info to properly flash data.
Quoted 6 lines
Signed-off-by Oleh Kravchenko <[email protected]>Cc Pantelis Antoniou <[email protected]>Cc Marek Vasut <[email protected]>Cc Sean Anderson <[email protected]>Cc Tom Rini <[email protected]>Reviewed-by Sean Anderson <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom