I'm following this tutorial on writing "bare metal" code for the Raspberry Pi 4. I've gotten the code working fine, but I'm left wondering how I could have figured any of this stuff out for my own. The basic process I'm following is to compile my code into a file called kernel8.img
, put that on an SD card formatted in a certain way with a bunch of other files, and then plug that in and power on the Pi.
Where is the documentation that would tell me to do all this? I found this, which is a good start, but when it comes to how it loads data off the SD card it just says:
else if boot-mode == SD CARD
Attempt to load firmware from the SD card
Success - run the firmware
Failure - continue
Clearly a lot is being left out - there's no mention of the need to name a file kernel8.img
, no mention that the SD card needs to be formatted in fat32 (or at least the card I bought is), what flags need to be set on the partition, etc.
Where can I find actual detailed documentation on the boot sequence, and what protocols I need to follow to run my code on a Pi 4?