[U-Boot-Users] [PATCH] Fix the condition to detect if an image is already in its place
Uwe Kleine-König
ukleinek at informatik.uni-freiburg.de
Wed Mar 21 22:17:06 CET 2007
Hello Wolfgang,
Wolfgang Denk wrote:
> In message <20070321203315.GD16180 at informatik.uni-freiburg.de> you wrote:
> >
> > > If you have a non-XIP image you willnot execute that part of the code.
> > > It was in an if-branch ...
> > The only condition I see is:
> >
> > hdr->ih_comp == IH_COMP_NONE
> >
> > Could you please be more verbose and point out which if-branch you mean?
>
> The one you suggested to change:
>
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -318,7 +318,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>
> switch (hdr->ih_comp) {
> case IH_COMP_NONE:
> - if(ntohl(hdr->ih_load) == addr) {
> + if(ntohl(hdr->ih_load) == data) {
> printf (" XIP %s ... ", name);
> } else {
???
I thought you wanted to say that the if is not reached in the non-XIP
case. Maybe I didn't get what code you mean?
> That's exactly the test that is used to decide if we have an XIP
> image: if the load address is identical to the address where the
> image is currently stored, it will not be copied, but executed in
> place.
In my eyes it would be more clear if an XIP image had
ih_load = xip_address + sizeof(header)
because then the load address would have the same meaning for both XIP
and non-XIP. Now it's somehow artifical that I cannot load an non-XIP
image (with header) to it's load address.
Yes, it is stupid to do so but not more stupid than any other address
different from (ih_load - sizeof(header)).
So the current state is that the load address specifies the start of
the complete image (i.e. with header) for the XIP case and the start of
data (i.e. without header) in the non-XIP case.
> Later, there is an additional check that entry point address
> must be immediately following the header.
I don't see why this matters here nor the check itself.
> And, as mentioned before, your modification will break this logic,
> this breaking booting XIP images on PowerPC.
I got that. As XIP booting on PowerPC relies on an---in my
eyes---broken feature it has to be fixed of course after that feature is
fixed.
Best regards
Uwe
--
Uwe Kleine-König
exit vi, lesson II:
: w q ! <CR>
NB: write the current file
More information about the U-Boot
mailing list