Today I measured boot loader times in different configurations. Because this may be interested to somebody else I am posting my results here...
The idea behind this test is to write bare metal programs for Internet of Things which can boot very fast and can be used in different cases - for example for a lawn mower which can not wait 30 seconds to boot before it can be used...
What did I measure?
I measured the time the Raspberry Pi needs to boot: from power on until it can send the first byte over serial port.
Tested computer:
- Raspberry Pi Model A (Revision 2)
- Latest Raspberry Pi firmware (downloaded today, August 17, 2014 from https://github.com/raspberrypi/firmware ... aster/boot)
- Default settings (config.txt has only start_file and fixup_file settings to choose the desired firmware ELF file and gpu_mem=16 setting in case of start_cd.elf)
- tested with SD Cards:
1) GoodRAM MicroSDHC, Class 10, 8 GB
2) Samsung MicroSD, 2 GB (older card, can't find class information, part number is: MMAGR02GUECA-MB)
How did I measure it?
I used another Raspberry Pi which turns the tested RPi on with Sainsmart Relay and then waits until the first byte is received over UART serial port (both RPis were cross connected over UART).
What configurations did I use?
As you know the Raspberry Pi boots in several stages:
1) First stage bootloader: stored in ROM and runned by GPU (you can not change this part)
2) Second stage bootloader (part of RPi firmware): bootcode.bin file on SD card, runned by GPU from L2 cache
3) Third stage bootloader (part of RPi firmware): start.elf or start_cd.elf or start_x.elf file on SD card, runned by GPU from RAM
4) Kernel: kernel.img file on SD card, runned by ARM CPU from RAM (this is usually operating system kernel)
Boot configurations:
A) Herman H Hermitage uart01 second stage bootloader (GPU bootloader bootcode.bin, see: https://github.com/hermanhermitage/vide ... ter/uart01)
This configuration involves only stages 1 and 2 and completely bypasses RPi firmware...
B) Raspberry Pi firmware start_cd.elf + dwelch67 uart02 kernel.img (ARM, see: https://github.com/dwelch67/raspberrypi ... ter/uart02)
(Stages 1, 2, 3 and 4)
Contents of config.txt:
gpu_mem=16
start_file=start_cd.elf
fixup_file=fixup_cd.dat
C) Raspberry Pi firmware start.elf + dwelch67 uart02 kernel.img (no config.txt file, stages 1, 2, 3 and 4)
D) Raspberry Pi firmware start.elf + dwelch67 uart02 kernel.img + minimal config.txt file (stages 1, 2, 3 and 4)
Contents of config.txt:
start_file=start.elf
fixup_file=fixup.dat
E) Raspberry Pi firmware start_x.elf + dwelch67 uart02 kernel.img + minimal config.txt file (stages 1, 2, 3 and 4)
Contents of config.txt:
start_file=start_x.elf
fixup_file=fixup_x.dat
(Regarding dwelch67 uart02: I wanted to use uart01, but uart02 was already precompiled and it outputs 12345678 on UART before everything else...


I measured everything 10 times and runned garbage collection before every measurement so it didn't affect the result times.
How fast you can boot your Raspberry Pi?
Raspberry Pi Boot Times for different configurations (SD Card: GoodRAM MicroSDHC, Class 10, 8 GB):
Configuration A ... 234 ms
Configuration B ... 1011 ms
Configuration C ... 1409 ms
Configuration D ... 1407 ms
Configuration E ... 1534 ms
Raspberry Pi Boot Times for different configurations (SD Card: older Samsung MicroSD, 2 GB):
Configuration A ... 404 ms
Configuration B ... 1046 ms
Configuration C ... 1479 ms
Configuration D ... 1480 ms
Configuration E ... 1545 ms
Yes, configuration D may even be faster than configuration C: if you provide minimal config.txt than booting may be slightly faster but not always...
If you want to boot in less than 250 ms, then you have to write your own bootloader.bin which will run on GPU in L2 cache. If you are OK with 1 second boot time, then you don't have to bother with GPU and write only ARM code...
Question for the Raspberry Pi Foundation: Would it be possible to get "start_min.elf" (or even "bootloader_min.bin") which would only initialize RAM and ARM CPU, load kernel.img and start running ARM? This could get us bellow 400 ms boot time which would be great for Internet of Things devices and competition with Arduino community...



So much for now...
Marko Krajnc