mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX: bbu: use full path name for mmcboot handler
@ 2018-09-24  8:45 Sascha Hauer
  2018-09-24 13:17 ` Andrey Smirnov
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2018-09-24  8:45 UTC (permalink / raw)
  To: Barebox List

When doing barebox update over fastboot the fastboot code checks for
existance of file given in the filename argument, so add the "/dev/"
component to the handler.
With this fastboot works with the mmcboot handler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/tqma6x/board.c       |  2 +-
 arch/arm/mach-imx/imx-bbu-internal.c | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c
index ecf8fa06af..9561d1edd8 100644
--- a/arch/arm/boards/tqma6x/board.c
+++ b/arch/arm/boards/tqma6x/board.c
@@ -105,7 +105,7 @@ static int tqma6x_env_init(void)
 
 	imx6_bbu_internal_spi_i2c_register_handler("spiflash", "/dev/m25p0.barebox",
 		BBU_HANDLER_FLAG_DEFAULT);
-	imx6_bbu_internal_mmcboot_register_handler("emmc", "mmc2", 0);
+	imx6_bbu_internal_mmcboot_register_handler("emmc", "/dev/mmc2", 0);
 
 	device_detect_by_name("mmc2");
 
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 504e359bc3..afb768ba8e 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -409,9 +409,11 @@ static int imx_bbu_internal_v2_mmcboot_update(struct bbu_handler *handler,
 	int ret;
 	char *bootpartvar;
 	const char *bootpart;
-	char *devicefile;
+	const char *devicefile = data->devicefile;
+	char *bootpartfile;
+	const char *devname = devpath_to_name(data->devicefile);
 
-	ret = asprintf(&bootpartvar, "%s.boot", data->devicefile);
+	ret = asprintf(&bootpartvar, "%s.boot", devname);
 	if (ret < 0)
 		return ret;
 
@@ -423,23 +425,23 @@ static int imx_bbu_internal_v2_mmcboot_update(struct bbu_handler *handler,
 		bootpart = "boot0";
 	}
 
-	ret = asprintf(&devicefile, "/dev/%s.%s", data->devicefile, bootpart);
+	ret = asprintf(&bootpartfile, "%s.%s", devicefile, bootpart);
 	if (ret < 0)
 		goto free_bootpartvar;
 
-	ret = imx_bbu_check_prereq(imx_handler, devicefile, data,
+	ret = imx_bbu_check_prereq(imx_handler, bootpartfile, data,
 				   filetype_imx_image_v2);
 	if (ret)
 		goto free_devicefile;
 
-	ret = imx_bbu_write_device(imx_handler, devicefile, data, data->image, data->len);
+	ret = imx_bbu_write_device(imx_handler, bootpartfile, data, data->image, data->len);
 
 	if (!ret)
 		/* on success switch boot source */
 		ret = setenv(bootpartvar, bootpart);
 
 free_devicefile:
-	free(devicefile);
+	free(bootpartfile);
 
 free_bootpartvar:
 	free(bootpartvar);
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2018-09-24 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-24  8:45 [PATCH] ARM: i.MX: bbu: use full path name for mmcboot handler Sascha Hauer
2018-09-24 13:17 ` Andrey Smirnov
2018-09-24 13:46   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox