# FreeBSD on Raspberry Pi

Every driver here is a loadable kernel module for a stock `GENERIC` arm64 kernel on FreeBSD 15.1-RELEASE. No kernel rebuild: build a `.ko`, drop it into `/boot/modules` and load it. All code is under the BSD 2-Clause licence.

<ul class="cards wide">
  <li class="card"><img src="/images/wifi.svg" alt="" width="320" height="240"><span class="badge badge-ok">works</span><h3><a href="/rpi/wifi/">Wi-Fi: cywfm</a></h3><p>On-board Wi-Fi for Pi 4, Pi 5 and Zero 2 W. Client, access point and monitor mode.</p></li>
  <li class="card"><img src="/images/fan.svg" alt="" width="320" height="240"><span class="badge badge-ok">works</span><h3><a href="/rpi/fan/">Fan: rp1fan</a></h3><p>Temperature-driven fan control for the official Pi 5 fan.</p></li>
  <li class="card"><img src="/images/audio.svg" alt="" width="320" height="240"><span class="badge badge-part">first sound</span><h3><a href="/rpi/audio/">Sound: vchiq + bcm2835_audio</a></h3><p>The 3.5 mm jack on the Pi 4 plays a melody. HDMI not tried yet.</p></li>
  <li class="card"><img src="/images/bluetooth.svg" alt="" width="320" height="240"><span class="badge badge-part">code done, radio silent</span><h3><a href="/rpi/bluetooth/">Bluetooth: ng_h4</a></h3><p>HCI over UART for the on-board radio. Works against a simulator, not yet against the chip.</p></li>
  <li class="card"><img src="/images/soc.svg" alt="" width="320" height="240"><span class="badge badge-plan">built, not loaded</span><h3><a href="/rpi/soc/">SoC: temperature, cpufreq, watchdog, RNG</a></h3><p>Four small modules for the Broadcom SoC functions FreeBSD misses on UEFI boot.</p></li>
  <li class="card"><img src="/images/rp1.svg" alt="" width="320" height="240"><span class="badge badge-plan">early code</span><h3><a href="/rpi/rp1/">RP1 I/O chip (Pi 5)</a></h3><p>GPIO first, then Ethernet, I2C, SPI, PWM and UART.</p></li>
</ul>

## What works on which board

<div class="table-scroll">

| Function | Pi 5 | Pi 4 | Zero 2 W | Module |
|---|---|---|---|---|
| Wi-Fi 2.4 GHz | <span class="badge badge-ok">works</span> | <span class="badge badge-ok">works</span> | <span class="badge badge-ok">works</span> | `cywfm` |
| Wi-Fi 5 GHz | <span class="badge badge-ok">works</span> | <span class="badge badge-ok">works</span> | no 5 GHz radio | `cywfm` |
| Fan control | <span class="badge badge-ok">works</span> | n/a | n/a | `rp1fan` |
| Analogue sound (jack) | out of scope | <span class="badge badge-part">first sound</span> | not tried | `vchiq`, `bcm2835_audio` |
| Bluetooth | blocked: no UART driver | <span class="badge badge-plan">built, never run</span> | <span class="badge badge-part">simulator only</span> | `ng_h4` |
| SoC temperature | <span class="badge badge-plan">built</span> | <span class="badge badge-plan">built</span> | <span class="badge badge-plan">built</span> | `rpitemp` |
| CPU frequency, watchdog, RNG | <span class="badge badge-plan">built</span> | n/a | n/a | `rpifreq`, `rpiwdog`, `rpirng` |
| GPIO via RP1 | <span class="badge badge-plan">early code</span> | n/a | n/a | `rp1`, `rp1gpio` |

</div>

Boards marked "expected to work" in the Wi-Fi docs (other Pi 4 revisions, Pi 400, CM4, Pi 3 B+ and 3 A+, CM5, Pi 500) have the right chip but nobody has tried them yet. For owners of those boards, a [board report](/rpi/wifi/#report-a-board) is the most useful contribution.

## Before starting: FreeBSD on the card

<ol class="steps">
<li>

Download the `FreeBSD-15.1-RELEASE-arm64-aarch64-RPI.img.xz` image from the FreeBSD download site.

</li>
<li>

Write it to the SD card. On FreeBSD:

```sh
xz -dc FreeBSD-15.1-RELEASE-arm64-aarch64-RPI.img.xz | dd of=/dev/da0 bs=1m conv=sync
```

Check the device name twice: `dd` does not ask.

</li>
<li>

Boot the board. Without Wi-Fi, Ethernet or a serial console is needed: pin 6 is GND, pin 8 TXD, pin 10 RXD, 115200 8N1, 3.3 V only.

</li>
<li>

Log in as `root`/`root` (or `freebsd`/`freebsd`) and change both passwords before anything else.

</li>
<li>

For drivers built on the board, install the kernel sources so `/usr/src/sys` exists. Then pick a driver from the list above.

</li>
</ol>

The Pi 5 boots FreeBSD through UEFI firmware (tested with v0.3), so it gets ACPI tables instead of a device tree. That is why several stock FreeBSD drivers that exist for the Pi do not attach on the Pi 5: they only look in the device tree.
