[U-Boot] [PATCH v2 1/6] fdt_relocate: fix fdt size and endian bugs

Wolfgang Denk wd at denx.de
Tue Oct 12 23:20:39 CEST 2010


Dear John Rigby,

In message <1285775292-15060-2-git-send-email-john.rigby at linaro.org> you wrote:
> Fix two problems in fdt_relocate.
> 
> First, for the non relocation case current code calculates
> fdt blob size by subtracting the fdt address from the end

Please consider the non relocation case obsoleted. This is nothing
that needs to or should have FDT support added.

> of bootmap.  This wrong because it assumes that the fdt_blob
> is located at the top (high) of the bootmap.  Use the current
> size plus padding instead.  For example if the blob is at
> the beginning of bootmap then the calculated size will be
> the size of the entire bootmapped area.
> 
> Second, fdt_relocate returns bad size info on little endian
> platforms because it calls be32_to_cpu on the value returned
> by fdt_totalsize.  This is wrong because the value returned
> by fdt_totalsize is already cpu endian.
> 
> Signed-off-by: John Rigby <john.rigby at linaro.org>
> ---
>  common/image.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Sorry, but the commit message and the code changes don't match at all.

You say you were fixing fdt_relocate(), but you change only
common/image.c which is unrelated,

Please fix the commit message.

> diff --git a/common/image.c b/common/image.c
> index 3a2f25e..4aec9d6 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
>  		*of_size = of_len;
>  	} else {
>  		*of_flat_tree = fdt_blob;
> -		of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
> +		of_len = *of_size + (unsigned)CONFIG_SYS_FDT_PAD;

Um... what are the implications of this on other architectures?

For example, on which PowerPC systems has this been tested?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Science makes godlike -- it is all over with priests and  gods  when
man becomes scientific. Moral: science is the forbidden as such -- it
alone  is  forbidden. Science is the *first* sin, the *original* sin.
*This alone is  morality.*  ``Thou  shalt  not  know''  --  the  rest
follows."                                       - Friedrich Nietzsche


More information about the U-Boot mailing list