FreeBSD on Raspberry Pi 5

Published

Read first, do later. Use at your own risk!

Goal

We want to run FreeBSD 15.0 on a Raspberry Pi 5 with a Raspberry Pi M.2 HAT+ and an 256GB Integral M.2 SSD

The system should boot from the nvme ssd.

Work done by others

We found various resources on this subject. However, non seemed to have a complete howto which can be used by an inexperienced user.

A list of resources that we used:

Prerequisites

This is the list of items that we used. This works, other stuff could also work. We assume you use a Linux or UNIX like os to perform the creation of the sdcard and usb stick.

  • Raspberry Pi 5 8GB
  • Raspberry Pi M.2 HAT+
  • 256GB Integral M.2 NVMe SSD
  • Original Raspberry Pi USB-C Power adapter
  • Sandisk 32GB Max Endurance micro SD card
  • Usb stick, Corsair Survivor Stealth V2 64GB
  • Conceptronic ABBY12G USB Ethernet module, the on board ethernet does not seem to work.

What we did

Get FreeBSD from https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/15.0/ and pick FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img.xz.

Extract this with: xz -d FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img.xz

Write this to the sdcard. You can use dd for this. For example: dd if=FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img of=/dev/sdX bs=1M conv=sync status=progress

You also need UEFI. This will be written to a usb stick. Get it from https://github.com/worproject/rpi5-uefi

Pick the latest release, RPi5_UEFI_Release_v0.3.zip

Format the usb stick so it contains just one FAT32 partition.

Extract the contents of rpi5-uefi and write the 3 files to the usb stick.

Make sure you've physically installed the M2 hat correctly, including the nvme drive.

Make sure the nvme has no bootable system on it, otherwise the rpi will just boot this. You could do a dd if=/dev/zero of=/dev/nvmeXnY to destroy the current content of the nvme.

Plugin a usb ethernet dongle.

Plugin the usb stick.

Plugin the sdcard.

Plugin a hdmi cable.

Plugin a usb keyboard.

Plugin power to boot the rpi5.

Press escape to enter uefi. In the boot menu, select the sdcard to boot from.

Now FreeBSD should boot correctly from the sdcard.

Login with user root and password root.

To get the latest updates for the system, run: freebsd-update fetch

To install them, run: freebsd-update install

To be able to install pkg, the time setting should be correct.

Set time (in UTC) with: date 2602051054.00

Sync with timeserver with: service ntpd onestart

You might need to repeat setting the time again after power off. We have not tested the Raspberry Pi RTC battery.

Install pkg by running: pkg

It will offer you to install the pkg package.

Install wget: pkg install wget

Download the same file as you wrote to the sdcard: wget https://download.freebsd.org/releases/arm64/aarch64/ISO-IMAGES/15.0/FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img.xz

extract with: xz -d FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img.xz

write to nvme with: dd if=FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img of=/dev/nda0 bs=1M conv=sync status=progress

Just to be sure: sync

Shutdown: halt

Power off and remove the sdcard.

Power on.

Now the system should boot from nvme!

Now it is time to get rid of the usb stick.

Download the rpi5-uefi files again with: wget https://github.com/worproject/rpi5-uefi/releases/download/v0.3/RPi5_UEFI_Release_v0.3.zip

Extract with: unzip RPi5_UEFI_Release_v0.3.zip

Copy the 3 files to /boot/efi/

Shutdown with: halt

Power off

Power on

Grow the fs to use the entire nvme: growfs /dev/ufs/rootfs

You are done!

Provide good cooling because fan does not seem to work.