Raspberry Pi / install

What to install on a Raspberry Pi with FreeBSD 15.1

The whole list in one place: what a fresh FreeBSD 15.1 card needs, which driver goes on which board, the commands for each, and a script that does the public part in one go.

A green Raspberry Pi board with a small raspberry imp sitting on the SD card slot.

1. The base system

After the card is written and the board boots (Raspberry Pi basics; without a network, log in over the serial console), as root:

passwd                      # root
passwd freebsd
sysrc ntpd_enable=YES ntpd_sync_on_start=YES
service ntpd start

None of the three test boards kept the right time across a power cut; with a clock in the past, make skips rebuilding modules that look newer than their sources.

config.txt

The Raspberry Pi firmware reads config.txt from the FAT partition of the card, mounted at /boot/msdos. Any computer can edit it with the card in a reader, which is the way back when a change stops the boot.

Pi 4 and Zero 2 W, as the FreeBSD 15.1 image writes it (read from the test Zero 2 W):

[all]
arm_64bit=1
dtparam=audio=on,i2c_arm=on,spi=on
dtoverlay=disable-bt
device_tree_address=0x4000
kernel=u-boot.bin

[pi4]
hdmi_safe=1
armstub=armstub8-gic.bin
  • dtoverlay=disable-bt puts the PL011 UART on header pins 8 and 10: that is the serial console. Keep it.
  • dtparam=audio=on is needed for sound on the Pi 4.
  • Zero 2 W: the file must not contain dtoverlay=mmc. That overlay switches the Wi-Fi bus off; install.sh warns about it.
  • Lines for a screen (hdmi_*) can follow in a second [all] block; the test Zero has its own 1024x600 mode there.

Pi 5, booted through the UEFI firmware (v0.3 on the test board; the same file is at /boot/efi/config.txt):

armstub=RPI_EFI.fd
device_tree_address=0x1f0000
device_tree_end=0x210000
framebuffer_depth=32
disable_overscan=1
usb_max_current_enable=1
force_turbo=1
enable_uart=1
dtparam=uart0_console
  • enable_uart=1 and dtparam=uart0_console give the console on the 3-pin UART connector.
  • No line is needed for Wi-Fi or the fan.

The Pi 4's own file was not read for this page (the board was offline); it uses the same image file, so the [pi4] block above applies.

Kernel sources

Drivers built on the board need the kernel sources. Only usr/src/sys is used:

fetch https://download.freebsd.org/releases/arm64/aarch64/15.1-RELEASE/src.txz
tar -C / -xf src.txz usr/src/sys

On a Pi 4 build with one job (make, not make -j4): a sagging power supply once killed the compiler there with "illegal instruction".

2. Which driver goes on which board

DriverPi 5Pi 4Zero 2 WRepositoryPage
cywfm Wi-Fiyesyesyesfreebsd-rpi-wifiWi-Fi
rp1fan fanyesn/an/afreebsd-rpi-fanFan
vchiq, bcm2835_audio soundn/ayesnot triedfreebsd-rpi-audioSound
ng_h4 and tools, Bluetoothblockedbuilt, power line onlysimulator onlyfreebsd-rpi-btBluetooth
rpitempworksbuiltworksfreebsd-rpi-socSoC
rpifreq, rpiwdog, rpirngworksn/an/afreebsd-rpi-socSoC
rpipowern/abuiltworksfreebsd-rpi-socSoC
rp1 and its childrenGPIO, Ethernet, PWM1 work; UART, I2C, SPI transmit onlyn/an/afreebsd-rpi-rp1RP1

For daily use on a board today: Wi-Fi everywhere, plus the fan on a Pi 5. The rest is for testing and reports.

3. The commands, driver by driver

Wi-Fi (cywfm), from a checkout of spagu/freebsd-rpi-wifi:

make install-firmware        # Zero 2 W: tools/fetch-firmware.sh -i -c 43436s
                             # Pi 5:     tools/fetch-firmware.sh -i -b raspberrypi,5-model-b
make module
make install                 # /boot/modules, kldxref, man page
sysrc kld_list+=cywfm wlans_cywfm0=wlan0 create_args_wlan0="country XX" ifconfig_wlan0="WPA DHCP"

Fan (rp1fan, Pi 5), from spagu/freebsd-rpi-fan:

make module
install -m 555 driver/rp1fan.ko /boot/modules/
sysrc kld_list+=rp1fan
kldload rp1fan

Sound (Pi 4), from spagu/freebsd-rpi-audio, with /usr/src/sys installed (make applies patches 0001 to 0004 to a copy and leaves SYSDIR unchanged):

