Installing OpenBSD 6.3 on Raspberry pi 3

The Easy way

Installing the OpenBSD on raspberry pi 3 is very easy and well documented which almost convinced me of not writing about it, but still I felt like it may help somebody new to the project (But again I really recommend reading the document if you are interested and have the time).

Note: I'm always running snapshots and recommend anybody to do it as well. But the snapshots links will change to the next version every 6 month, so I changed the links to the 6.3 version to keep the blog post valid over times. If you're familiar to the OpenBSD flavors, feel free to use the snapshots links instead.

Requirements

Due to the lack of driver, the OpenBSD can not boot directly from the SD Card yet, So we'll need an USB Stick for the installtion target aside the SD Card for the U-Boot and installer. Also, a Serial Console connection is required. I Used a PL2303 USB to Serial (TTL) adapter connected to my Laptop via USB port and connected to the Raspberry via TX, RX and GND pins.

Installation

For the RaspberryPi, I found the installation process the easiest using the miniroot image. It's currently a 20MB filesystem image containing only the installer script. For installing the base system, atleast the bsd kernel and the base file sets are also required. you can choose more file sets if you like:

$ wget https://ftp.openbsd.org/pub/OpenBSD/6.3/arm64/{SHA256,SHA256.sig,miniroot63.fs,bsd,bsd.mp,base63.tgz,man63.tgz}

The image and file sets can then be verified according the faq using sha256. Remember that if you mix the release and snapshot file sets, the checksum will disagree:

$ sha256 -C  SHA256 bsd* *.tgz miniroot*.fs
(SHA256) base63.tgz: OK
(SHA256) bsd: OK
(SHA256) bsd.mp: OK
(SHA256) man63.tgz: OK
(SHA256) miniroot63.fs: OK

Now to deal with the file sets. the possibilities are to place the file sets on another USB stick or make them accessible over the local network. I used python's http.server module to serve the filesets over http on my Laptop:

$ doas python3.6 -m http.server 80

Then, we need to copy the installer to the SD Card which you of course needs a running operating system for that. Any would do, and here's mine on OpenBSD with SD Card recognized as the sd1:

$ doas dd if=miniroot63.fs of=/dev/rsd1c bs=1m

Now it's time to plug the SD card and the USB Stick to the RaspberryPi3 turn the power on to let the autoboot process boot the installer automatically:

$ cu -dl /dev/ttyU0 -s 115200
Connected to /dev/ttyU0 (speed 115200)


U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Failed (-5)
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk mmc@7e202000.blk...
Card did not respond to voltage select!
Scanning disk sdhci@7e300000.blk...
Disk sdhci@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0...
Found 6 disks
97355 bytes read in 7 ms (13.3 MiB/s)
## Starting EFI application at 01000000 ...
>> OpenBSD/arm64 BOOTAA64 0.12
boot> 

Thanks to the text based installer, the Installation process is pretty much identical across architectures, so it's the typical miniroot installation. You can configure the the smsc0 Ethernet interface or use a Wifi dongle to fetch the file stes. I used my local network to fetch the file sets

Welcome to the OpenBSD/arm64 6.3 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? 

After Setting root's password and partitioning the USB stick, it's time to install the sets. Just ensure you checked only sets that you downloaded:

Let's install the sets!
Location of sets? (disk http nfs or 'done') [disk] http
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none] 
HTTP Server? (hostname, list#, 'done' or '?') 192.168.10.10
Server directory? [pub/OpenBSD/snapshots/arm64] /
Unable to connect using https. Use http instead? [no] yes

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] base63.tgz    [X] game63.tgz    [X] xfont63.tgz
    [X] bsd.mp        [X] comp63.tgz    [X] xbase63.tgz   [X] xserv63.tgz
    [X] bsd.rd        [X] man63.tgz     [X] xshare63.tgz
Set name(s)? (or 'abort' or 'done') [done] -x* -com* -game* -bsd.rd
    [X] bsd           [X] base63.tgz    [ ] game63.tgz    [ ] xfont63.tgz
    [X] bsd.mp        [ ] comp63.tgz    [ ] xbase63.tgz   [ ] xserv63.tgz
    [ ] bsd.rd        [X] man63.tgz     [ ] xshare63.tgz

The rest is boring. But one important thing is to boot the OpenBSD after installation. Since the U-Boot by default will prefer the SD Card, We need to change it on the first boot which is done easily by interrupting the autoboot by pressing any key and running the setenv boot_targets usb0 mmc0 dhcp and then boot command:

U-Boot 2018.03 (Mar 20 2018 - 04:28:27 -0600)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Failed (-5)
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   Core Release: 2.80a
scanning bus 0 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  0 
U-Boot> setenv boot_targets usb0 mmc0 dhcp
U-Boot> boot

Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra Fit
            Type: Removable Hard Disk
            Capacity: 14663.6 MB = 14.3 GB (30031250 x 512)
... is now current device
Scanning usb 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk mmc@7e202000.blk...
Card did not respond to voltage select!
Scanning disk sdhci@7e300000.blk...
Disk sdhci@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0...
Found 6 disks
97355 bytes read in 90 ms (1 MiB/s)
## Starting EFI application at 01000000 ...
>> OpenBSD/arm64 BOOTAA64 0.12
boot> 

Hope it helps! Cheers.

Update 2018-04-14: And here's the dmesg output which was requested on reddit.