Arch Linux Image for VisionFive 2

It had been a while. The old kernel was vmlinux-5.15.2-rt20-cwt9-rvalles. It’s rvalles because I had tweaked the config, don’t remember what for.

OMG cwt9->cwt16 that was a lot!

1 Like

FYI: cwt16 image is here: Release cwt16 · cwt/Arch-VF2-Image · GitHub

It’s compiling, and I’ll be sleeping. Fingers crossed it works.

i see we are overlapping on the firmware files. It makes more sense to ship them with the kernel, so i remove them from the user-space packages.

Checking out what wave5 kmod does and how it’s accessible from user space. hope it wasn’t all for nothing :smiley:

2 Likes

404 here, github shows the latest as cwt15 …

Sorry, I just re-upload the image.

Somehow, dd the SPL and U-Boot directly onto the image partitions no longer works and produces an unbootable image. (I mean boot on SD mode with dip switch [0,1])

  • Currently using partition 1 and 2 from the Debian 202308 image as a workaround.

https://doc-en.rvspace.org/VisionFive2/Boot_UG/JH7110_SDK/boot_address_allocation.html
Since document release 1.2, boot from SD Card or eMMC is no longer recommended. But to maintain the code structure, the following SD/eMMC boot address allocations are modified as “reserved”. Be aware of this change when designing your device based on JH7110.

And looking at the document history, under preface, document release 1.2 was 2023-07-14

And the default boot flow has been modified:
https://doc-en.rvspace.org/VisionFive2/Boot_UG/JH7110_SDK/boot_flow.html
System will detect in sequence whether it can boot from the following device sequence: NVMe > SD > eMMC. For example, if the boot program is found on the SD, eMMC will be ignored.

1 Like

Thanks. Booted off the SSD. Even got the full 8GB again after updating / rebuilding jh7110-visionfive-v2.dtb

Note this was with the old (3.4.5?) firmware. About to flash 3.6.1.

So this little toy screen recorder never used to pick up any codecs (video or audio); now it does. However, not particularly useful without a more functional xdg_portal in wayfire.

2023-09-01_141831

2 Likes
[    9.124043] sch_fq_codel: Unknown relocation type 57
[    9.518834] rfkill: Unknown relocation type 57
[    9.712199] starfive-eth-plat 16030000.ethernet end0: renamed from eth0
[    9.736335] starfive-eth-plat 16040000.ethernet end1: renamed from eth1
[   10.376893] backlight: Unknown relocation type 57
[   10.439312] random: crng init done
[   10.448241] goodix: Unknown relocation type 57
[   10.565895] v4l2_mem2mem: Unknown relocation type 57
[   10.570534] imx219: Unknown relocation type 57
[   10.572397] imx708: Unknown relocation type 57
[   10.589240] ov4689_mipi: Unknown relocation type 57
[   10.872523] starfive-eth-plat 16030000.ethernet end0: PHY [stmmac-0:00] driver [YT8531 Gigabit Ethernet] (irq=POLL)
[   10.872996] starfive-eth-plat 16030000.ethernet end0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   10.873252] dwmac4: Master AXI performs fixed burst length
[   10.873268] starfive-eth-plat 16030000.ethernet end0: No Safety Features support found
[   10.873310] starfive-eth-plat 16030000.ethernet end0: IEEE 1588-2008 Advanced Timestamp supported
[   10.875259] starfive-eth-plat 16030000.ethernet end0: registered PTP clock
[   10.875782] starfive-eth-plat 16030000.ethernet end0: configuring for phy/rgmii-id link mode
[   11.453361] dm_mod: Unknown relocation type 57
[   11.495043] dm_mod: Unknown relocation type 57
[   11.602003] fuse: Unknown relocation type 57
[   11.604067] dm_mod: Unknown relocation type 57
[   11.647581] dm_mod: Unknown relocation type 57
[   11.669771] usbip_core: Unknown relocation type 57
[   11.695094] usbip_core: Unknown relocation type 57
[   13.989625] starfive-eth-plat 16030000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx
[   13.989695] IPv6: ADDRCONF(NETDEV_CHANGE): end0: link becomes ready
[   33.250826] mipi_0p9: disabling
[  666.256399] dm_mod: Unknown relocation type 57
[  706.978584] FAT-fs (mmcblk1p3): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[  834.947422] encrypted_keys: Unknown relocation type 57

