Raspberry Pi 4 Model B

Serial connection

Serial TX and RX are located at GPIO pins 14 and 15 respectively.


In order to build U-Boot for the Raspberry Pi 4B, run the following commands:

git clone https://github.com/u-boot/u-boot.git u-boot
cd u-boot
make CROSS_COMPILE=aarch64-linux-gnu- rpi_4_defconfig
make CROSS_COMPILE=aarch64-linux-gnu-

In the u-boot directory you should now see the U-Boot image u-boot.bin indicating that U-Boot has successfully compiled.

More information regarding U-Boot support for the Raspberry Pi can be found here.

SD card setup

The RPi4 boots from the first FAT32 partition on the microSD card. Where files are specified, they should be located in the root directory of this partition.

Stage Filename Description Source
FSBL - Mounts SD and loads SSBL ROM
GPU firmware start4.elf Loads CPU bootloader and boots CPU https://github.com/raspberrypi/firmware/tree/master/boot/start4.elf
Additional GPU firmware fixup4.dat Fixes memory locations used in start4.elf https://github.com/raspberrypi/firmware/tree/master/boot/fixup4.dat
Usually the Linux kernel, but could also be U-Boot u-boot.bin U-Boot binary Compiled using the instructions above
  config.txt U-Boot parameters Add arm_64bit=1 and kernel=u-boot.bin to the bottom of config.txt
  uboot.env U-Boot saved environment Generated by U-Boot (default environment) bootcmd copied to bootcmd_orig bootcmd and bootdelay removed. This file will not exist when you first setup your SD card.
  bcm2711-rpi-4-b.dtb RPi4 device tree blob https://github.com/raspberrypi/firmware/tree/master/boot/bcm2711-rpi-4-b.dtb
  overlays/* Device tree overlays https://github.com/raspberrypi/firmware/tree/master/boot/overlays

Getting seL4 onto your Raspberry Pi 4

The final step to test that you have setup your RPi4 correctly is to build and run the seL4test project.

You will see that the init-build.sh command contains the flag -DRPI4_MEMORY, this specifies how much RAM exists on the Raspberry Pi that will run the final seL4 image. Since seL4 needs to know the physical memory layout of the hardware at build time, and the RPi4 has multiple models with different amounts of RAM, we have to specify how much RAM the system will have when we build seL4. If -DRPI4_MEMORY is not supplied, seL4 defaults to expecting 8GB of memory.

Checkout the sel4test project using repo as per seL4Test

repo init -u https://github.com/seL4/sel4test-manifest.git
repo sync
mkdir cbuild
cd cbuild
../init-build.sh -DPLATFORM=rpi4 -DAARCH64=1 -DRPI4_MEMORY=<1024,2048,4096,8192>
# The default cmake wrapper sets up a default configuration for the target platform.
# To change individual settings, run `ccmake` and change the configuration
# parameters to suit your needs.

Generated binaries can be found in the images/ directory.

Now that we have a bootable image, we can run it on your RPi4. The following instructions describe how to use a microSD card to boot seL4, using the seL4test image as well as the files mentioned in the previous section.

The first step is to copy the seL4 image onto the microSD card to the root directory. After removing the card from your computer and inserting into your RPi4, you can power on the RPi4.

Once the RPi4 boots up, you will see something like the following text from U-Boot:

Hit any key to stop autoboot:  2

At this point you want to interrupt the U-Boot booting process by pressing any key.

You will now be in the U-Boot command prompt, type the following command:

fatls mmc 0

You should see the seL4test image you just placed on your microSD card.

From here, you can load and boot the image using:

fatload mmc 0 0x10000000 sel4test-driver-image-arm-bcm2711
go 0x10000000