2

on the final stage of the boot process of raspberry. The start.elf loads kernel.img which is the binary file containing the OS kernel and releases the reset on the CPU.

I have two questions

1 does the kernel.img file loaded to physical @0x00000000 or 0x00008000, because i read somewhere that the entry point is located at address 0x00008000,

2 when the entry point specified by the linker script is different then 0x00000000, for example 0x00008000, what happened to the space between 0x0000000 and the entry point (0x00008000) in the binary file kernel.img, does the file include this space on it's size?, and does it copied to the RAM at 0x00000000 address?

2 Answers 2

2

The area 0x0-0x8000 is reserved for special purposes, like passing ATAGS and the kernel command line etc. from the bootloader. It does not occupy space on disk (there is a hole in the image).

6
  • 1
    sorry but i dont get this concept of a hole?? how can a file have a hole??
    – makouda
    Jan 1, 2015 at 19:30
  • The image is loaded to 0x8000. With the linker script you specify where data are to be loaded, thus the space between the end of one linker script section and the beginning of next may become "a hole". Jan 1, 2015 at 19:46
  • sorry but i noticed when i put sections in different addresses, the resulting binary file become really bigger, so the hole between sections is included in the image size. but between the @0 and 0x8000, no more space is occupied, what's the difference??
    – makouda
    Jan 1, 2015 at 20:37
  • 1
    It is possible to specify with the linker script what to do with the holes. You can tell ld not "fill" the holes (usually with 0x00 or 0xff) but instead discard them. If the image begins with a hole ld likely discards it automatically (although haven't verified it). It's all in the ld manual. :) Jan 1, 2015 at 21:10
  • 1
    Use the Source, Luke Sep 10, 2015 at 12:18
0

although it's a very old question, let me update it in case some one come here.

does the kernel.img file loaded to physical @0x00000000 or 0x00008000, because i read somewhere that the entry point is located at address 0x00008000,

actually, it depends on what SoC you're using. for a 32bit raspberry pi(bcm2835, the first generation raspberry pi), the boot address is 0x8000 default. according the offical doc, you can change it to any position by set the kernel_address in config.txt. can refer here https://www.raspberrypi.com/documentation/computers/config_txt.html#kernel_address. however, you never know why it is 0x8000 except guessing. because the firmware(start.elf) is NOT open source.

what happened to the space between 0x0000000 and the entry point (0x00008000) in the binary file kernel.img

afaik, the absolute address used by some instructions like jmp will be changed.

does the file include this space on it's size?

no, kernel.img is a binary file, rpi firmware loads it in 0x8000. you can disassemble the binary to confirm it, there is no hole.

arm-none-eabi-objdump -D -bbinary -marm kernel.img

does it copied to the RAM at 0x00000000 address?

no by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.