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?

  • Check out this question and the 2nd more recent answer which has a link for updated boot information for the PI 4. Commented Aug 16, 2023 at 18:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.