Several references exist that document how to run seL4 on the Raspberry Pi 3 in 32-bit mode. One annoying paper cut encountered when getting this working is the need for a custom u-boot - either a binary distributed by the authors of seL4, or reverting a particular commit in u-boot.
A recent release of seL4 mentioned AArch64 support for RPi3. I’ve got it running, and it appears to avoid the need for a custom u-boot. (N.B. you still need a GPIO serial cable!)
I started with a stock Raspbian Lite image to get a known-good filesystem (with start.elf and bootcode.bin), then added u-boot and seL4 on top.
After installing the appropriate toolchain, seL4test can be configured and built almost as normal:
mkdir sel4test && cd sel4test repo init -u https://github.com/seL4/sel4test-manifest.git repo sync mkdir build-rpi3 && cd build-rpi3 # Note AARCH64 here ./init-build.sh -DPLATFORM=rpi3 -DAARCH64=1 ninja
build-rpi3/images/sel4test-driver-image-arm-bcm2837 to the SD
U-Boot was compiled approximately as per https://a-delacruz.github.io/ubuntu/rpi3-setup-64bit-uboot.html - I chose to use the latest stable release tag,
make CROSS_COMPILE=aarch64-linux-gnu- rpi_3_defconfig make -j -s CROSS_COMPILE=aarch64-linux-gnu-
u-boot.bin to the SD card.
config.txt to add:
enable_uart=1 kernel=u-boot.bin # Enable 64 bit mode arm_control=0x200
Additionally I add a
boot.scr file that automates loading and
booting the image. First create
boot.txt with the commands from the seL4 RPi3 support page:
fatload mmc 0 0x10000000 sel4test-driver-image-arm-bcm2837 bootelf 0x10000000
Then use mkimage from the u-boot source tree:
mkimage -A arm -O linux -T script -C none -n boot.scr -d boot.txt boot.scr
boot.scr to the SD card.
If all is well, your serial output should show the test suite running to a reassuring conclusion:
U-Boot 2020.04 (May 11 2020 - 22:37:52 +0100) DRAM: 948 MiB RPI 3 Model B (0xa02082) MMC: [email protected]: 0, [email protected]: 1 Loading Environment from FAT... *** Warning - bad CRC, using default environment In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. starting USB... Bus [email protected]: scanning bus [email protected] for devices... 3 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found U-Boot script /boot.scr 151 bytes read in 5 ms (29.3 KiB/s) ## Executing script at 02400000 3199560 bytes read in 141 ms (21.6 MiB/s) ## Starting application at 0x00901000 ... ELF-loader started on CPU: ARM Ltd. Cortex-A53 r0p4 paddr=[901000..c090f7] No DTB passed in from boot loader. Looking for DTB in CPIO archive...found at a235c0. Loaded DTB from a235c0. paddr=[238000..23bfff] ELF-loading image 'kernel' paddr=[0..237fff] vaddr=[ffffff8000000000..ffffff8000237fff] virt_entry=ffffff8000000000 ELF-loading image 'sel4test-driver' paddr=[23c000..502fff] vaddr=[400000..6c6fff] virt_entry=40ecf8 Enabling MMU and paging Jumping to kernel-image entry point... [...snip test output...] Test suite passed. 128 tests passed. 41 tests disabled. All is well in the universe