diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-07-10 11:00:40 +0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-07-11 14:37:26 +0200 |
commit | 0c4108f9173ece75d96f19b447ef6464bdfdf187 (patch) | |
tree | 20891883d4432801b782e2c9818ddd9a075425c2 /arch/arm/lib/armlinux.c | |
parent | 3d85dae2be1839e23c04d0a8b93a39dea3be46b6 (diff) | |
download | barebox-0c4108f9173ece75d96f19b447ef6464bdfdf187.tar.gz barebox-0c4108f9173ece75d96f19b447ef6464bdfdf187.tar.xz |
ARM: Use armlinux_bootparams address for DTB
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/armlinux.c')
-rw-r--r-- | arch/arm/lib/armlinux.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index 40a63ea7e1..d962997d64 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -261,16 +261,24 @@ void start_linux(void *adr, int swap, unsigned long initrd_address, unsigned long initrd_size, void *oftree) { void (*kernel)(int zero, int arch, void *params) = adr; - void *params = NULL; int architecture; if (oftree) { - printf("booting Linux kernel with devicetree\n"); - params = oftree; + if (armlinux_bootparams) { + struct fdt_header *header = oftree; + + memcpy(armlinux_bootparams, oftree, + fdt32_to_cpu(header->totalsize)); + } else { + armlinux_bootparams = oftree; + } + + printf("booting Linux kernel with devicetree at 0x%p\n", + armlinux_bootparams); } else { setup_tags(initrd_address, initrd_size, swap); - params = armlinux_bootparams; } + architecture = armlinux_get_architecture(); shutdown_barebox(); @@ -288,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 } |