Experimental Gentoo Image

You’ve motivated me :slight_smile:

Kernel is compiling now!

This solved the file access error from vf2vpudev:

FEATURES="-strict -config-protect-if-modified -parallel-fetching -ebuild-locks -protect-owned -sandbox -usersandbox -userpriv" emerge media-video/vf2vpudev

I guess it has something todo with parallel fetching and file locking.

Now I get another error but, first I’ll try to find out what’s going on here on my own:

>>> Compiling source in /var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3 ...
 * Preparing jpu module
make -j4 HOSTCC=riscv64-unknown-linux-gnu-gcc 'LDFLAGS=-m elf64lriscv' KERNELDIR=/usr/src/linux clean default 
make	-C /usr/src/linux	M=/var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver LDDINCDIR=/var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver/../include modules
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Gentoo 14.1.1_p20240518 p1) 14.1.1 20240516
  You are using:           riscv64-unknown-linux-gnu-gcc (Gentoo 14.1.1_p20240518 p1) 14.1.1 20240516
make[2]: *** Deleting file '/var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver/Module.symvers'
ERROR: modpost: "sifive_ccache_flush_range" [/var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver/jpu.ko] undefined!
ERROR: modpost: "sifive_ccache_flush_entire" [/var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver/jpu.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:134: /var/tmp/portage/media-video/vf2vpudev-5.11.3/work/soft_3rdpart-JH7110_VF2_6.1_v5.11.3/codaj12/jdi/linux/driver/Module.symvers] Error 1
make[1]: *** [Makefile:1783: modules] Error 2
make: *** [Makefile:34: default] Error 2

If you use es2gears_wayland, you can speed it up by changing the vblank_mode setting.
It is believed to support at least OpenGL ES.

=== from here ===
xxx@visionfive2:~$ es2gears_wayland
vertex shader info:
fragment shader info:
298 frames in 5.0 seconds = 59.529 FPS
301 frames in 5.0 seconds = 60.008 FPS
301 frames in 5.0 seconds = 60.008 FPS
299 frames in 5.0 seconds = 59.800 FPS
300 frames in 5.0 seconds = 59.976 FPS
xxx@visionfive2:~$ vblank_mode=0 es2gears_wayland
ATTENTION: default value of option vblank_mode overridden by environment.
vertex shader info:
fragment shader info:
5590 frames in 5.0 seconds = 1118.000 FPS
5723 frames in 5.0 seconds = 1144.600 FPS
5755 frames in 5.0 seconds = 1151.000 FPS
5886 frames in 5.0 seconds = 1177.200 FPS
5598 frames in 5.0 seconds = 1119.600 FPS
=== end ===