Built cleanly with gcc and installed the three packages. Now, kernel modules do not load (wtf?), with the Unknown relocation type 57 error above.

[root@starfive ~]# lsmod
Module                  Size  Used by

Could it be related to this?

[root@starfive pkgbuild-linux-cwt-starfive-visionfive2]# grep -i clang PKGBUILD
makedepends=(bc libelf pahole cpio perl tar xz clang lld)
  'soft_3rdpart-1-use_clang_for_llvm.patch'
[root@starfive pkgbuild-linux-cwt-starfive-visionfive2]# grep -i llvm PKGBUILD
  'linux-4-eswin_6600u-llvm.patch'
  'soft_3rdpart-1-use_clang_for_llvm.patch'

no, if you didn’t put LLVM=1 it won’t do anything.

+ifneq ($(LLVM),)

but the error ‘unknown relocation type xxx’ sounds pretty much related to llvm.

1 Like

Well, either way no idea why module loading is broken with gcc built kernel.

Can you run makepkg with and option to extract only and then cd into the src and run make menuconfig without LLVM=1, then save. This will create a new .config for gcc, then cp it to replace config file in the package and rebuild it again?

(Sorry, I’m on phone can’t check for exact command.)

Sure. I am going to try this.

It’ll take a few hours to rebuild, will let you know whether that made modules work, and whether encryption is any less broken.

Building. I went ahead and changed a few things too:

CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=n
CONFIG_CRYPTO_DEV_JH7110_ENCRYPT=m

I recommend also applying these on your end.

The former, as these self-tests might actually detect problems.

The latter, as any issues with the jh7110 cryptography acceleration driver could then be worked around by simply blacklisting the module.

Building now.

1 Like

some more video enc/dec testing on Arch 5.15.2-cwt-3.6.1-1

mpv -hwdec=auto does seem to detect the wave5 v4l2 decoder but segfaults in libva, even with -vo null. Does this work on the new Debian image?

  • build ffmpeg 4.4.1 with omx patches ../configure --prefix=$CURDIR/target/usr --arch="riscv64" --target-os="linux" --disable-debug --disable-static --disable-stripping --enable-amf --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan --enable-omx --extra-ldflags="-L$CURDIR/target/usr/lib" --extra-cflags="-I$CURDIR/target/usr/include/omx-il" --extra-libs="-lOMX_Core
    ffplay was missing, still gonna tweak the compile flags

  • hardware decode x264 and hardware encode to x265 worked ffmpeg -v verbose -vcodec h264_omx -i x264.mp4 -vcodec hevc_omx -b:v 8M x265.mp4

  • re-build omx-li against patched ffmpeg

  • build gst-omx against omx-li

$ gst-inspect-1.0 omx
[...]
  omxh264dec: OpenMAX H.264 Video Decoder
  omxh264enc: OpenMAX H.264 Video Encoder
  omxh265dec: OpenMAX H.265 Video Decoder
  omxh265enc: OpenMAX H.265 Video Encoder
  omxmjpegdec: OpenMAX MJPEG Video Decoder

gstreamer x265 hardware decoding was playable under wayland

WAYLAND_DISPLAY=wayland-1 gst-launch-1.0 filesrc location=x265.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h265parse ! omxh265dec ! waylandsink

Edit:
weston --backend=drm
and
gst-play-1.0 --videosink='waylandsink fullscreen=true' --audiosink='alsasink device=default:CARD=StarfiveHDMISou' plays x264/x265 at 1080p perfectly fine. I could not set a 4k resolution in weston with a 4k screen, would always remain at FHD. 4k files also play fine down-scaled.

patched ffmpeg i would probably package with /opt/ffmpeg as prefix

2 Likes

Followup: This is what I got.

In short, the crypto manager test fails miserably, and this was with gcc, thus not clang-specific.

Confirming that cryptography support really is broken in this kernel. And as no modules are listed as loaded above (although perhaps the list corrupted?), this must be happening very early.

I’ll investigate a little more.

@rvalles There is one patch related to crypto

do you think this cause it?

1 Like

Failure is quite early, I believe it’s before it even touches the initramfs.

Diffie-Hellman is built in, thus it could.

Ultimately, this patch talks about “in preparation for” a future patch we don’t have. It is thus superfluous.

I will now try disabling it and rebuilding the kernel.