Kernel & Rootfs installation:
- @Eric_Woudstra prepared this install script for ease of uses at https://github.com/ericwoud/buildRKarch
- @kwankiu prepared this install script for ease of use https://github.com/kwankiu/archlinux-installer-rock5
- @Etienne created a step by step guide on how to create an image and install to rock 5b here: https://fire-wolf-934.notion.site/Rock5B-18151a42a6224f2bba3aba6faf5f3cc3
-
You need a working rootfs. Easiest way to do is to install Radxa Debian Image. Advanced users can do it in very different other ways.
-
Get the AArch64 generic rootfs tar ball and overwrite the rootfs of the debian image.
https://archlinuxarm.org/platforms/armv8/generic. -
Reboot device to arch linux, and install the
linux-radxa-rkbsp5-bin
orlinux-radxa-rkbsp5-git
package mentioned in the above. You have to install it withmakepkg -si
in the folder where the PKGBUILD exists for the given package. Now you have a maintainable kernel which is in sync with Radxa Debian OS Releases (When packages are AURed). The git version compiles the kernel from the latest source code available so it takes a lot time and space to compile but gives the latest available features, the bin package will install the latest released version of Debian Kernel by Radxa
Note: If you are a previous package user you have to adapt the extlinux.conf file with the new filenames. -
After mounting your boot parition to somewhere you know, navigate to
/boot_partiton_mount_place/extlinux/extlinux.conf
file and adapt it to the new kernel initramfs and dtb locations. A sampleextlinux.arch.template
file is provided under/boot/extlinux/
directory. You can simply overwrite this file to extlinux.conf and adapt your UUID in the the append section or copy the Archlinux part in it and use it in your existng file if you have other stuff that you want to preserve in your extlinux.conf -
If you want Arch to manage the kernels, simply mount your first boot partition to /boot folder in rootfs. In my setup i use NVME drive and the following fstab entry handles it properly. Make sure to adapt your device if you are not using NVME (mmcblk for sdcard etc).
/etc/fstab:
/dev/nvme0n1p1 /boot vfat dmask=000,fmask=0111,user 0 0
- After a restart, device will boot from arch packages. Whenever you do a system upgrade the kernel will be automatically updated. Note that this is meant to be working with Radxa Deian & Ubuntu bootloaders. I dont know how it works with Armbian bootloaders so you have been warned.
GPU OpenGL Acceleration with Panfork:
-
If you want HW Acceleration install gnome
sudo pacman -S gnome
. Let if finish, after done replace the mesa package withmesa-panfork-git
. -
Simply go to the mesa-panfork-git folder and execute
makepkg -si
and when asked by pacman, replace mesa and libglvnd with the panfork variant. -
Then simply start gnome with
systemctl start gdm
and enjoy. -
There is already a mesa-panfork-git package in AUR you can use this it will have the same affect. You do no need my packages for this, i am just keeping it to have more control.
Video Decoder Accelaration with FFMpeg & RKMPP
-
Install the packages mpp-git, ffmpeg4.4-mpp, ffmpeg-mpp, kodi-stable-mpp-git.
-
Make sure that your user is added to video group. This is neceesary for user space applications to access mpp drivers other-wise, video acceleration will not work. You can verify this by issuing
groups
and check if thevideo
group is there, if not, you can add your user withusermod -A -g video myuser
. Please note that after a user is added to a new group, restart is required to make it active. -
You can use all applications which depends ffmpeg4, ffmpeg with the acceleration. Please note that some software may categorize it SW decoder but in reality it is an hardware accelrated decoder. Only the verify you can see that the codec name has _rkmpp suffix at the end of it.
Here are some screenshots of 4k 60fps h264 decoder. This should work for VP8, VP9, H263, H264, MPEG1&2&4 yet i only tested h264.
Browser Acceleration:
I have only gathered the exsiting information so the actual credit here goes to @icecream95 for this RGA interface patch @amazingfate for his previous packaging efforts and of course @jeffyCN actually providing the RKMPP patches to FFMpeg.
First of rockchip has not va-api user space driver.
There two ways provided in the BSP.
1st option:
is to use v4l-rkmpp plugin which also patches v4l-utitls, and also patches chromium. This is how it works in Armbian. I do not follow this approach because it is hard to maintain the patches on each chromium release, and re-compiling chromium is not the best experience. How ever this might be the performance-wise faster way, yet i have no measurements to back it up. Would also like to see comparisons.
2nd option:
Browsers use FFmpeg when they fallback to software decoder, but our patched ffmpeg uses hardware accelerated MPP + RGA interface as default option. Replacing the system ffmpeg will suffice in that case.
Security Concerns: Since in each v4l-rkmpp or ffmpeg-mpp scenario, the browser needs to access kernel, and browsers disallows this behabiour for our security. To use video decode acceleration we need to bypass this, so you have been warned.
Firefox Video Decoder Acceleration:
Simply run MOZ_DISABLE_RDD_SANDBOX=1 firefox
. The first environment variable disables security checks so that ffmpeg do its work. This will bring āMPEG1,2,4 H263 & 264, VP8&9ā acceleration provided by ffmpeg to firefox. You can easily 4k with it, See below SS for cpu load reference in 4K VP9 video.
HEVC is not supported by firefox and actually the web is also not ready for it, AV1 is not supported by BSP kernel, ffmpeg and mpp part is ready but we need a working kernel.
Chromium Video Decoder Acceleration
The librga patch inside the ffmpeg brakes the chromium video playback, i think the could be something wrong with memory alignment but dont take my word on it. It needs the attention someone who knows what he is talking about. It might occasionally work, but at the end it will crash. The VP9 youtube videos are not affecting because Chromium is not using ffmpeg for VP9 instead uses libvpx. And this is another reason not to use Chromium with this approach because even if the crash problems would be resolved, you would still need to recompile chromium because all the distros enable libvpx over fdmpeg by default. So moral of the story donāt use chromium for video.
Firefox GL Acceleraion with wayland and X11
if you run Firefox MOZ_ENABLE_WAYLAND=1 firefox
env value, GPU acceleration will come directly. You dont have to do anything. For x11, i can only accelerate GL rendering, but the webrender is still in software mode. To enable GL rendering on X11, goto about:cofig
and enable layers.acceleration.force-enabled
config value. You can verify it in the page about:support
. If you are using wayland you dont have to, it comes automatically.
Chromium GL Acceleration with Wayland and X11
I comes automatically. You can verify under chrome:gpu
page. If you have issues, you can try with --in-process-gpu
flag when calling the chromium.
TL&DR GPU Acceleration
Install ffmpeg-mpp package and use firefox in wayland and start with MOZ_ENABLE_WAYLAND=1 MOZ_DISABLE_RDD_SANDBOX=1 firefox
Troubleshooting:
- There already is a mesa-panfork-git package in the AUR, but it complies the rest of the drivers rather than panfrost. I had problems with screen glitching and color channels swapping with that build. I dont know the reason, the one in github repo is a strict panfrost compilation and i did not have any issues with that. We can merge both those into 1 single when things settle down.
- If you plan to use existing AUR version it does not bundle the g610 firmware at mali_csffw.bin You have to manually install it to /usr/lib/firmware
- Especially if you have 4GB ram compiling mesa can cause OOM time to time. To prevent issues, add a swap disk or file.
- You can verify FF is really using Hwdecoder by adding
MOZ_LOG="PlatformDecoderModule:4
env value when spawning the firefoxMOZ_ENABLE_WAYLAND=1 MOZ_DISABLE_RDD_SANDBOX=1 MOZ_LOG="PlatformDecoderModule:4" firefox
, now you should see rkmpp variants of the decoders are actually being used by FF. Additonally you can addmpp_debug=1
ormpi_debug=1
and mpp library should spit some debug log data on tojournalctl -f
- If your Browser plays few frames and then suddently stops, it is because the audio output is routed to no existent audio device. Just go to sound settings and select a proper output. This may sound silly, but actually wasted 4 days to figure this out.
- You can use https://tools.woolyss.com/html5-audio-video-tester/ site to test various video formats
- You can use https://webglsamples.org/aquarium/aquarium.html site to check webgl acceleration.
- If you dont want add environment variables to your system you can inject them with editing the .destop files in /usr/share/applications and set the Exec variable as below:
Exec=env MOZ_ENABLE_WAYLAND=1 MOZ_DISABLE_RDD_SANDBOX=1 /usr/lib/firefox/firefox
Revisions:
10.04.23: Added create a new guide
05.01.23: Updated Linux and Panfork package names and dependencies
08.01.23: Added support for video decoder hardware acceleration
18.01.23: Added Browser Acceleration
23.01.23: Added Kernel Git packages, and renamed the existing as per Archlinux conventions