Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I have a raspberry mini computer and I am wondering how that thing does whole the boot process. I can compile my own kernel and init ramdisk with my own scripts and build my own minimal linux system on PC, but for that I need to use some bootloader. Raspberry doesn't seem to support bootloaders at all.

It seems to somehow boot up using its GPU which reads some partition on SD card (probably that one with bootable flag) that needs to be formatted in FAT32, then it reads some files from there, which are provided, for example by raspbian.

But how would I boot up my own kernel, with my own customizations that I compiled myself? Where should I copy the kernel image / initrd (ram disk) so that raspberry find it and boot from it? I am basically looking for some very detailed technical documentation that describes the boot process on raspberry or just some explanation of this.

share|improve this question

migrated from stackoverflow.com Nov 2 '13 at 17:00

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 17 down vote accepted

From this Raspberry Pi forum post:

  1. When the Raspberry Pi is first turned on, the ARM core is off, and the GPU core is on. At this point the SDRAM is disabled.
  2. The GPU starts executing the first stage bootloader, which is stored in ROM on the SoC. The first stage bootloader reads the SD card, and loads the second stage bootloader (bootcode.bin) into the L2 cache, and runs it.
  3. bootcode.bin enables SDRAM, and reads the third stage bootloader (loader.bin) from the SD card into RAM, and runs it.
  4. loader.bin reads the GPU firmware (start.elf).
  5. start.elf reads config.txt, cmdline.txt and kernel.img

loader.bin doesn't do much. It can handle .elf files, and so is needed to load start.elf at the top of memory (ARM uses SDRAM from address zero). There is a plan to add elf loading support to bootcode.bin, which would make loader.bin unnecessary, but it's a low priority (I guess it might save you 100ms on boot).

Here are some resources that could be helpful:

share|improve this answer
    
Is that content of these bin files all proprietary software? –  Petr Nov 2 '13 at 17:25
1  
@Petr Here is the Github for the Raspberry Pi firmware, I'll edit it into my answer. –  syb0rg Nov 2 '13 at 17:28
    
also is there any way to make start.elf read an initrd instead of directly booting the kernel? That means, could I create a ram disk which the system boot from, so that I could for example contain my system on entirely different device than SD card (the OS could be living even on some RAID / LVM storage which would need to be initialised first using a script in initrd) –  Petr Nov 2 '13 at 17:29
    
On the Raspberry Pi FAQ's, it says "You have to boot from SD but a USB HD can “take over” after the initial boot. You cannot boot without an SD card." –  syb0rg Nov 2 '13 at 17:32
    
Is that parition, which is read first, any partition with B flag or it must be first partition? What if I made it too large and I wanted to create another one on end of SD card which would be smaller –  Petr Nov 3 '13 at 12:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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