I just noticed you are running the one for ```

What is your current Kernel Version?
Each of these ebuilds is for a different kernel version
vf2vpudev-3.1.5.ebuild      Kernel 5.15
vf2vpudev-5.11.3.ebuild    Kernel 6.1
vf2vpudev-5.12.0.ebuild    Kernel 6.6

The last one installs without issues on my system running Kernel 6.6.20
>>> Test phase [disabled because of RESTRICT=test]: media-video/vf2vpudev-5.12.0

>>> Install media-video/vf2vpudev-5.12.0 into /var/tmp/portage/media-video/vf2vpudev-5.12.0/image
 * Installing jpu module
 * Installing venc module
 * Installing vdec module
>>> Completed installing media-video/vf2vpudev-5.12.0 into /var/tmp/portage/media-video/vf2vpudev-5.12.0/image

 * Final size of build directory: 77108 KiB (75.3 MiB)
 * Final size of installed tree:   1316 KiB ( 1.2 MiB)

strip: riscv64-unknown-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version

Hi Andrew,

that’s true. But at the moment I’m reverting the switch to gcc12 back to gcc14 as the process to switch to gcc12 was not successful because some problems with atomic (failed to emerge dev-util/glslang- This whole process needs some days as a lot of things needs to be re-compiled.

When this is finished I’ll try out your hint.

But probably I’ll put my RISC-V boards aside and tinker with my Jetson Orin and AI. RISC-V is a lot of compiling, patching, try and error and still the whole ecosystem (hardware and basic operating system) seems to me still in a alpha state.

I’ll come back to RISC-V in the long and dark winter time :slight_smile:

Risc-v Support is still in-progress for many platforms.

I enjoy getting packages running for the first time on a Risc-v Platform.

However with Gentoo you are in control and get to decide on what to run and How you run it.

I think Debian 13 will be the first Release with full Risc-v Support but that will probably only be in 2025.

However that said I think that Risc-v will be widely adopted in the near future.

1 Like

What we can all do to advance risc-v support on Gentoo is to try to emerge packages that currently do not have the riscv keyword and if it works then open a bug report and ask for the riscv ketwork to be added.

I added >=sci-libs/clfft-2.12.2-r1 ~*
to /etc/portage/package.accept_keywords
Worked out what was needed to get it to emerge on a risc-v system and then opened this bug report
904492 – sci-libs/clfft-2.12.2-r1::science riscv support

I have done this for other packages as well.

Here are some of them

>=dev-lang/yasm-1.3.0-r1 ~*
>=sci-libs/pytorch-1.13.1-r1 ~*
>=sci-libs/caffe2-1.13.1-r4 ~*
>=dev-libs/cpuinfo-2022.03.26-r1 ~*
>=dev-libs/pthreadpool-2022.05.09-r1 ~*
>=sci-libs/foxi-2021.05.27 ~*
>=dev-libs/psimd-2020.05.17 ~*
>=dev-libs/FP16-2021.03.20-r3 ~*
>=dev-libs/FXdiv-2020.12.09-r1 ~*
>=dev-libs/pocketfft-2021.11.23 ~*
>=dev-libs/pocketfft-2021.11.23 ~*
>=sci-libs/kineto-0.4.0 ~*
>=dev-python/PeachPy-2022.11.13 ~*
>=dev-python/Opcodes-0.3.14 ~*
>=sci-CRAN/sentencepiece-0.2.3 ~*
>=sci-CRAN/Rcpp-1.0.10 ~*
>=dev-lang/R-4.2.2 ~*
>=dev-python/pyopencl-2022.3.1 ~*
>=dev-python/pytools-2022.1.14 ~*
>=dev-util/spirv-llvm-translator-15.0.0 ~*
>=dev-libs/libclc-14.0.6 ~*
>=virtual/jdk-1.8.0-r6 ~*
>=www-client/chromium-98.0.4750.0 ~*
>=media-libs/libva-2.18.0::gentoo ~*
>=media-libs/avidemux-core-2.8.1-r1 ~*
>=media-video/ffmpeg-chromium-106 ~*
>=sci-libs/arrayfire-3.8.0 ~*
>=media-libs/glbinding-3.1.0_p1 ~*
>=sci-visualization/forge-1.0.5 ~*
>=sci-libs/clfft-2.12.2-r1 ~*
>=dev-libs/pocl-3.1 **
>=sci-libs/clblast-1.5.2-r1 ~*
>=dev-python/jupyter-1.0.0-r4 **
>=dev-python/qtconsole-5.4.2 ~*
>=dev-python/jupyter_console-6.6.3 **
>=sci-libs/gloo-2023.01.17 ~*
>=media-libs/shaderc-2023.2 **
>=sci-libs/XNNPACK-2022.12.22 ~*
>=dev-libs/clhpp-2023.04.17 ~*
>=dev-python/pyarrow-12.0.0 ~*
>=dev-libs/apache-arrow-12.0.0 ~*
>=dev-cpp/xsimd-11.1.0 ~*
>=dev-python/autopep8-2.0.2 ~*
>=dev-python/conda-4.14.0 ~*
>=dev-python/conda-package-handling-2.0.2 ~*
>=dev-python/conda-package-streaming-0.7.0 ~*
>=dev-util/editorconfig-geany-0.2 ~*
>=x11-themes/geany-themes-1.22.2-r2 **
>=app-benchmarks/sysbench-1.0.20-r101 ~*
>=app-misc/fastfetch-1.11.3 ~*
>=dev-db/firebird- ~*
>=dev-libs/yyjson-0.7.0-r1 ~*
>=dev-libs/dynolog-0.3.1_p20230126-r1 ~*
>=sci-libs/blis-0.9.0 ~*
>=dev-libs/pfs-0.10.0 ~*
1 Like

Some little breakthrough for me. I’ve started again with andrews image and updated successfully to v23, copied required files (kernel, init image, modules, dtb, firmware) for kernel 6.6.20 from the official visionfive2 debian image and successfully integrated them to andrews image.

Now I have video output on HDMI :slight_smile:

But when I try to use the console locally, either by UART adapter or a directly connected USB keyboard the input is sluggish and a lot of lags. SSH session works fine!

Does anyone has an idea what the reason could be? Maybe irqpoll needed or do I have to change anything in the dts file?


Have a look at /boot/uEnv.txt
Which .dts is the line
pointing to?
is it
the one ending in v1.3b.dtb

You may need to change it if you are running the newer kernel with the latest firmware

Check the contents of this file on the latest debian image as well if that is what your kernel is based on.

1 Like

Hi Andrew! Needed to switch to the v1.3 dtb in order to boot with 6.6.20 kernel. I’ve build kernel, modules and dtb on the board itself with the official sources from starfive.

But can’t get the keyboard thing sorted. Directly after reboot on the concole the keyboard does not work reliable. Some keys behave wrong, some key stroke has to be done twice. It’s not a hardware issue, tested that already.

Can you give me a hind what to look for in the dtb? I’ve no idea :grimacing:

But on the other hand i’ve docker.io running on the visionfive2/gentoo system :hugs:

What is the revision of your board?
Does the Keyboard behave any differently in another USB Port?
Does it show up when you run lsusb
Does the output of dmesg show any issues related to the usb devices?
Have you tried a powered USB HUB to rule out power supply issues?
Does the standard Debian image run without issues on the 6.6.20 kernel?
Did you have the same issue with the 5.15 kernel?
Are all the USB configs in this file enabled in your /usr/src/linux/.config
Can you post the output from dmesg as a file to the forum?

Today I’ve tried to login on another console than the default one (tty1). Switched between consoles with ctrl+alt+f2, f3, …

And everything works on tty2, tty3, … :smiley:

The difference between tty1 process and the other tty processes are:

/sbin/agetty -o -p -- \u --noclear - linux

all other tty:
/bin/login -p --

Maybe this is because I’m using the initrd.img-6.6.20-starfive from the official debian release?

To see the status of each tty
systemctl status getty@tty1
systemctl status getty@tty2

Have you tried to make your own initrd ?

I do the following to make mine
dracut /boot/initrd.img-6.6.20-starfive -force

BTW I have a gentoo install on my VF2 that I installed by mostly following the amd64 handbook, and without extracting anything from another image. I have documented it in case it might be helpful to anybody else:

Installing Gentoo on the Visionfive 2

Do note, however, that I have little experience in this sort of thing, and therefore much of what I did might be complete BS.


Thank you for your instructions as I am sure there are many folks who would like to install Gentoo from Scratch.

Here are the Official Instructions if you want to do it the hard way.

You can also get some additional tips from the Building Debian Image Document

1 Like

Here are the Official Instructions

Oh wow, I didn’t know there were official instructions. Thanks for the pointer

I have created the following pull request to update the Gentoo riscv overlay version of Chromium to Chromium to 126.0.6478.114

Hopefully it will be merged soon.


Short clip of Webgl Aquarium running in Chromium on my VisionFive2 with Gentoo

27 FPS at 500 Fish


Current Chromium gpu settings
about-gpu-2024-07-05T15-53-31-737Z.txt (40.2 KB)

Hi Andrew! Since my emerge Firefox runs since a few days: is Chromium the better choice for the VF2 / PVR GPU / Gentoo System? Then I would change to that route.

1 Like

Make sure you have set your CPU to performance mode the Firefox will tale less than a day to build.

Chromium can take up to 4 days to build

echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Additionally here is the version of VF2 Patched version of Mesa I used when I took that short video

 Installed versions:  22.1.7-r4^t[2](15:30:12 07/05/24)(X gles1 gles2 llvm opencl vaapi vulkan wayland zstd -d3d9 -debug -lm-sensors -osmesa -selinux -test -unwind -valgrind -vdpau -vulkan-overlay -xa -xvmc -zink ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="-32 -64 -x32" CPU_FLAGS_X86="-sse2" VIDEO_CARDS="imagination -freedreno -intel -lima -nouveau -panfrost -r300 -r600 -radeon -radeonsi -v3d -vc4 -virgl -vivante -vmware")
 Homepage:            https://www.mesa3d.org/ https://mesa.freedesktop.org/
 Description:         OpenGL-like graphic library for Linux