How to load Linux image to match memory location

We are trying to load a Linux image into our DRAM at a specific location, the final DRAM address is 0x80000000, which we learn from the boot log, which says that the final address of mem device is 0x80000000. We load our image at the address "0x5000000", and before this variuos section in the image is loaded at some address that is larger than "0x80000000" to restart from the download logs

 loading section to address 0xc5000000 from file position 0x1000, size is 0x5ac13e

Which means "from file position 0x1000" in the above line.

the first section that loads the .text, below is our dump of the vmlinux image of the section header

[Nr]      Name           Type            Addr     Off    Size   ES Flg Lk Inf Al

[ 0]                     NULL            00000000 000000 000000 00      0   0  0

 [ 1]   .text            PROGBITS        c5000000 001000 5ac13e 00  AX  0   0 4096

 [ 2]      .notes           NOTE            c55ac140 5ad140 000168 00  AX  0   0  4

 [ 3]    __ex_table        PROGBITS        c55ac2b0 5ad2b0 000fe0 00   A  0   0  4

 [ 4]   .rodata           PROGBITS        c55ae000 5af000 20a930 00   A  0   0 64

 [ 5]   __bug_table       PROGBITS        c57b8930 7b9930 0075fc 00   A  0   0  1

 [ 6]   .pci_fixup        PROGBITS        c57bff2c 7c0f2c 001a90 00   A  0   0  4

 [ 7]    .builtin_fw       PROGBITS        c57c19bc 7c29bc 0000cc 00   A  0   0  4

, . . .text DRAM, , , .

    program load complete, entry point: 0x5000000, size: 0x92e7fc

: DRAM-, objcopy .

? -, Hang afer.

+5
3

from file position 0x1000 , . :

[Nr]      Name           Type            Addr     Off    Size   ES Flg Lk Inf Al
...
[ 1]   .text            PROGBITS        c5000000 001000 5ac13e 00  AX  0   0 4096

, .text , 0x1000.

.text- DRAM

, ( , ), , 0xc5000000 .

, ,

, .

OTOH, loading section to address 0xc5000000 , , , 0x7fffffff.

.

. , , , , . , , ? Garbage.

?

:

  • , 0xc5000000 0x5000000
  • script, , 0xc5000000 0x5000000, Google, . /.

, , 0x5000000. , , . , start ( _start - ) , .text. - , - , script, / .

+6

? ""? U- , , vmlinux ELF? , .. ELF , , , . , Linux OpenRISC ( readelf -l):

Elf file type is EXEC (Executable file)
Entry point 0xc0000000
There are 2 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x002000 0xc0000000 0x00000000 0x231728 0x232000 RWE 0x2000
  LOAD           0x234000 0xc0232000 0x00232000 0x17c78c 0x18bfcc RWE 0x2000

 Section to Segment mapping:
  Segment Sections...
   00     .text .rodata __ksymtab __ksymtab_gpl __ksymtab_strings __param __modver 
   01     .data __ex_table .head.text .init.text .init.data .bss 

. VirtAddr PhysAddr ( c - Linux). , .

, .., , MMU , .

, , . , , script. arch/(your arch)/kernel/vmlinux.lds.S. , IMO , , , .

+3

Check your arch / arm / mach-xxx / Makefile.boot (do you use the right hand)?

  zreladdr-y        += 0x80008000
params_phys-y       := 0x80000100
initrd_phys-y       := 0x80800000

This is from Ti omap3 chip.

I think you will need the same

+1
source

All Articles