mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: i.MX: bbu: use full path name for mmcboot handler
Date: Mon, 24 Sep 2018 10:45:47 +0200	[thread overview]
Message-ID: <20180924084547.28914-1-s.hauer@pengutronix.de> (raw)

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

             reply	other threads:[~2018-09-24  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24  8:45 Sascha Hauer [this message]
2018-09-24 13:17 ` Andrey Smirnov
2018-09-24 13:46   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180924084547.28914-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox