Skip to contentSkip to conversation

trouble to build u-boot.bin with objcopy

U-Boot-Users valerian NA 2 participants 2 messages Jun 18, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

I work with a linux cross-compiler (codesourcery with gcc 4.2.3) for embedded powerpc targets (mpc8248).
So I tried to compile u-boot (version 1.1.6). It works fine with another and older version of gcc (3.3.2) but with the new cross-compiler (4.2.3) I have trouble to do this part :
powerpc-linux-gnu-objcopy --gap-fill 0xff -O binary u-boot u-boot.bin

This command freezes and uses a lot of memory without sucess (maybe I have not enough disk space).

I decided to launch without "--gap-fill" to see the reaction :
powerpc-linux-gnu-objcopy -O binary u-boot u-boot.bin
It creates u-boot.bin file, and the system (host ls -al) tells that this file has a size nearest to 4GiB

So I think it's a problem in the mapping of u-boot :
powerpc-linux-gnu-objdump -h u-boot

u-boot: file format elf32-powerpc

Sections:

Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00017e18  fc000000  fc000000  00002138  2**2

CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .reloc 00000804 fc018000 fc018000 0001a138 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .data 00001060 fc018804 fc018804 0001a93c 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .data.rel.ro.local 0000003c fc019864 fc019864 0001b99c 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .data.rel 0000003c fc0198a0 fc0198a0 0001b9d8 2**2
CONTENTS, ALLOC, LOAD, DATA
5 .data.rel.local 00000634 fc0198dc fc0198dc 0001ba14 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .ppcenv 00000200 fc019f10 fc019f10 0001c048 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .u_boot_cmd 000000dc fc01a110 fc01a110 0001c248 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .bss 00001bf8 fc01b000 fc01b000 0001d138 2**3
ALLOC
9 .debug_line 0000607d 00000000 00000000 0001d138 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_info 00027d84 00000000 00000000 000231b5 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_abbrev 00005254 00000000 00000000 0004af39 2**0
CONTENTS, READONLY, DEBUGGING
12 .debug_aranges 00000660 00000000 00000000 00050190 2**3
CONTENTS, READONLY, DEBUGGING
13 .rodata.str1.1 0000209e 00000660 00000660 00000094 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
14 .debug_frame 000026cc 00000000 00000000 000507f0 2**2
CONTENTS, READONLY, DEBUGGING
15 .debug_loc 0000c9c7 00000000 00000000 00052ebc 2**0
CONTENTS, READONLY, DEBUGGING
16 .debug_pubnames 000016b1 00000000 00000000 0005f883 2**0
CONTENTS, READONLY, DEBUGGING
17 .debug_str 000043d5 00000000 00000000 00060f34 2**0
CONTENTS, READONLY, DEBUGGING
18 .comment 000006d6 00000000 00000000 00065309 2**0
CONTENTS, READONLY
19 .note.GNU-stack 00000000 00000000 00000000 000659df 2**0
CONTENTS, READONLY
20 .gnu.attributes 00000384 00000000 00000000 000659df 2**0
CONTENTS, READONLY
21 .debug_ranges 00000f60 00000000 00000000 00065d63 2**0
CONTENTS, READONLY, DEBUGGING

Just a command to show you how objs are compiled :
powerpc-linux-gnu-gcc -g -Os -fPIC -ffixed-r14 -meabi -D__KERNEL__
-DTEXT_BASE=0xFC000000 -I/a/good/path/to/include2 -I/a/good/path/to/include -I/a/good/path/to/include -fno-builtin -ffreestanding -nostdinc -isystem/usr/freescale-gcc-4.2.3/bin/../lib/gcc/powerpc-linux-gnu/4.2.3/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 -ffixed-r29 -mstring -mcpu=603e -mmultiple -Wall -Wstrict-prototypes -c -o /a/good/path/to/common/cmd_mac.o cmd_mac.c