make all SYSDIR=/usr/src/sys
kldload ./driver/vchiq/vchiq.ko ./driver/bcm2835_audio/bcm2835_audio.ko
sysctl dev.pcm.0.dest=1      # headphone jack

Bluetooth (Zero 2 W first), from spagu/freebsd-rpi-bt, with the radio's UART freed from the console:

make module tools
make install
sysrc rpibt_enable=YES
service rpibt start

SoC modules, from spagu/freebsd-rpi-soc:

make modules
kldload ./driver/rpitemp/rpitemp.ko && sysctl hw.rpitemp

The RP1 drivers (Pi 5), from spagu/freebsd-rpi-rp1: make modules, make install, make load; their page lists what runs on the board and what does not.

4. The public part in one script

works Run on 3 December 2026 on a Pi 4 Model B, a Pi 5 Model B and a Zero 2 W, all on FreeBSD 15.1-RELEASE-p7. Each run installed into a separate directory (DESTDIR), not into the live system, and the module installed matched the one already running on those boards byte for byte. The Pi 400 path (a build from source) has run only in the test suite.

What the script installs

BoardWi-Fi (cywfm)Fan (rp1fan)
Pi 4 Model Bprebuilt module and firmwaren/a
Pi 5 Model Bprebuilt module and firmwarebuilt on the board
Zero 2 Wprebuilt module and firmwaren/a
Pi 400built on the boardn/a

Sound, Bluetooth, the SoC modules and the RP1 drivers are not in it. Their pages list the build steps from each repository.

Requirements: FreeBSD 15.1 or newer on arm64, root, and a network connection (Ethernet or a serial console session with a cable plugged in). A build on the board also needs the kernel sources in /usr/src/sys; the prebuilt Wi-Fi path does not. Older FreeBSD versions are refused.

Run it

  1. Download the script and read it. It is plain sh, about 200 lines:

    fetch https://freebsd.tradik.com/install.sh
    less install.sh
    
  2. See what it would do without changing anything:

    sh install.sh -n
    
  3. Install, as root. With -e the modules are also added to kld_list in /etc/rc.conf, so they load at every boot:

    sh install.sh -e
    
  4. Load them and set up the network. The script prints the rc.conf lines at the end; the Wi-Fi page explains each one. Keep /etc/wpa_supplicant.conf at mode 0600.

    kldload cywfm
    

Options: -n dry run, -e load at boot, -b build Wi-Fi from source even when a prebuilt module exists, -d dir working directory (default /var/tmp/freebsd-tradik-install).

What it does, step by step

  1. Checks for FreeBSD 15.1 or newer, arm64 and root.
  2. Reads the board model: from the device tree on the Pi 4, Pi 400 and Zero 2 W, from SMBIOS on the Pi 5 (which boots through UEFI firmware). Any other board stops the script.
  3. Wi-Fi: looks up the newest release of spagu/freebsd-rpi-wifi built for the running FreeBSD version, downloads it, and checks the archive against SHA256SUMS and every file inside against its own list. On a Pi 5 the same firmware files are also installed under the Pi 5 names. Without a matching release, it downloads the source, builds cywfm.ko and fetches the firmware with the repository's tools/fetch-firmware.sh, which checks each file's SHA-256.
  4. Fan (Pi 5 only): downloads spagu/freebsd-rpi-fan and builds rp1fan.ko.
  5. Installs the modules into /boot/modules and the firmware into /boot/firmware, then runs kldxref. A module that is already there is kept as <name>.ko.bak.
  6. On a Zero 2 W, warns when config.txt still has dtoverlay=mmc, which switches the Wi-Fi bus off.

It does not touch wpa_supplicant.conf, passwords or network settings, and it loads nothing.

Undo

sysrc kld_list-="cywfm rp1fan"
rm /boot/modules/cywfm.ko /boot/modules/rp1fan.ko
kldxref /boot/modules

To go back to a previous module instead, rename <name>.ko.bak to <name>.ko. The firmware files in /boot/firmware are harmless when no driver uses them.

When it stops

MessageMeaning
needs FreeBSD 15.1 or newerUpgrade first; older releases are not supported.
board '...' is not supportedThe board is none of the four above. A board report helps add it.
checksum mismatchA download does not match its published SHA-256. Nothing was installed. Run it again; if it repeats, report it.
needs the kernel sources in /usr/src/sysA build is needed. Extract src.txz of the running release, or at least its usr/src/sys.
build failedThe last 20 lines of the build log are printed; the whole log is in the working directory.

Built with ssg