From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Thu, 20 May 2021 11:00:35 -0400 Subject: [PATCH v4] Fix flashing of eMMC user area with Fastboot In-Reply-To: <9c2636b6-0d2f-5b79-d91a-6002cb24a31d@kaa.org.ua> References: <20210519103129.30168-1-oleg@kaa.org.ua> <9c2636b6-0d2f-5b79-d91a-6002cb24a31d@kaa.org.ua> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 >>> Cc: Pantelis Antoniou >>> Cc: Marek Vasut >>> Cc: Sean Anderson >>> Cc: Tom Rini >>> --- >>> >>> >>> 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 >