Creating a bootable SD Card

For the Bare Metal tutorials we need to be able to create an SD card with the minimal amount of fuss.

One of the easiest ways is to use a card you already have by simply renaming the kernel.img file to something like kernel-original.img and then copying your freshly compiled kernel-*.img file from the tutorials and naming it kernel.img. The bootloader will then load your new code and execute it.

The Rapsberry-Pi boot process consists of the Video-Core GPU setting various things up and then loading the a file from the first FAT partition of the SD Card call kernel.img to the RAM address 0x00008000 and changing the Program Counter of the ARM processor to execute at the same address, thus running your code.

To create a very basic card, you need to format the SD Card to the FAT file system. In Windows you simply right-click on the drive that has the SD Card in and pick format, and make sure FAT32 is selected from the format options.

Grab the latest Raspberry-Pi firmware from

As a minimum, you’ll have to copy the following to the SD Card along with your own code which must be in binary format and must be called kernel.img:

./boot/bootcode.bin and ./boot/start.elf

So you should end up with three files on your SD Card. This is enough to run the bare metal tutorials.


Leave a Reply