[U-Boot-Users] [PATCH] Fix the condition to detect if an image is already in its place

Wolfgang Denk wd at denx.de
Wed Mar 21 21:57:19 CET 2007

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 {

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.  Later,  there is an additional check that entry point address
must be immediately following the header.

And, as mentioned before, your modification will  break  this  logic,
this breaking booting XIP images on PowerPC.

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Computers are not intelligent. They only think they are.

More information about the U-Boot mailing list