I had some trouble getting this installed and working, so hopefully this post breaks it down and saves you my hours of troubleshooting.
The OpenBSD install guide assumes you’re on OpenBSD, but you’re probably not if you need this blog post, so you’ll have to download the required packages manually.
Go to the OpenBSD FTP Server. From /pub/OpenBSD/7.6/arm64 download install76.img. The version will probably have changed by the time you read this.
From /pub/OpenBSD/7.6/packages/aarch64 download dtb-6.10p3.tgz and u-boot-rk3588-2024.04.tgz. Again the versions have probably changed for you, future traveler.
From the u-boot-rk3888 tar, extract /share/u-boot/nanopi-r6c-rk3588s/u-boot-rockchip.bin
From the dtb tar, extract /share/dtb/arm64/rockchip/rk3588s-nanopi-r6c.dtb
Plug the TF/MicroSD card into your PC. Use lsblk
to find the device, in my case it’s /dev/sda (the partitions below don’t matter, we’re overwriting them):
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 58.9G 0 disk
├─sda1 8:1 1 8M 0 part
├─sda4 8:4 1 579.7M 0 part
└─sda5 8:5 1 579.7M 0 part
Copy the install76.img file to the TF card. This will of course destroy everything on the card:
# dd if=install76.img of=/dev/sda bs=1M
Copy the u-boot file:
# dd if=u-boot-rockchip.bin of=/dev/sda seek=64
Mount the first partition of the TF card somewhere:
# mkdir /mnt/tfcard
# mount /dev/sda1 /mnt/tfcard
Copy the rk3588s-nanopi-r6c.dtb file to /vendor on the first partition:
# mkdir -p /mnt/tfcard/vendor
# cp rk3588s-nanopi-r6c.dtb /mnt/tfcard/vendor
Unmount the TF card
# umount /mnt/tfcard/
# eject /dev/sda
Plug the TF card in. Connect the R6C to a power adapter. Then connect it to your PC via the Debug USB-C port (note it needs separate power). The R6C has an onboard USB-C to UART adapter which we’ll be using to connect to it.
Run # dmesg | grep tty
to find the device name. In my case it’s /dev/ttyUSB0:
usb 3-3: ch341-uart converter now attached to ttyUSB0
Use a terminal emulator to connect to the console. You can use picocom:
# pacman -S picocom (Arch Linux)
# apt install picocom (Debian)
By default you connect to your NanoPi with # picocom -b 1500000 -r -l /dev/ttyUSB0
You can do this to see the earliest part of the boot process. You should see the boot up process stop shortly after “Preparing for EL3 exit to normal world”. This is because the U-Boot uses 115200 baud, not the 1500000bps the NanoPi uses by default.
Connect at 115200bps with # picocom -b 115200 -r -l /dev/ttyUSB0
. You can press Ctrl-A Ctrl-H for picocom help. C-a C-x exits. C-a C-b prompts to change the baud rate for an existing connection.
Did you get stuck at ohci0 at mainbus0
and can’t type anything? This is because you already have something installed on the eMMC interfering with the boot process. You have to erase it using the upgrade_tool and instructions on the FriendlyElec wiki here.
Those instructions did not work for me for whatever reason (the R6C would not go into Maskrom mode). I had Debian installed on eMMC so I logged in as root and ran dd if=/dev/zero of=/dev/mmcblk2 bs=1M count=1024
. The eMMC device was /dev/mmcblk2 in my case.
Then plug the OpenBSD TF card back in and reboot.
Hopefully you’re connected with a 115200 baud serial connection and you see
Welcome to the OpenBSD/arm64 7.6 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
Press I to install and go through the wizard. When setting up the network dwqe0 is the 1G WAN interface. rge0 is the 2.5G interface.
When setting up the disks, I installed onto sd2, which was the 32G internal eMMC:
Available disks are: sd0 sd1 sd2.
Which disk is the root disk? ('?' for details) [sd0] ?
sd0: NVMe, SHGP31-2000GM, 3106 (1863.0G)
sd1: SD/MMC, USD00, 0021 (58.9G)
sd2: SD/MMC, A3A551, 0000 (28.9G)
When it says Let's install the sets
, since I’m using the full install76.img, I was able to install them off the disk. In this case, it was sd1:
Location of sets? (disk http nfs or 'done') [http] disk
Is the disk partition already mounted? [no]
Available disks are: sd0 sd1 sd2 sd3.
Which disk contains the install media? (or 'done') [sd0] sd1
a: 1187232 49152 4.2BSD 2048 16384 16142
i: 16384 32768 MSDOS
Available sd1 partitions are: a i.
Which sd1 partition has the install sets? (or 'done') [a]
Pathname to the sets? (or 'done') [7.6/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] base76.tgz [X] game76.tgz [X] xfont76.tgz
[X] bsd.mp [X] comp76.tgz [X] xbase76.tgz [X] xserv76.tgz
[X] bsd.rd [X] man76.tgz [X] xshare76.tgz
Set name(s)? (or 'abort' or 'done') [done]
Directory does not contain SHA256.sig. Continue without verification? [no] yes
Installing bsd 100% |**************************| 17351 KB 00:02
Installing bsd.mp 100% |**************************| 17422 KB 00:02
...
After the install completes, reboot:
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]
Press a key to stop autoboot. These two commands boot into OpenBSD.
Hit any key to stop autoboot: -1
=> setenv bootcmd 'load mmc 1:1 0x4000000 /efi/boot/bootaa64.efi; bootefi 0x4000000'
=> boot
You need the u-boot-rockchip.bin file. I copied it over from a USB stick. There isn’t enough room on the install76.img to sneak it over, so get it over another way. There is probably technically a way to copy the bits directly from the TF card but I am not a clever man.
Use sysctl hw.disknames
and disklabel <disk>
to find the correct device for the internal eMMC (the one with the OpenBSD filesystem on it).
# disklabel sd4
# /dev/rsd4c:
type: SCSI
disk: SCSI disk
label: SR CRYPTO
duid: c07f3e664dc6c815
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 3769
total sectors: 60554736
boundstart: 65536
boundend: 60554736
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 2097152 65536 4.2BSD 2048 16384 12960 # /
b: 3851410 2162688 swap # none
c: 60554736 0 unused
d: 3195776 6014112 4.2BSD 2048 16384 12960 # /tmp
e: 4957664 9209888 4.2BSD 2048 16384 12960 # /var
f: 6759552 14167552 4.2BSD 2048 16384 12960 # /usr
g: 1892672 20927104 4.2BSD 2048 16384 12960 # /usr/X11R6
h: 7628480 22819776 4.2BSD 2048 16384 12960 # /usr/local
i: 32768 32768 MSDOS
j: 4931808 30448256 4.2BSD 2048 16384 12960 # /usr/src
k: 11960768 35380064 4.2BSD 2048 16384 12960 # /usr/obj
l: 13213888 47340832 4.2BSD 2048 16384 12960 # /home
Then dd u-boot-rockchip.bin to the beginning of the internal eMMC. Note the dd command uses the raw device rsd4c
(in my case) not sd4c
.
# mount /dev/sd3i /mnt (sd3 is my USB stick with the u-boot file)
# dd if=/mnt/u-boot-rockchip.bin of=/dev/rsd4c bs=512 seek=64
Finally you can remove the TF card and reboot and you should automatically boot up into OpenBSD!
These sources helped me as I hit every single, possible roadblock getting this to boot: