OpenBSD on the Raspberry Pi 3A+


The ARM port of OpenBSD supports the BCM2837 and BCM2711 SoCs. The latter is found on the Raspberry Pi 4 Model B, while the former is the SoC for the Raspberry Pi 3 (Models B, B+ and A+).

Although the SoC is the main component of all Raspberry Pi boards, it is just one component that must be supported by the operating system.

The Raspberry Pi 3 Model A+ (ie. “the 3A+”) has no Ethernet. Instead, it has built-in WiFi and Bluetooth, but:

There is no working OpenBSD driver for the WiFi/Bluetooth chipset (the CYW43455).

The bwfm driver does recognise the chipset, but running

# sh /etc/netstart bwfm0

gives the errors:

bwfm0: HT avail timeout
bwfm_sdio_buf_write: error 60
bwfm0: could not load microcode
bwfm0: could not init bus

The good news, however, is that everything else is supported in the OpenBSD ARM port – including the onboard USB2.0 connector. If you want network connectivity, this means you can use the 3A+’s sole USB port for either an Ethernet or WiFi adapter.

I used one of these:

It’s a USB Hub as well as having Ethernet, so I can plug in other devices, eg. keyboard, mouse, USB WiFi adapter, etc.

Crucially, its Ethernet controller is supported by OpenBSD – it has the RTL8152 chipset which is supported out-of-the-box by the ure driver.

I got it from amazon.co.uk but they are available from many of the specialist Raspberry Pi suppliers, eg. The Pi Hut or Pimoroni. Make sure it’s the USB Type-A version (so that it fits the 3A+) and its Ethernet chipset is supported by OpenBSD.

For install, I didn’t use the hub’s other usb ports. Instead, I opted for USB-to-UART using one of these:

The USB port on my laptop did’ot supply a consistent 5V needed to power the 3A+ (the TX/RX are 3.3V) so, instead, I used an official Raspberry Pi power supply.

With the hardware sorted, you need to download a copy of the arm64 minirootXY.fs image from your closest mirror. I used miniroot67.fs from:

https://mirror.bytemark.co.uk/pub/OpenBSD/6.7/amd64/

Once you’ve downloaded it you can burn it to your Micro SD card using your favourite application, eg. Etcher or similar. The process is similar to what I described here.

I used the ‘dd’ command on my raspios machine:

# dd if=miniroot67.fs of=/dev/sdX bs=1M conv=fsync

where ‘sdX’ is the drive and letter for the Micro SD card. Mine was mmcblk0. YMMV. The usual caveats about wiping your main hard drive apply here. If you don’t know what I’m talking about then don’t proceed any further until you do. You have been warned.

The miniroot image is a small image so the above should take less than a couple of seconds. It contains the necessary firmware images (bootcode.bin and the *.elf files) needed to start the CPU cores. From the Raspberry Pi documentation:

“When the Raspberry Pi is powered on, it loads various files from the boot partition/folder in order to start up the various processors, then it boots the Linux kernel…

start.elf, start_x.elf, start_db.elf, start_cd.elf, start4.elf, start4x.elf, start4cd.elf, start4db.elf…

These are binary blobs (firmware) that are loaded on to the VideoCore in the SoC, which then take over the boot process.”

You can see these in /boot. Not all of them are needed, of course, and their use in bootstrapping to the OpenBSD kernel are described in this post, if you’re interested in further details.

Once the image has been written and you’ve satisfied any curiosity about the contents of /boot, you’re ready to put the microSD card in the 3A+ and fire it up. The OpenBSD website contains some instructions that I found confusing and weren’t needed:

“The Raspberry Pi 3 requires closed but redistributable files on the system disk to load into the VC4 GPU which starts the ARM cores. By default the boot ROM will only try to load these files off an SD card. To load the firmware off the SD card and have the root disk on USB after installing OpenBSD reboot and interrupt U-Boot before the timeout expires and instruct U-Boot to prefer USB over the SD card”

Mine booted from the microSD card without needing to do any of this. I guess the website may need to be updated. Anyway, below is my install log which contains my answers to the installer’s questions, that someone new to OpenBSD user may find useful. I pretty much used all of the defaults. Where I did input my own details, I’ve indicated in bold red.

