Install OpenBSD 6.7-current on a PineBook Pro 64

Current State as of Sun Jun 14 11:42:54 CEST 2020

This document is work in progress and I'll update the date above once I change something. If you have something to add, remarks, etc please contact me. Preferably via Mastodon but other means of communication are also fine.

Lastest dmesg.

What works:

What doesn't work (yet):

Introduction and Disclaimer!

The following article describes how I installed OpenBSD 6.7-current on my PineBook Pro 64 (PBP). Please note that there is no warranty for anything I describe in the article. If you mess up your local disk, your Pinebook's eMMC, etc you have been warned!

Preparations

One great thing about the PBP is the serial console built into the headphone jack. In my opinion, every professional workstation or Laptop should have this. I would love to have a serial console in my Thinkpad. Thus, you will need the following parts to continue:

The following preparation steps have all been done on an OpenBSD system. If you intend to run them on another machine, modify them accordingly.

Switch on the Serial Console

By default, the serial console is disabled and you have to manually flip a switch to enable it. Follow the instructions here to remove the back cover and flip the correct switch.

Prep SD Card for Installation

The following steps are basically a write-up from the official install instructions on the OpenBSD website. Always rely on the official docs first, they're kept up to date while this article might get outdated!

In the following, sd2 refers to the SD card. Make sure that you always chose the correct device node, otherwise you can seriously damage your system.

ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/arm64/SHA256.sig
ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/arm64/miniroot67.img
signify -C -p /etc/signify/openbsd-67-base.pub -x SHA256.sig

Once you have correctly verified the signature write the image to the disk

doas dd if=miniroot67.img of=/dev/rsd2c bs=1m

Now you need to install two additional packages to get the needed files:

doas pkg_add dtb u-boot-aarch64

Now copy and dd the needed files over to the SD card.

doas mount /dev/sd2i /mnt/
doas mkdir /mnt/rockchip
doas cp /usr/local/share/dtb/arm64/rockchip/rk3399-pinebook-pro.dtb /mnt/rockchip/
doas umount /mnt/
doas dd if=/usr/local/share/u-boot/rockpro64-rk3399/idbloader.img of=/dev/sd2c seek=64
doas dd if=/usr/local/share/u-boot/rockpro64-rk3399/u-boot.itb of=/dev/sd2c seek=16384

Once everything finished without errors, put the SD card into the PBP and reboot with the serial console attached.

Install OpenBSD

Note that the serial speed is 1500000 baud according to the official wiki. If you have the wrong speed you will likely see garbage on the screen.

$ cu -d -s 1500000 -l ttyU0 -E
Returning to boot ROM...      [335/3994]

U-Boot SPL 2020.01-7-g365495a329 (Mar 30 2020 - 15:28:38 +0000)
Trying to boot from MMC2

U-Boot 2020.01-7-g365495a329 (Mar 30 2020 - 15:28:38 +0000) Manjaro ARM

Model: Pine64 Pinebook Pro
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Pine64 Pinebook Pro
## Error: Can't overwrite "serial#"
## Error inserting "serial#" variable, errno=1
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   No ethernet found.
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
59427 bytes read in 16 ms (3.5 MiB/s)
Found EFI removable media binary efi/boot/bootaa64.efi
Scanning disk dwmmc@fe320000.blk...
** Unrecognized filesystem type **
Scanning disk sdhci@fe330000.blk...
** Unrecognized filesystem type **
Found 6 disks
BootOrder not defined
EFI boot manager: Cannot load any image
169336 bytes read in 28 ms (5.8 MiB/s)
disks: sd0* sd1
>> OpenBSD/arm64 BOOTAA64 1.2
boot>

[...]

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') pine64

[... Just install OpenBSD as usual ...]

Saving configuration files... done.
Making all device nodes... done.
Multiprocessor machine; using bsd.mp instead of bsd.
Relinking to create unique kernel...
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

Halt the OS and remove the SD card. Then press a key to reboot.

First Boot

