Progress on running Haiku on VisionFive 2

Not sure if it helps, but I got the 202303 Engineering Release of Debian running on VF2. All I did was flash it to SD and then change the pins. I didn’t need to update anything. It works great with Gnome and Wayland.

2 Likes

Change the pins? Do you mean the boot selection switches? Mine are both set to ON currently.

The RGPIO switches. It’s a bit confusing but mine correspond to SDIO in the picture.

3 Likes

I set that switches to boot from SD card.

Thanks x86k!

After setting the RGPIO switch to SDIO I was able to boot all of the StarFive Debian images but, as I expected, all of them have some GPU or HDMI problem.

The image / hardware combo that works best for me currently is starfive-jh7110-202302-SD-minimal-desktop.img connected to a 1080p HDMI display. starfive-jh7110-202302-SD-minimal-desktop.img fails to show the login screen when I boot it connected to my 4K display.

I’ve tried starfive-jh7110-VF2-SD-wayland.img . It boots but the HDMI output is only OK until the GDM login screen loads at which point what should be a blue login screen looks purple and all the colours are wrong. This happens when I boot the wayland image on both my 1080p and 4K displays. The good news with starfive-jh7110-VF2-SD-wayland.img is that it proves that 4K output is working OK when the kernel is booting and we can see 4K also kinda works under Wayland.

The release notes for the latest VisionFive 2 software release on github say that PCIe booting has been added to U-boot but I’ve not seen any guides on how we are supposed to install Debian onto / boot directly from NVMe yet?

The otherwise good specs (for a SBC) are ruined by having to run off SD card. I’m sure it’s easy enough to boot off the SD card and have your root on the NVMe but I’m keen to ditch the SD card fully ASAP.

From your responses I am presuming none of you have pulled this off yet. Have you got a NVMe SSD for your VF2 x86k?

I think I was underestimating the VF2’s CPU a bit. I’ve not done a conclusive comparison yet but it seems that the VF2’s CPU should compete quite well with the RPi4 even with its software ecosystem’s rather raw state. I think it might be a bit faster actually.

As I mentioned previously, I’ve got an eMMC module and it fits into the VF2 eMMC slots but its only 16 GB and my model doesn’t seem to be recognised or supported by the VF2. I tried booting the StarFive Debian eMMC image from it with no luck, after setting the RGPIO to eMMC.

I tried running mpv and VLC but they both gave some missing EGL / Vulkan call errors as if I don’t have the graphics driver / EGL libs installed properly so I’ve not been able to test playing any videos yet. It would seem there is working video decoding for gstreamer:

Both HDMI audio and the onboard audio jack work fine.

I’ve visited Linux PowerVR land previously when I had a Dell Netbook once that used a Intel Poulsbo chipset that had a PVR GPU and that never got a decent open source driver so it quickly became next to useless as a desktop computer so I came expecting GPU problems on the VF2. We’re in a better situation now with having an almost working open source Rogue PVR mesa driver so hopefully it won’t take too long to stabilise and become usable for most people. The VF2 GPU is supposedly about 4x faster than the RPi 4 GPU.

The biggest disappointment with the VF2 for me so far has been that the USB ports (currently) don’t provide enough power to use a mechanical disk attached to them. I’ve got some cheap TV boxes that also have USB 3 but they do provide enough power to use a mechanical disk via bus power alone.

I am presuming that building X512’s repo won’t spit out a disk image I can write to NVMe and just boot although I’ve not tried any of that yet.

I thought a few of you might find that interesting but it is OT talking about Linux so I’ll leave the Linux talk at that now. Back to installing Haku!

1 Like

Making Ethernet driver. Currently only basic driver structure is done, no interacting with hardware yet. I am experimenting with implementing interface net_device_module_info directly instead of using regular file read/write operations like existing Haiku drivers to avoid memory copy overhead and use net_buffer directly backed up by hardware DMA buffers.

24 Likes

Great to hear you’ve started writing a VF2 ethernet driver!

Could you share your latest Haiku VF2 image please? I realise I’ll have to build packages myself but I’m fine with that.

Thanks X512!

EDIT

I have got VLC to successfully play videos using using the CPU for decoding under the 69 build of StarFive Debian. It can just about handle playing 1080p h264 files.

I had to reflash the older 2.5.0 firmware to get the 69 build to boot again. It seems that the 69 build requires the RGPIO be set to boot from QSPI whilst their newer Debian images require you use the SDIO setting.

I have not been able to get vulkaninfo to successfully run yet. It segfaults for me under the 69 build, which I’ve read others have got to work with Vulkan.

1 Like

A lot of things on the software side are work in progress. Starfive made this comment regarding their Engineering Release: VisionFive 2 Debian Image 202303 Released(latest) - #70 by Michael.Zhu - VisionFive 2 (English Forum) - RVspace Forum

As for my own observations:
GPU: We are waiting for newer versions of mesa to hit the Debian repos. When that happens, we will hopefully have good support for Vulkan through the open source Imagination driver. As for OpenGL, it seems like the general idea is to rely on Zink (OpenGL → Vulkan compatibility layer) to provide accelerated OpenGL.

