[PATCH 2/2] arm/cpu/start.c: Avoid copying device-tree when possible

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 28 23:58:47 PDT 2015


Hi Andrey,

On Fri, Sep 25, 2015 at 11:02:18PM -0700, Andrey Smirnov wrote:
> In case of non-relocatable image device-tree blob should already be
> preloaded into memory as a part of Barebox binary upload, so there is
> no need to 'memcpy' it again
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
> ---
>  arch/arm/cpu/start.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
> index 7ffde7c..c461a73 100644
> --- a/arch/arm/cpu/start.c
> +++ b/arch/arm/cpu/start.c
> @@ -107,6 +107,15 @@ static noinline __noreturn void __start(unsigned long membase,
> 
>  		switch (get_any_boarddata_magic(boarddata)) {
>  		case FDT_MAGIC:
> +			if (!IS_ENABLED(CONFIG_RELOCATABLE)) {
> +				/*
> +				  If Barebox is not relocatable
> +				  there's no need to move data around
> +				 */
> +				barebox_boot_dtb = boarddata;
> +				break;
> +			}
> +

At this place it is unknown where in memory the fdt is. It could well be
somewhere in the malloc area space, so we need to move it to a safe
place before we setup malloc in the next step.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list