[...]
Automatic boot in progress: starting file system checks.
/dev/sd0a (2a503f7a76b2de35.a): file system is clean; not checking
/dev/sd0l (2a503f7a76b2de35.l): file system is clean; not checking
/dev/sd0d (2a503f7a76b2de35.d): file system is clean; not checking
/dev/sd0f (2a503f7a76b2de35.f): file system is clean; not checking
/dev/sd0g (2a503f7a76b2de35.g): file system is clean; not checking
/dev/sd0h (2a503f7a76b2de35.h): file system is clean; not checking
/dev/sd0k (2a503f7a76b2de35.k): file system is clean; not checking
/dev/sd0j (2a503f7a76b2de35.j): file system is clean; not checking
/dev/sd0e (2a503f7a76b2de35.e): file system is clean; not checking
pf enabled
starting network
ure0: 172.23.5.35 lease accepted from 172.23.5.1 (cc:ce:1e:8b:cf:cf)
reordering libraries: done.
openssl: generating isakmpd/iked RSA keys... done.
ssh-keygen: generating new host keys: RSA ECDSA ED25519 
starting early daemons: syslogd pflogd ntpd.
starting RPC daemons:.
savecore: no core dump
checking quotas: done.
clearing /tmp
kern.securelevel: 0 -> 1
creating runtime link editor directory cache.
preserving editor files.
starting network daemons: sshd smtpd sndiod.
running rc.firsttime
Path to firmware: http://firmware.openbsd.org/firmware/snapshots/
Installing: uvideo-firmware
starting local daemons: cron.
Fri Jun  5 17:59:59 CEST 2020

OpenBSD/arm64 (pine64) (console)

login:

Enable Serial Console

To have the serial console properly running and to see the boot messages add the following file:

# cat /etc/boot.conf
set tty com0
stty com0 1500000

Install the DTB in the right place

Since the dtb package is not available on arm, copy the DTB file over from another machine. If you don't do this, you won't get support for the wireless card, X11 and likely other stuff:

Note: Using the default DTB from the dtb package I can't get X11 running. Otto Moerbeek (otto@) provided me a link to another DTB in a mailing list post. Using the DTB (rk3399-pinebook-pro.dtb, SHA1: 89888ab03c9c7dbd00e3caf10332bf8c818bfd14) from the attached tarball to the post made X11 work for me. I have no clue what the difference between the two DTBs are, so don't ask me for details.

BTW: Besides helping me out with another DTB, Otto Moerbeek writes a ton of useful code for OpenBSD and he has a Patreon campaign running. I am already on board and if you also have same bucks to spare…

doas mount /dev/sd0i /mnt
doas mkdir /mnt/rockchip
doas cp /usr/local/share/dtb/arm64/rockchip/rk3399-pinebook-pro.dtb /mnt/rockchip/
doas umount /mnt/

Now reboot.

Get Wifi running

To get bwfm running you just need to download the firmware using fw_update:

doas fw_update
bwfm-firmware-20200316: ok

ifconfig bwfm0
bwfm0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:00:00:00:00:00
        index 3 priority 4 llprio 3
        groups: wlan
        media: IEEE802.11 autoselect
        status: no network
        ieee80211: nwid ""

As you can see the MAC address is bogus so reboot now, again.

Start X11

Since the framebuffer console doesn't work at the moment you have to start X11 via xenodm so use the following commands to have it started after boot:

rcctl enable xenodm
rcctl start xenodm

Here's a screenshot how my freshly installed PBP looks with just some xterm, cwm as window manager, dmesg and htop. Not that htop serves a useful purpose I just never had a Notebook with 6 cores before :)

Screenshot of the PBP

Troubleshooting

The following sections shows issues I ran into. Sometimes my solutions are dirty hacks so if you have a better, proper solution please contact me.

The PBP won't start

From time to time my PBP won't start. When I press the power button everything stays dark including all LEDs. If that happens, I try to start with different combinations of cables (dis-)connected, i.e. charger on/off, serial on/off. In case this also doesn't help I dd the original Manjaro boot image onto an SD card and boot from that, abort the installation and reboot. I don't know why this helps but it helps at the moment.

Troubleshooting with the Wifi

Sometimes, the PBP will get stuck during boot when the bwfm(4) driver is initialized. This happens only after the firmware is installed. I haven't found a way yet to get it back to boot so I removed the driver files from /etc/firmware. This means I cannot use Wifi any longer but no Wifi is better than no useable Laptop at all.

My Personal FAQ

The following section shows my personal view on the PBP. YMMV, so take it with a grain of salt.

Can the PBP already be used a daily driver? While hardware support was greatly improved over the last month and packages like Firefox are available, it hardly depends on what you want to do with it. It is definitely powerful enough to run terminals, doing work on the console, administration. Working with heavy graphical applications is a bit cumbersome at the moment since X is not accelerated.

Why do you run -current on the PBP? For two reasons: First, hardware support is improved in -current and I don't want to wait until the next release to get the latest drivers. Second, this is my way of helping out the developers with testing, reporting bugs, etc. I run my systems in a configuration that might be different from a developer's configuration, so they might not find the bugs I have. I usually find them on my own and then file a proper bug report.

$Id: pinebookpro.md,v 1.11 2020/06/14 09:44:39 cvs Exp $