[PATCH] Fix flashing of eMMC user area with Fastboot

Oleh Kravchenko oleg at kaa.org.ua
Thu May 13 16:02:03 CEST 2021


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 | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 8e74e50e91..7e61fbac17 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,26 @@ 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 flash_image;
+	}
+#endif
+
 	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