u-boot format.

Hi,

I am trying to port an OS that was written in my OS class to the beagle board. Looking into the source and object code of the x-loader and u-boot, I see that the last two steps of running make on the u-boot source code is some arm-none-eabi-objcopy. I understand that this is a way to change the object file formats. I see in the hex dump and disassembly, that the file u-boot is ELF (arm-none-eabi -d u-boot) while the u-boot.bin which is mush smaller than the u-boot is of some unknown format. Further more, looking into the x-loader source code, I see that it tries to load a file u-boot.bin from a fat file system (when loading from the SD card) and transfers control to it using a function pointer.

What kind of a file is the u-boot.bin (it is not ELF)? What exactly is happening in the last two steps of the u-boot compilation? What does x-loader expect the u-boot.bin to bo while handing off the control?

Thank you.

Hi,

Since I did not receive any reply for the original post, I decided to clarify with some additional details. Below are the last two lines of the compilation steps of u-boot. All I managed to figure out is that it converts the ELF file generated by the arm-none-eabi-gcc to some other object file format (srec & binary - what are those for?).

arm-none-eabi-objcopy -O srec u-boot u-boot.srec
arm-none-eabi-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin

Below are the relevant lines from the file board.c from the x-loader source code:

buf = (uchar*) CFG_LOADADDR;

#ifdef CONFIG_MMC
/* first try mmc */
if (mmc_init(1)) {
size = file_fat_read(“u-boot.bin”, buf, 0);
if (size > 0) {
#ifdef CFG_PRINTF
printf(“Loading u-boot.bin from mmc\nSize: %d”,size);
#endif
buf += size;
}
}
#endif

.
.
.

/* go run U-Boot and never return */
((init_fnc_t *)CFG_LOADADDR)();

/* should never come here */

So a binary file is being loaded from fat to a memory location, and that memory location seems to be called as a function pointer? Do I assume that the binary object file has no header or layout information and it is just executable code right from byte 0? What is .srec for? it was never copied on to the SD card or the NAND.

Thank you.

The 'raw' image is just that - just the binary image that represents
the program (U-Boot). In this case, it's what you might program into
FLASH (NAND, NOR). It's also what the X-loader is designed to load.

The 'srec' image (Motorola S-records) is an ASCII representation of the
same data, including address information (where this code belongs in
memory, etc). It is often used by external tools, e.g. a FLASH programmer.