In the boot partition there are two kernels, kernel.img and kernel7.img (for the pi 1 vs 2/3). How does the system know which to load?
2 Answers
All the boot magic is in /boot/config.txt.
kernel: The alternative filename on the boot partition to use when loading the kernel; the default value is kernel.img.
Update: to clear up some confusion and to satisfy my curiosity, I tried the following small experiment.
I DO NOT RECOMMEND YOU TRY THIS!
- On my RPi3 I do not have the kernel entry in config.txt, and the system boots up fine.
- I deleted kernel.img.
- I renamed kernel7.img to foo.bar.
- After rebooting the RPi, the system failed to load. I got the multi-colour screen of death, as expected.
- I added kernel=foo.bar to my config.txt.
- Rebooted the system, and it worked.
This proves two things:
- The system can intelligently select the correct kernel per architecture, within some limits.
- The kernel entry in config.txt works if used.
- 357
- 2
- 13
See http://elinux.org/RPi_Software#Overview which describes the Pi boot process.
Basically bootcode.bin analyses the hardware and (presumably) decides which kernel to load. (The source is not publicly available).
It is (or was) possible to specify a different kernel, but this is NOT used by normal images.
NOTE With the new USB/Network boot options for the Pi3 the process has changed but the principle remains similar.
For those interested in reading more about the new boot options Raspberry Pi boot modes
- 62,573
- 32
- 113
- 225