Thursday, February 18, 2010

uClinux memory layout

georges@menie.org gave a good explanation of uClinux memory layout here:

http://www.menie.org/georges/DragonEngine/memory-map.html

Some thing I want to add, how is the image.bin (which is the executable image we usually download to the hardware board to execute) generated.

Like George said:
The uClinux build system is building first the linux kernel, then the user applications and the root filesystem. The last step is usually to extract the text, data and init segments, to convert them in a flat binary file and to add the root file system at the end.

For Arcturus ColdFire uC5272, if you take a look at the Makefile at .../vendors/Arcturus/uC5272, you will find something like this:

$(CROSS_COMPILE)objcopy -O binary --remove-section=.ramvec\
--remove-section=.eram \
--set-section-flags=.romvec=CONTENTS,ALLOC,LOAD,READONLY,CODE \
$(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.bin

cat $(IMAGEDIR)/linux.bin $(ROMFSIMG) > $(IMAGE)

Basically objcopy remove .ramvec, .eram sections, and set section flags of linux, and copy the rest into linux.bin. Then linux.bin and romfs.bin are cat'ed into image.bin file.

No comments:

Post a Comment