mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] arm: bootm: be more clever about kernel spacing
Date: Fri, 26 Feb 2016 20:12:39 +0100	[thread overview]
Message-ID: <1456513959-26781-3-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1456513959-26781-1-git-send-email-dev@lynxeye.de>

From: Lucas Stach <l.stach@pengutronix.de>

When the kernel load address is chosen by the user/image we need
to check if the kernel needs to relocate itself before decompression.
If that's the case the spacing behind the kernel must allow for this
relocation without overwriting anything placed behind the kernel.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/lib/bootm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a18d149..28b4f4a 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -92,6 +92,14 @@ static void get_kernel_addresses(unsigned long mem_start, size_t image_size,
 		if (verbose)
 			printf("no OS load address, defaulting to 0x%08lx\n",
 				*load_address);
+	} else if (*load_address <= mem_start + image_decomp_size) {
+		/*
+		 * If the user/image specified an address where the kernel needs
+		 * to relocate itself before decompression we need to extend the
+		 * spacing to allow this relocation to happen without
+		 * overwriting anything placed behind the kernel.
+		 */
+		*spacing += image_decomp_size;
 	}
 }
 
-- 
2.5.0


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

  parent reply	other threads:[~2016-02-26 19:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 19:12 [PATCH 1/3] bootm: fix uImage crashes when no partition is given Lucas Stach
2016-02-26 19:12 ` [PATCH 2/3] arm: bootm: unify kernel load address calculation Lucas Stach
2016-02-26 19:12 ` Lucas Stach [this message]
2016-02-29  7:48 ` [PATCH 1/3] bootm: fix uImage crashes when no partition is given Sascha Hauer
2016-02-29  9:05   ` Lucas Stach
2016-03-01  7:23     ` 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=1456513959-26781-3-git-send-email-dev@lynxeye.de \
    --to=dev@lynxeye.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