As for 4K, I didn’t try that. My 1080p monitor works with no issue though.

NVme: I didn’t look into that at all so far, and I don’t own an NVme drive yet. It appears to be mostly unsupported for now. Provided that the OS can recognize the NVme drive, you could perhaps try and use the SD card as a boot loader. X512 booted Haiku this way on the Sifive Unmatched if I recall. Personally, I found the SD card’s speed to be sufficient for my limited testing.

I also didn’t look into eMMC.

Video playback: I’m sure that the performance for video playback will be pretty good in time. I only got a small amount of lag while watching a 1080p video within Firefox. So with a little bit of work on the drivers, VLC and the like should work well.

1 Like

Yes it is possible to use the SD card as a boot loader although I’ve not tried it yet:

I’ve got too accustomed to using decent speed eMMCs or SSDs on my SBC’s so a 22 MB/s SD card doesn’t cut it for me.

I found this supposed fix for NVMe boot, which I’ve yet to verify:

Under u-boot:

setenv boot_targets mmc0 nvme0 dhcp
setenv bootcmd_nvme0 devnum 0; run nvme_boot
setenv kernel_comp_addr_r 0x50000000
setenv kernel_comp_size 0x04000000
setenv fdtfile starfive/jh7110-visionfive-v2.dtb
saveenv

now boots from mmc or nvme.

Reddit - Dive into anything

It may be no use to you now that you’ve already started writing a driver but OpenBSD has a driver for the original VisionFive ethernet called dwge. I don’t how similar it is to the VF2 ethernet interface but they could be the same? We have a OpenBSD network compat layer so that could be almost a copy/paste job?

X512:

I’ve attempted to build Haiku for VF2 with no success but I am guessing what to do of course.

I followed the insructions here:

(NB this page seems to need updating as it says “The state of the RISC-V port is early. Only the bootloader currently runs.” which is not the case any more apparently)

but instead of using the official haiku source repo I used the visionfive2 branch cloned from your repo.

I successfully built the Haiku compiler toolchain under StarFive Debian but when it came to building Haiku itself I wasn’t sure what command to run so I just ran:

jam -j4 -q @minimum-mmc

Like in the riscv build guide but I expect there might be another build target I need to use to create a SSD vs a mmc image? Running this command within the generated.riscv64 dir only got as far as building String.h before the build failed.

I use jam -j4 -q @minimum-raw, copy contents of haiku-minimum.image to NVMe disk and EFI boot loader (haiku_loader.efi) to SD card.

4 Likes

@X512 thank you for sharing these info. This is what I asked you earlier :slight_smile:

I’ve tried three different platforms to build Haiku for VF2. I first tried to build it under StarFive Debian on the VF2. The cross compilation tools built fine but building Haiku didn’t get very far. GCC too old? ext4 causing probs? Lets not bother eh?

Next I tried building it under Debian testing amd64 with gcc 12.2.0 and using btrfs. It got much further but the build fails with the same error that I get when I try to build it under the latest amd64 Haiku nightly:

You need to clone haiku sources from https://review.haiku-os.org and not from Github as the latter doesn’t have tags. Alternatively, you can set it manually.

But Haiku upstream do not support VisionFive 2 yet…

1 Like

It would be best to clone from our Git to get all the tags, then add X512’s GitHub fork as another remote, pull that, then switch to the visionfive2 branch. Or if the haiku repo has already been cloned from GitHub and our build system requires hrev tags the latest one could be added manually with the git tag command.

2 Likes
dan@zbook:~/src$ git clone https://review.haiku-os.org/haiku
Cloning into 'haiku'...
remote: Counting objects: 786276, done
remote: Finding sources: 100% (786276/786276)
remote: Total 786276 (delta 605059), reused 786164 (delta 605059)
Receiving objects: 100% (786276/786276), 399.92 MiB | 28.39 MiB/s, done.
Resolving deltas: 100% (605059/605059), done.
Updating files: 100% (25407/25407), done.
dan@zbook:~/src$ cd haiku
dan@zbook:~/src/haiku$ git remote add vf2 https://github.com/X547/haiku.git
dan@zbook:~/src/haiku$ git remote -v
origin	https://review.haiku-os.org/haiku (fetch)
origin	https://review.haiku-os.org/haiku (push)
vf2	https://github.com/X547/haiku.git (fetch)
vf2	https://github.com/X547/haiku.git (push)
dan@zbook:~/src/haiku$ git checkout visionfive2
error: pathspec 'visionfive2' did not match any file(s) known to git
dan@zbook:~/src/haiku$

I’ve never used gits remote repo feature before so I’m not sure how its supposed to work. I’ve tried running git fetch after adding the remote and before running git checkout or switch with visionfive2 but no joy.

Try git checkout vf2/visionfive2. You need to tell git the remote and branch to check out remote branches.

Here are the build commands I used previously:

git clone https://review.haiku-os.org/buildtools
git clone https://github.com/X547/haiku.git
cd haiku
git checkout visionfive2
mkdir generated.riscv64; cd generated.riscv64
../configure --use-gcc-pipe -j4 --cross-tools-source ../../buildtools --build-cross-tools riscv64
jam -j4 -q @minimum-raw