mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] ARM: Use armlinux_bootparams address for DTB
Date: Wed, 10 Jul 2013 11:00:40 +0400	[thread overview]
Message-ID: <1373439641-18852-2-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1373439641-18852-1-git-send-email-shc_work@mail.ru>

In some cases, the address of the devicetree, which is obtained
dynamically, may be located in the kernel text area, which leads
to overwrite devicetree by kernel. The patch uses the address for
devicetree, provided by board, if it possible.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/lib/armlinux.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 84372af..4aa3414 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -262,17 +262,23 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
 		unsigned long initrd_size, void *oftree, int verbose)
 {
 	void (*kernel)(int zero, int arch, void *params) = adr;
-	void *params = NULL;
 	int architecture;
 
 	if (oftree) {
+		if (armlinux_bootparams) {
+			struct fdt_header *header = oftree;
+
+			memcpy(armlinux_bootparams, oftree,
+			       fdt32_to_cpu(header->totalsize));
+		} else
+			armlinux_bootparams = oftree;
+
 		if (verbose)
-			printf("booting Linux kernel with devicetree\n");
-		params = oftree;
-	} else {
+			printf("booting Linux kernel with devicetree at 0x%p\n",
+			       armlinux_bootparams);
+	} else
 		setup_tags(initrd_address, initrd_size, swap, verbose);
-		params = armlinux_bootparams;
-	}
+
 	architecture = armlinux_get_architecture();
 
 	shutdown_barebox();
@@ -290,10 +296,10 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
 		"mov r2, %1\n"
 		"bx %2\n"
 		:
-		: "r" (architecture), "r" (params), "r" (kernel)
+		: "r" (architecture), "r" (armlinux_bootparams), "r" (kernel)
 		: "r0", "r1", "r2"
 	);
 #else
-	kernel(0, architecture, params);
+	kernel(0, architecture, armlinux_bootparams);
 #endif
 }
-- 
1.8.1.5


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

  reply	other threads:[~2013-07-10  7:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  7:00 [PATCH 1/3] ARM: Add "verbose" parameter for start_linux procedure Alexander Shiyan
2013-07-10  7:00 ` Alexander Shiyan [this message]
2013-07-10  7:00 ` [PATCH 3/3] mfd: syscon: Replace dev_info with dev_dbg for print used region Alexander Shiyan
2013-07-10 12:52 ` [PATCH 1/3] ARM: Add "verbose" parameter for start_linux procedure Michael Olbrich
2013-07-10 13:16   ` Sascha Hauer
2013-07-10 15:13     ` Alexander Shiyan
2013-07-11  6:31       ` Sascha Hauer
2013-07-11  7:38         ` Alexander Shiyan

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=1373439641-18852-2-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --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