FreeBSD 14.4 on Raspberry Pi Zero 2W
698 words, 4 minutes
Not convinced lately with OpenBSD on this board , I went searching for another BSD OS to run on the Raspberry Pi Zero 2 W. According to the documentation, FreeBSD should do fine.
Let’s have a look.
Spoiler Alert: it does work nicely.
Documentation
The FreeBSD website and Wiki has a couple of articles that are worth reading before jumping into the testings.
Installation
For hardware details, please read this article . I am using a Raspberry Pi Zero 2 W with a WaveShare ETH/USB HUB HAT and a SanDisk 32 GB microSHDC. All is powerred using PoE.
Installation and management shall be done with an HDMI monitor and a USB keyboard to see what happens. Nothing pops up on the serial console (UART) by default.
Grab the FreeBSD RPI image and write it onto an SD-card.
$ wget https://download.freebsd.org/ftp/releases/ISO-IMAGES/14.4/CHECKSUM.SHA512-FreeBSD-14.4-RELEASE-arm64-aarch64-RPI
$ wget https://download.freebsd.org/releases/ISO-IMAGES/14.4/FreeBSD-14.4-RELEASE-arm64-aarch64-RPI.img.xz
$ sha512sum -c CHECKSUM.SHA512-FreeBSD-14.4-RELEASE-arm64-aarch64-RPI
FreeBSD-14.4-RELEASE-arm64-aarch64-RPI.img.xz: Réussi
$ xz -d FreeBSD-14.4-RELEASE-arm64-aarch64-RPI.img.xz
$ doas dd if=FreeBSD-14.4-RELEASE-arm64-aarch64-RPI.img of=/dev/sdb bs=5M
When done, stick the SD-card into the board and power it on. FreeBSD will start and storage will be resized on first boot to use all available SD-card space.
Once booted, the system allows connection from the console using the
root/root and freebsd/freebsd credentials. If the board got an
IP via DHCP, on can also connect using the freebsd account via SSH.
The dmesg for this system is available
here
.
According to the wiki , the wireless card (BCM43438) is not recognized. Luckily, the ETH/USB HUB Hat provides an Ethernet interface.
# sysctl net.wlan.devices
sysctl: unknown oid 'net.wlan.devices'
# usbconfig -l
ugen0.1: <OTG Root HUB DWCOTG> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <Hub Terminus Technology Inc.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (100mA)
ugen0.3: <RTL8152 Fast Ethernet Adapter Realtek Semiconductor Corp.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)
# dmesg
(...)
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x7e980000-0x7e98ffff,0x7e006000-0x7e006fff irq 21,22 on simplebus0
usbus0 on bcm283x_dwcotg0
usbus0: 480Mbps High Speed USB v2.0
uhub0 on usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub0: 1 port with 1 removable, self powered
uhub1 on uhub0
uhub1: <vendor 0x1a40 USB 2.0 Hub, class 9/0, rev 2.00/1.11, addr 2> on usbus0
uhub1: 4 ports with 4 removable, self powered
ure0 on uhub1
ure0: <Realtek USB 10/100 LAN, class 0/0, rev 2.10/20.00, addr 3> on usbus0
miibus0: <MII bus> on ure0
rlphy0: <RTL8201E 10/100 media interface> PHY 0 on miibus0
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: xx:xx:xx:xx:xx:xx
ue0: link state changed to UP
Software
Given that it is powered by PoE, I could not check its power
consumption. But, according to sysctl, the IDLE temperature is about
44 degC.
By default, powerd is already configured to ensure CPU speed
adjustments. Having a look at dev.cpu.0 shows that the ARM Cortex-A53
speed varies between 600 MHz and 1 GHz depending on the needs.
There is no RTC on this board. Which means that date and time gets wrong
in the board is not powered for some time. The FreeBSD image also sets
localtime to GMT-0 by default. I configured my timezone using tzsetup
and made time correct (to avoid TLS certificates validation issues)
using NTP tools at boot time.
# tzsetup
# sysrc ntpdate_enable="YES"
# sysrc ntpdate_hosts="fr.pool.ntp.org"
# service ntpdate start
# service ntpd enable
# service ntpd start
I also replaced the default host name and gave the Pi its own.
# hostname rpi02w
# sed -i -e 's/^hostname=".*$/hostname="rpi02w"/' /etc/rc.conf
# echo "127.0.0.1 rpi02w rpi02w.home.arpa" >> /etc/hosts
Switching from DHCP to static IP is done by a documented modification in
/etc/rc.conf. To ensure all is configured as expected, I rebooted the
board.
# sed -i -e 's/^ifconfig_DEFAULT=/#ifconfig_DEFAULT=/' /etc/rc.conf
# sysrc ifconfig_ue0="inet 192.0.2.666 netmask 255.255.255.0"
# sysrc defaultrouter="192.0.2.999"
# shutdown -r now
So far, this board seems to be stable. I plan to use it as a DNS resolver and DHCP server. Time will tell if I made a wrong choice or not.
