date = 2022-01-04
tags = ["freebsd", "raspberrypi"]
title = "FreeBSD on RPi 4"

FreeBSD on RPi 4

As of now, the prebuilt SD card image for RPI (3/4) of FreeBSD 13.0 doesn't run out of the box on RPi 4 due to

an issue with the bootloader

and requires replacing the bootloader binary on the SD card. If you have a Raspberry PI OS installation and want to try FreeBSD on RPi 4, you can follow these steps:

1. Download and flash

FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img.xz

to an SD card.

2. Build U-Boot from recent checkout. Ref:

https://u-boot.readthedocs.io/en/latest/build/index.html

# Install prerequisite packages
sudo apt-get install \
  gcc \
  gcc-aarch64-linux-gnu \
  bc bison build-essential \
  device-tree-compiler \
  dfu-util \
  efitools \
  flex

git clone https://source.denx.de/u-boot/u-boot.git
cd u-boot
git checkout v2021.04
make rpi_4_defconfig
CROSS_COMPILE=aarch64-linux-gnu- make -j4

3. Mount the boot partition of the SD card and copy u-boot.bin built from previous step.

sudo mount /dev/sda1 /mnt
sudo cp u-boot.bin /mnt/u-boot.bin
sudo umount /mnt

EDIT

The system booted this way recognizes only one CPU core out of the 4 cores available on the chip, for reason beyond my knowledge. So once booted, replace u-boot.bin on the SD card with the one from the sysutils/u-boot-rpi4 package, and then reboot.

pkg install sysutils/u-boot-rpi4
cp /usr/local/share/u-boot/u-boot-rpi4/u-boot.bin /boot/msdos/u-boot.bin

Refs:

current best practice to start FreeBSD / Raspberry Pi 4

arm/Raspberry Pi

Comments

Leave a comment