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 7/7] ARM: i.MX: xload-esdhc: Find entry in image
Date: Fri,  1 Apr 2016 14:10:44 +0200	[thread overview]
Message-ID: <1459512644-8581-7-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1459512644-8581-1-git-send-email-s.hauer@pengutronix.de>

The binary image generated by barebox contains an instruction at the
very beginning to jump over the header. However, when the image is
written to a SD card and the first 512 bytes are skipped in order to
preserve the partition table then this jump instruction is lost. Instead
of relying on the jump instruction at the image beginning calculate
the image entry from the i.MX header instead of relying on the beginning
of the image being the entry point.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/xload-esdhc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/xload-esdhc.c b/arch/arm/mach-imx/xload-esdhc.c
index 0ff58c8..e774e4e 100644
--- a/arch/arm/mach-imx/xload-esdhc.c
+++ b/arch/arm/mach-imx/xload-esdhc.c
@@ -260,6 +260,7 @@ int imx6_esdhc_start_image(int instance)
 	u32 *ivt = buf + SZ_1K;
 	int ret, len;
 	void __noreturn (*bb)(void);
+	unsigned int ofs;
 
 	len = imx_image_size();
 	len = ALIGN(len, SECTOR_SIZE);
@@ -283,7 +284,9 @@ int imx6_esdhc_start_image(int instance)
 
 	pr_debug("Image loaded successfully\n");
 
-	bb = buf;
+	ofs = *(ivt + 1) - *(ivt + 8);
+
+	bb = buf + ofs;
 
 	bb();
 }
-- 
2.7.0


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

      parent reply	other threads:[~2016-04-01 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 12:10 [PATCH 1/7] ARM: i.MX6: esdctl: Fix memsize calculation for 4GiB/cs Sascha Hauer
2016-04-01 12:10 ` [PATCH 2/7] ARM: i.MX6: esdctl: Fix CS0_end " Sascha Hauer
2016-04-01 12:10 ` [PATCH 3/7] ARM: i.MX: remove unused imx-flash-header.h Sascha Hauer
2016-04-01 12:10 ` [PATCH 4/7] ARM: i.MX: xload-esdhc: Add GPL header Sascha Hauer
2016-04-01 12:10 ` [PATCH 5/7] ARM: i.MX: xload-esdhc: Fix typo successul -> successful Sascha Hauer
2016-04-01 12:10 ` [PATCH 6/7] ARM: i.MX: xload-esdhc: Add debug messages Sascha Hauer
2016-04-01 12:10 ` Sascha Hauer [this message]

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=1459512644-8581-7-git-send-email-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