U-Boot 2020.01 (Mar 07 2020 – 09:39:06 -0700)
DRAM: 448 MiB
RPI 3 Model A+ (0x9020e0)
MMC: mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT… *** Warning – bad CRC, using default environment
In: serial
Out: vidconsole
Err: vidconsole
Net: No ethernet found.
starting USB…
Bus usb@7e980000: scanning bus usb@7e980000 for devices… 3 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
Hit any key to stop autoboot: 2 1 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1…
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk mmc@7e202000.blk…
** Unrecognized filesystem type **
Card did not respond to voltage select!
Scanning disk mmcnr@7e300000.blk…
Disk mmcnr@7e300000.blk not ready
Found 3 disks
BootOrder not defined
EFI boot manager: Cannot load any image
169176 bytes read in 12 ms (13.4 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
disks: sd0*

OpenBSD/arm64 BOOTAA64 0.22
boot>
booting sd0a:
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
Copyright (c) 1995-2020 OpenBSD. All rights reserved. https://www.OpenBSD.org
OpenBSD 6.7 (RAMDISK) #572: Thu May 7 14:08:02 MDT 2020
deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem = 433647616 (413MB)
avail mem = 387502080 (369MB)
mainbus0 at root: Raspberry Pi 3 Model A Plus Rev 1.0
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache

uhub1 at uhub0 port 1 configuration 1 interface 0 “Terminus Technology USB 2.0 Hub” rev 2.00/1.11 addr 2
ure0 at uhub1 port 4 configuration 1 interface 0 “Realtek USB 10/100 LAN” rev 2.10/20.00 addr 3
ure0: RTL8152 (0x4c10), address 00:e0:4c:36:00:67
rlphy0 at ure0 phy 0: RTL8201E 10/100 PHY, rev. 2

bootfile: sd0a:/bsd
boot device: sd0
root on rd0a swap on rd0b dump on rd0b
WARNING: CHECK AND RESET THE DATE!
gpio at bcmgpio0 not configured
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
Welcome to the OpenBSD/arm64 6.7 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? I
At any prompt except password prompts you can escape to a shell by
typing ‘!’. Default answers are shown in []’s and are selected by
pressing RETURN. You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.
Terminal type? [vt220]
System hostname? (short form, e.g. ‘foo’) XXX
Available network interfaces are: ure0 vlan0.
Which network interface do you wish to configure? (or ‘done’) [ure0]
IPv4 address for ure0? (or ‘dhcp’ or ‘none’) [dhcp]
ure0: 192.168.1.126 lease accepted from 192.168.1.1 (aa:bb:cc:dd:ee:ff)
IPv6 address for ure0? (or ‘autoconf’ or ‘none’) [none]
Available network interfaces are: ure0 vlan0.
Which network interface do you wish to configure? (or ‘done’) [done]
Using DNS domainname lan
Using DNS nameservers at 192.168.1.1
Password for root account? (will not echo)
Password for root account? (again)
Start sshd(8) by default? [yes]
Setup a user? (enter a lower-case login name, or ‘no’) [no] XXX
Full name for user XXX? [XXX]
Password for user XXX? (will not echo)
Password for user pi? (again)
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no]
Available disks are: sd0.
Which disk is the root disk? (‘?’ for details) [sd0]

Use (W)hole disk or (E)dit the MBR? [whole]
Creating a msdos partition and an OpenBSD partition for rest of sd0…done.

The auto-allocated layout for sd0 is:

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]

Let’s install the sets!
Location of sets? (disk http nfs or ‘done’) [http]
HTTP proxy URL? (e.g. ‘http://proxy:8080’, or ‘none’) [none]
(Unable to get list from ftp.openbsd.org, but that is OK)
HTTP Server? (hostname or ‘done’) https://mirror.bytemark.co.uk
Server directory? [pub/OpenBSD/6.7/arm64]
Select sets by entering a set name, a file name pattern or ‘all’. De-select
sets by prepending a ‘-‘, e.g.: ‘-game‘. Selected sets are labelled ‘[X]’.

[X] bsd [X] base67.tgz [X] game67.tgz [X] xfont67.tgz [X] bsd.mp [X] comp67.tgz [X] xbase67.tgz [X] xserv67.tgz [X] bsd.rd [X] man67.tgz [X] xshare67.tgz

Set name(s)? (or ‘abort’ or ‘done’) [done] -x*
[X] bsd [X] base67.tgz [X] game67.tgz [ ] xfont67.tgz
[X] bsd.mp [X] comp67.tgz [ ] xbase67.tgz [ ] xserv67.tgz
[X] bsd.rd [X] man67.tgz [ ] xshare67.tgz
Set name(s)? (or ‘abort’ or ‘done’) [done]

Location of sets? (disk http nfs or ‘done’) [done]
What timezone are you in? (‘?’ for list) [Canada/Mountain] Europe/London
Saving configuration files… done.
Making all device nodes… done.
Multiprocessor machine; using bsd.mp instead of bsd.
Relinking to create unique kernel… done.
CONGRATULATIONS! Your OpenBSD install has been successfully completed!
When you login to your new system the first time, please read your mail
using the ‘mail’ command.
Exit to (S)hell, (H)alt or (R)eboot? [reboot] H
syncing disks… done
The operating system has halted.
Please press any key to reboot.

Categories:OpenBSD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: