About tealeg

OpenBSD 7.6 on the StarFive VisionFive2

For a good while my StarFive VisionFive2 (a RISC-V 64bit SBC, designed to run Linux) has been sitting on a shelf unused. I've got a plan for it, but it involves running OpenBSD and that's been a little bit of a challenge on this hardware. So today, I spent a few hours today to get this up and running.

Where you should start

I noticed a while back that there was a good guide to getting OpenBSD 7.4 up and running on the VisionFive2:

Installing OpenBSD on VisonFive2

...as OpenBSD is a relatively stable OS (as in, things don't change much) I figured this would be a good starting point. In retrospect it's an excellent guide, but what I didn't count on was how much of a dance it would be to follow it with an install to an NVMe based SSD instead of an eMMC device.

What was so hard?

Again: for most people the guide linked above will be more than enough.

What screwed me over was that the uboot environment on my machine wasn't seeing the NVMe drive. Actually, it wasn't even seeing pci devices at one point.

What fixed it?

I figured I'd grab the latest release and update the uboot and firmware payload. Trouble is, the `sdcard.img` file that's included with the latest release (5.13.1) wouldn't boot. Basically I've left it too long. I ended up having to boot a 2.11.5 image (from March 2023) and using it to install the latest uboot and firmware.

Once that was done, I was able to do the following succesfully:

1. Interrupt the boot sequence using a FTDI USB to serial adapter and `cu` from an OpenBSD host.

2. Run the following commands at the `StarFive#` prompt:

pci scan
nvme scan
nvme parts

All of the above should output something (if they show nothing, you've got the problem I had). From this I could determine that in the guide linked above, every time you see:

mmc 0 1

You should replace it with:

nvme 0 1

... and then everything works out just fine!