[PATCH 02/20] spl: fix entry_point equal to load_addr

Lukasz Majewski
2019-12-08T14:37:35Z

On Wed, 4 Dec 2019 18:44:21 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> At the moment entry_point is set to image_get_load(header) that sets
> it to "load address" instead of "entry point", assuming entry_point is
> equal to load_addr, but it's not true. Then load_addr is set to
> "entry_point - header_size", but this is wrong too since load_addr is
> not an entry point.
>
> So use image_get_ep() for entry_point assignment and image_get_load()
> for load_addr assignment.
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> common/spl/spl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index d51dbe9942..24da164b43 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -264,9 +264,9 @@ int spl_parse_image_header(struct spl_image_info
> *spl_image, spl_image->entry_point = image_get_ep(header);
> spl_image->size =
> image_get_data_size(header); } else {
> - spl_image->entry_point =
> image_get_load(header);
> + spl_image->entry_point =
> image_get_ep(header); /* Load including the header */
> - spl_image->load_addr =
> spl_image->entry_point -
> + spl_image->load_addr =
> image_get_load(header) - header_size;
> spl_image->size =
> image_get_data_size(header) + header_size;

This may not be the case - but I do recall that there was a similar
issue between u-boot.bin and u-boot.imx being loaded.

What is the format of i.MXRT?

I'm also concerned about breaking already supported in-tree boards. Why
i.MXRT needs to make this change? And why other boards don't need that
fix? (do they all have load address equal to entry point ?)

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191208/47910964/attachment.sig>