Arch Linux Image for VisionFive 2

Just installed arch to my new m2 ssd.

I partitioned and unpacked arch’s risc-v tarball using starfive’s debian image, then chrooted into it and updated it.

Then I copied and set up cwt’s kernel.

However, my usual encrypted swap setup doesn’t work:

Feb 09 12:51:40 StarFive systemd[1]: Starting Cryptography Setup for swap...
Feb 09 12:51:40 StarFive systemd-cryptsetup[279]: Cannot initialize device-mapper. Is dm_mod kernel module loaded?
Feb 09 12:51:40 StarFive systemd-cryptsetup[279]: Set cipher aes, mode cbc-essiv:sha256, key size 256 bits for device /dev/nvme0n1p1.
Feb 09 12:51:40 StarFive systemd-cryptsetup[279]: Cannot initialize device-mapper. Is dm_mod kernel module loaded?
Feb 09 12:51:40 StarFive systemd-cryptsetup[279]: Cannot use device swap, name is invalid or still in use.
Feb 09 12:51:40 StarFive systemd-cryptsetup[279]: Failed to activate with key file '/dev/urandom': Operation not supported
Feb 09 12:51:40 StarFive systemd[1]: systemd-cryptsetup@swap.service: Main process exited, code=exited, status=1/FAILURE
Feb 09 12:51:40 StarFive systemd[1]: systemd-cryptsetup@swap.service: Failed with result 'exit-code'.
Feb 09 12:51:40 StarFive systemd[1]: Failed to start Cryptography Setup for swap.

The kernel seems to have been built w/o device manager support (or something related is broken), and thus I can have no encrypted swap (or encrypted anything).

@cwt could you look into this for new release?

My intent, besides encrypting swap, was to set up LUKS for my /home partition. Any serious use is gated on having this working.

I didn’t enable device manager, I can enable it and build a new kernel.

1 Like

It’s no hurry, but it’d be nice to have it enabled for the next one :slight_smile:

1 Like

Somehow, I expected X to just work via modesetting or fbdev drivers. But it does not.

What did you do to get X working? I would like to try and do it myself, to understand the steps.

I did get weston working on wayland. I never tried X. I don’t think it will working out of the box without Starfive patches. It may required binary blob too, which I don’t expected it to work because the glibc on Arch is newer than Debian.

1 Like

Installing the xf86-video-fbdev driver wasn’t enough.

Section "Device"
    Identifier             "Screen0"
    Driver                 "fbdev"
    Option "fbdev"         "/dev/fb0"
EndSection

It needed to be told this much.

So now I have X. Unaccelerated, slow, but X nevertheless.

2 Likes

@rvalles I just uploaded an experimental kernel that I’ve been working on. It’s quite stable and I’ve been using it as my daily driver for a week now (24x7). DM, DM_CRYPT, and other DM_* modules are enabled.

The kernel was built with LLVM:

$ make -j4 LLVM=1 CC="clang -mcpu=sifive-u74 -mtune=sifive-7-series"

So if you want to build any external module or driver, please add LLVM=1 to your make command.

Google Drive: Experimental - Google 云端硬盘
Naver MYBOX: 네이버 MYBOX

Extract them to / and then edit your /boot/boot/extlinux/extlinux.conf

1 Like

Grabbed your sources, gave menuconfig a once-over and I’m now building them on the VisionFive 2 itself.

It was about time I tried building a kernel on this thing. We’ll see how it goes.

At 40m, 56.3C CPU, 43.9C SSD.

3 Likes

@cwt The latest image ArchLinux-VF2_515_v2.8.0-cwt6.1.img (not experimental image) has two flaws…

  1. The extracted image is 15GB. Even though most of it is empty, dd will still write additional 12-ish GBs to the disk and cause extra wear and tear. It is also very time consuming. Please trim the image down, 15 GB is too much. I guess you can get away with 1200MB only :wink:

  2. The device tree is still being corrupted somehow… The reboot +0 command does not work. I can see on UART that the board is stuck and the last kernel message is: reboot: Restarting system with command '+0'. Edit: The reset button doesn’t work either :frowning:

Can you share your build scripts? Maybe I can chip in, I too prefer Arch over Debian :smiley:

It wasn’t ready. Something actually failed.

