[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] Inconsitency between image.srec and image.bin



Hi there,I have discovered a inconsistency between the image.srec file and the image.bin file. The romfs section is located at __init_end in image.srec while it is located at __bss_start in image.srec. I will explain:

The image.bin file is created by a "cat" of linux.bin and romfs.img (see detail 1 below). This causes romfs to start were linux ends, which is at __init_end. Image.srec is derived from image.elf. Image.elf is updated with "microblaze-uclinux-objcopy", which adds a section .romfs to "linux". See detail 2. For this the .bss location is extracted from "linux". See detail 3. The difference between the two is the unused space up to the next page boundary as can be seen in the System.map file:

2015d086 ? __initramfs_end
2015d08c A __init_end
2015e000 B __bss_start
2015e000 B saved_command_line
2015e100 B reset_devices

The length of the binary "linux.bin" is 0x2015d08c, which equals __init_end

Since that "setup.c" expect that romfs reside at .bss the downloading from image.srec will fail since that setup.c cannot locate romfs correctly. See the excerpt from the code:

inline unsigned *get_romfs_base(void)
{
	/* For now, assume "Standard" model of bss_start */
	return (unsigned *)&__init_end;
}

This causes "inline unsigned get_romfs_len(unsigned *addr)" to return 0 for the size.

This caused the problem that I wanted to discuss in the "Booting the petalinux kernel with FS-boot" thread.

Details:
The following details are from "/home/cv/petalinux-v0.20-rc3/software/petalinux-dist/vendors/PetaLogix/common/common.mak" when "make all" executes:

1) For "image.bin":
cat /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/linux.bin /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/romfs.img > /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/image.bin

2) For "image.elf":
microblaze-uclinux-objcopy --add-section=.romfs=/home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/romfs.img \
       --adjust-section-vma=.romfs=${ADDR} --no-adjust-warnings \
       --set-section-flags=.romfs=alloc,load,data   \
/home/cv/petalinux-v0.20-rc3/software/petalinux-dist/linux-2.6.x/linux /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/image.elf

"image.srec" is derived from "image.elf" by:
microblaze-uclinux-objcopy -O srec /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/image.elf /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/images/image.srec

3) Extracting .bss
In method 2 in which the .elf file was created a variable $(ADR) is used. $(ADR) is set with: BSS=`microblaze-uclinux-objdump --headers /home/cv/petalinux-v0.20-rc3/software/petalinux-dist/linux-2.6.x/linux | \
       grep "\.bss"` ; \
ADDR=`set -- ${BSS} ; echo 0x${5}` ; \

The microblaze-uclinux-objdump on "linux" shows:
27 .init.ramfs   0000008c  2015d000  2015d000  00159815  2**0
                 CONTENTS, ALLOC, LOAD, DATA
28 .bss          00012d08  2015e000  2015e000  001598a1  2**4
                 ALLOC
29 .stab         00001218  00000000  00000000  001598a4  2**2

So the microblaze-uclinux-objcopy is instructed to offset the .romfs section to 0x2015e000 although the binary image physically is located at 0x2015d08c.

The microblaze-uclinux-objdump on "image.elf" shows:
29 .stab         00001218  00000000  00000000  001598a4  2**2
                 CONTENTS, READONLY, DEBUGGING
30 .stabstr      000009f9  00000000  00000000  0015aabc  2**0
                 CONTENTS, READONLY, DEBUGGING
31 .romfs        000ef000  2015e000  2015e000  0015b4b5  2**0
                 CONTENTS, ALLOC, LOAD, DATA

I hope this will be of help to enhance the Petalinux distribution

Best regards, Cor



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/