And another command to see how u-boot is built :
powerpc-linux-gnu-ld -Bstatic -T /a/good/path/to/a/u-boot.lds -Ttext 0xFC000000 -n $UNDEF_SYM cpu/mpc8260/start.o \
--start-group lib_generic/libgeneric.a
board/rmp100/librmp100.a cpu/mpc8260/libmpc8260.a lib_ppc/libppc.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a rtc/librtc.a dtt/libdtt.a drivers/libdrivers.a drivers/nand/libnand.a drivers/nand_legacy/libnand_legacy.a drivers/sk98lin/libsk98lin.a post/libpost.a post/cpu/libcpu.a common/libcommon.a --end-group -L /usr/freescale-gcc-4.2.3/bin/../lib/gcc/powerpc-linux-gnu/4.2.3 -lgcc \
-Map u-boot.map -o u-boot

If I do it with .a files compiled with gcc3 and after I do objcopy it works but if I do it with .a files compiled with gcc4 it freezes.

NB :
- with gcc3, u-boot.bin has a size of 121KiB
- UNDEF_SYM=
-u__u_boot_cmd_autoscr -u__u_boot_cmd_bootm -u__u_boot_cmd_diskboot -u__u_boot_cmd_end -u__u_boot_cmd_go -u__u_boot_cmd_help -u__u_boot_cmd_ide -u__u_boot_cmd_printenv -u__u_boot_cmd_question_mark -u__u_boot_cmd_reset -u__u_boot_cmd_setenv -u__u_boot_cmd_start -u__u_boot_cmd_version
- I know u-boot 1.1.6 is an older version but I have to use it not another

Thanks a lot for your attention and your futurs ideas...

Val.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080618/22ef2ce8/attachment.htm

#1 lore raw
Quoted 11 lines · valerian NA

Hi all,

I work with a linux cross-compiler (codesourcery with gcc 4.2.3) for embedded powerpc targets (mpc8248).
So I tried to compile u-boot (version 1.1.6). It works fine with another and older version of gcc (3.3.2) but with the new cross-compiler (4.2.3) I have trouble to do this part :
powerpc-linux-gnu-objcopy --gap-fill 0xff -O binary u-boot u-boot.bin

This command freezes and uses a lot of memory without sucess (maybe I have not enough disk space).

Symptom of an inadvertent *large* gap in your "LOAD" sections.

Quoted 30 lines

I decided to launch without "--gap-fill" to see the reaction :
powerpc-linux-gnu-objcopy -O binary u-boot u-boot.bin
It creates u-boot.bin file, and the system (host ls -al) tells that this file has a size nearest to 4GiB

So I think it's a problem in the mapping of u-boot :
powerpc-linux-gnu-objdump -h u-boot

u-boot: file format elf32-powerpc

Sections:

Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00017e18  fc000000  fc000000  00002138  2**2

CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .reloc 00000804 fc018000 fc018000 0001a138 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .data 00001060 fc018804 fc018804 0001a93c 2**2
CONTENTS, ALLOC, LOAD, DATA
3 .data.rel.ro.local 0000003c fc019864 fc019864 0001b99c 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .data.rel 0000003c fc0198a0 fc0198a0 0001b9d8 2**2
CONTENTS, ALLOC, LOAD, DATA
5 .data.rel.local 00000634 fc0198dc fc0198dc 0001ba14 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .ppcenv 00000200 fc019f10 fc019f10 0001c048 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .u_boot_cmd 000000dc fc01a110 fc01a110 0001c248 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .bss 00001bf8 fc01b000 fc01b000 0001d138 2**3
ALLOC

[snip]

Quoted 2 lines

13 .rodata.str1.1 0000209e 00000660 00000660 00000094 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA

What is .rodata.str1.1? Is it new to gcc 4.2.3? It is being located at the start of memory where all the rest of your "LOAD" sections are at the end of memory. The result: 4GB binary images. You need to locate this is a better location (close to the rest of the "LOAD" sections).

[snip]

Quoted 3 lines

Thanks a lot for your attention and your futurs ideas...

Val.

HTH,
gvb