[PATCH] ARM: i.MX: bbu: use full path name for mmcboot handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux