SPL bad magic at boot in the MLO file

Hi, when the board boot, I’ve the message that tell me :

bad magic. and after a deep research, it come from the SPL :


if (image_get_magic(header) != IH_MAGIC) {
puts(“bad magic\n”);

how can i fix that ?


I’ve compiled the uboot again and again, and it doesn’t change anything when I replace the old MLO file :

dd if=./MLO of=${DISK} count=1 seek=1 bs=128k

//if (image_get_magic(header) != IH_MAGIC) {
          // puts("bad magic\n");
          // }



Lol, ok

But what went wrong ? It’s checking a magic number to prevent something broken.

Can I write back the correct magic number ?

I found that in this file : arch/powerpc/cpu/mpc8xx/start.S

it write somewhere the magic number : 0x27051956

But I don’t see where the magic number is written for the beaglebone black uboot.

any idea ?

//if (image_get_magic(header) != IH_MAGIC) {
// puts(“bad magic\n”);
// }


hehe !

it's for something generic, but we don't use it.. I'm tempted to just
patch it like my joke, as people do ask..



When I compile the uboot, are we using this one ?


Can we add something like that :

.long 0x27051956 /* U-Boot Magic Number */

OK that not it I think.

I’ve tried to understand when the header is written in the MLO. And it looks like that it is the mkimage job . ( not sure ) .

the mkimage is call to create the MLO file. I discovered that the function omapimage_set_header is called to create the header file.

So it’s not at all this structure

typedef struct image_header {
__be32 ih_magic; /* Image Header Magic Number */

} image_header_t;

but it’s using this header : struct gp_header.

And that where I’m confused, because in the file : common/spl/spl_mmc.c it’s looking at this header :

struct image_header *header;

header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
sizeof(struct image_header));

What is wrong Robert Nelson, Where am I wrong ?