Now I see why salsa20 was disabled :laughing:.

I didn’t even write down the image.

With losetup and some parameter, you get subdevices for each partition. I mounted and took what I needed from /boot, and used the official root tarball from the arch risc-v port website.

Disk images are the problem. Just use tarballs instead.

There is no build script, I did everything manually as described in this post.

Unfortunately, the corruption of the DTB file is something beyond my control. I recently discovered that the file was being overwritten by the u-Boot. I hope Starfive will address this issue in future releases of their Debian image.

I am currently waiting for the delivery of the revision B board so that I can test my image on both revisions. Until then, I do not plan on releasing any new images.

1 Like

I have a 1.3B (or is it 8?) board and I’ll try making a script to build an image

1 Like

My kernel boots, but a long time was spent in udev (see timeout below) and there’s some bizarre libbpf errors.

[    3.067694] cdns-dsi 295d0000.mipi: starfive dsi bind end
:: running early hook [udev]
Starting systemd-udevd version 252.5-1-arch
:: running hook [udev]
:: Triggering uevents...


Timed out for waiting the udev queue being empty.
:: running hook [keymap]
:: Loading keymap...kbd_mode: KDSKBMODE: Inappropriate ioctl for device
done.
:: performing fsck on '/dev/nvme0n1p2'
arch-root: clean, 232667/8388608 files, 3116201/33554432 blocks
:: mounting '/dev/nvme0n1p2' on real root
:: running cleanup hook [udev]
libbpf: failed to find valid kernel BTF
libbpf: Error loading vmlinux BTF: -3
libbpf: failed to load object 'iterators_bpf'
libbpf: failed to load BPF skeleton 'iterators_bpf': -3
Failed load could be due to wrong endianness

Welcome to Arch Linux!

[  127.637574] systemd[1]: bpf-lsm: Failed to load BPF object: No such process
[  OK  ] Created slice Slice /system/getty.

@cwt How do you generate your initramfs?

On my end, all I did was a crude mkinitcpio -k 5.15.2-rt20-cwt9-rvalles -g myinitrd.

I use mkinitcpio but I can’t remember the full command now. I’m on the way home.

2 Likes

Thanks so much for this image.

I have early work on package of the IMG_GPU driver userspace (GLES, Vulkan, OpenCL).
From the starfive-tech/soft_3rdpart repo.
It comes with some testing tools as well. rgx_triangle_test can draw some spinning triangles using DRI/KMS.

AUR:
https://aur.archlinux.org/packages/visionfive2-img-gpu

Github:

What works:

  • It comes with testing tools that work and use the GPU.
  • I think anything using opencl should work.

What doesn’t

  • The libvulkan is missing some some symbols so even basic things like vkcube don’t work.
  • It’s just GLES no OpenGL
  • Wayland compositors have decencies that conflict. Eg: weston explicitly depends on mesa which conflicts.
  • There’s no EGL not sure what’s up with that.
  • There’s no libgbm. Which would make KMS hard.

I haven’t tested GLES yet.

The bundled libvulkan could probably be replaced with the normal vulkan-icd and likewise for opencl. That might fix the linking issues for vkcube.

I didn’t bundle the provided headers. Again I think the standard ones should probably suffice for that. (eg vulkan-headers can be installed with this to compile vulkan programs)

6 Likes

I think it would be a good idea to let the package depend on ocl-icd, vulkan-icd-loader, libglvnd and opencl-headers, to supply proper versions of those libraries (and their respective headers).

At least that is how I did it for my install locally and it seems to work alright (albeit I only tested OpenCL and some Vulkan)

By using this approach there is no conflict with mesa or the like either. Those libraries should be pretty much vendor agnostic, the juicy part is the firmware binary.

2 Likes

Thanks for providing this; it seems to work for me (and I finally have a basic perf, even though it’s missing all the DTB PMU entries for full U74 support, sigh).

(deleted nonsense)

My problems with packages were resolved after I updated with sudo pacman -Sy.

2 Likes

Ok it seems to work with ocl-icd, vulkan-icd-loader and kinda libglvnd.
However there’s no libdrm provided. So I can’t get Xorg or KMS working yet.

1 Like

What X video driver are you using?

So far, I only managed to get fbdev working, and I don’t think any acceleration can work with that.

1 Like