All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: booti: fix the image runtime location
@ 2016-09-12  9:07 Peng Fan
  2016-09-12  9:18 ` Peng Fan
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2016-09-12  9:07 UTC (permalink / raw)
  To: u-boot

We should not use "bi_dram[0].start + text_offset" as the image dst.
The text_offset maybe 0 for some images, such as XEN. Then the dst
is actually bi_dram[0].start, which maybe the location of spin table.

Let's use "images->ep & ~(ih->text_offset)" as the dst address.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
---
 cmd/booti.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/booti.c b/cmd/booti.c
index 6c1c998..afc87e3 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -54,7 +54,9 @@ static int booti_setup(bootm_headers_t *images)
 	 * If we are not at the correct run-time location, set the new
 	 * correct location and then move the image there.
 	 */
-	dst = gd->bd->bi_dram[0].start + le64_to_cpu(ih->text_offset);
+	dst = images->ep & ~(ih->text_offset);
+	if (dst < gd->bd->bi_dram[0].start)
+		dst = gd->bd->bi_dram[0].start + le64_to_cpu(ih->text_offset);
 
 	unmap_sysmem(ih);
 
-- 
2.6.2

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

end of thread, other threads:[~2016-09-13 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12  9:07 [U-Boot] [PATCH] cmd: booti: fix the image runtime location Peng Fan
2016-09-12  9:18 ` Peng Fan
2016-09-12 12:04   ` Tom Rini
2016-09-13  6:02     ` Peng Fan
2016-09-13 11:19       ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.