Retro Gaming on Orange Pi 4 LTS?
I was misfortune enough to buy a SBC (single board computer) called "Orange PI 4 LTS". At first, it looked very promissing - it was having quite a powerfull multicore cpu and built-in BT, WiFi, Ethernet, HDMI and had onboard 16 Gb eMMC chip flashed with some debian (or ARMbian) based linux called "Orange PI OS", but the vendor also provides custom builds of Debian, Ubuntu and Android. What could go wrong? I thought of myself as of experienced linux user, knowing my ways around and knowing how to google things.
The idea behind the purchase was to try this machine out for few simple tasks:
- self hosted photo service like Photoprism, Piwigo, Lychee, Plex, Librephotos or Nextcloud
- retro gaming device, so I could hook up couple of cheap bluetooth gamepads and play along with my little wee in console games I never played, because I had a PC from my first grade in school :)
The unfortunate thing I discovered, that most of the "retro gaming distros" (like Batocera, Recallbox, RetrOrangePi, Lakka) are not supporting this board, which is having ARM CPU Rockchip RK3399. To be entirely honest, some of them are having custom builds to support a very close SBC - RockPro64, which is also RK3399 based, but given it's having a different chip which implements Wifi and Bluetooth - I won't have thouse on my board. I also seen URLs for Orange PI 4 LTS builds on some forums/email threads, so I was bit optimistic.
I decided to start with retroarch, as essentially it's used in number of gaming distros, but eventually I don't like dedicated distros, like game dedicated distros, and having a general purpose distro which I can occasionally use for gaming was looking like a better option to me.
In this post i tried to summarize all the pain you have to walk through to get something like Retroarch working on this shitty machine.
Some Orange PI 4 LTS Specs
CPU RK3399 4 Gb DDR4 RAM 16 Gb EMMC WiFi 5 + Bluetooth provided by some rare chip CDW.20U5622-00 GPU Mali T860 • Supports OpenGL ES1.1/2.0/3.0/3.1,OpenVG1.1,OpenCL,DX11 • Support for AFBC
More specs here - http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/details/orange-pi-4-LTS.html
Official wiki - http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_4_LTS
Official PDF documentation - https://drive.google.com/file/d/1VnZOfpgrmUapTpcx77PhwJ808eCvkGrE/view?usp=sharing
Official linux images (and other downloads) - http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-pi-4-LTS.html
Stop reading it here
An attempt to make it straightforward - "Retroarch on Orange Pi OS 3.0.0" - FAILED
At first I just installed Retroarch with APT and it didn't work. I mean it started up but then right after it was crashing. I had to play a bit and ran it from terminal with --verbose option to see what is going wrong. The trick was - that shitty Retroarch had installed its one config file to usual to me location like /etc/retroarch/retroarch.cfg but when I was running it under my own non-root user, it was generating a fucking new config file under ~/.config/retroarch/retroarch.cfg. So whatever changes I was trying under /etc/ were all wasted, because it wasn't even looking them up. Great job, retroarch developers! Why to bother to deploy that pesky config file in /etc/ with package first of all, if it's not even being used?
Anyways the issues with the retroarch running on out-of-box Orange Pi OS 3.0.0. were more or less overcame by:
- changing the default "skin" from "xmb" to "rgui". That was really unexpected thing
- setting the videodriver from "gl" to "sdl2" (for some reason OpenGL drivers didn't quite work in that bollocks "Orange PI OS")
So I got at my hands very nice looking Retroarch, which appeared to me just a useless menu . No matter what librerto cores I tried - from internet, from apt - nothing worked. Every time it was the same shit - "segmentation fault", whenever I tried to run some game using retroarch core. I gave up trying
Another attempt to make it - other conventional emulators ("Higan on Orange PI OS") - SUCCEEDED
I was damned pissed off to see Higan and few other emulators I installed through apt were working just fine. Oh those retroarch developers, I love you. I don't know what kind of shit you were smoking, but its ain't for good.
So what then? I don't like the idea of using old-facioned window of Higan with my keyboard and mouse to start the game first, so I can use bluetooth gamepad for gaming. It's like I need to have 3 devices nearby after switching on the PC instead of having just one. So I still needed to make that shitty Retroarch (or any suitable replacement) to work
Retroarch flatpak on Orange PI OS - FAILED
At this point I started to think it might be something wrong with the retroarch package itself, given higan was working just fine. As I already learnt there were some signs to it, like not all the "skins" were working. I decided to give it a try and install it via modern blows-and-whistles thing called "flatpack". By the way I love the idea, it's much more advanced compared to all regular package managers in distros and it's really a future of software distribution because it solves all this integration hell of ordinary linux distros. Here's what you need to do (see https://github.com/flathub/org.libretro.RetroArch):
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak install --user -y flathub org.libretro.RetroArch flatpak run org.libretro.RetroArch ./.var/app/org.libretro.RetroArch/config/retroarch/retroarch.cfg core_updater_buildbot_cores_url = "https://buildbot.libretro.com/nightly/linux/armhf/latest/" https://buildbot.libretro.com/nightly/android/latest/arm64-v8a/
The funny thing is, this version works just fine, but it also missing "cores". I tried few repos with retroarch cores, but coudln't find cores for ARM64 working with my linux anywhere on internet yet.
Welcome to the fucking world of ARM, which is told to be a future of computer industry, but it's all again down to missing software and pesky linux compatibilities issues. I know exactly why ppl are stick to x86 - because of all this shit.
GLXInfo on Orange PI
Upgrade Mesa3d by building them from the very last source - FAILED
orangepi@orangepi4-lts:~$ glmark2-es2 arm_release_ver of this libmali is 'r18p0-01rel0', rk_so_ver is '4'.Error: eglInitialize() failed with error: 0x3001 Error: eglInitialize() failed with error: 0x3001 Error: main: Could not initialize canvasI thought there might be some relation to my failed attempts to make any of the libretro cores working in RetroArch (they all were failing with segfault), so I decided to attempt to upgrade that whole shitty Mesa3d drivers (follow https://docs.mesa3d.org/install.html for full instructions):
Install prereq:
apt install meson ninja-build meson --version ninja --versionDownload and build mesa: (there might be newer version already)
cd mkdir MESA cd MESA wget https://archive.mesa3d.org//mesa-22.1.5.tar.xz tar xf mesa-22.1.5.tar.xz rm mesa-22.1.5.tar.xz # uncomment mnaually deb-src lines in /etc/apt/sources.list apt-update apt-get build-dep mesa cd mesa-22.1.5/ mkdir installdir export MESA_INSTALLDIR=`pwd`/installdir # originally it was just # meson builddir/ -Dprefix="$MESA_INSTALLDIR" # but then I looked for panfrost support page - https://docs.mesa3d.org/drivers/panfrost.html
meson setup --wipe builddir/ -Dprefix="$MESA_INSTALLDIR" -Ddri-drivers= -Dvulkan-drivers= -Dgallium-drivers=panfrost -Dllvm=disabled ninja -C builddir/ install LD_LIBRARY_PATH="$MESA_INSTALLDIR/lib64" glxinfo
So the above fails on running "meson" (a kinda replacement for ./configure scripts in other open source projects) with this:
Dependency libdrm_nouveau found: NO found 2.4.104 but need: '>=2.4.109' Run-time dependency libdrm_nouveau found: NO (tried cmake) meson.build:1620:4: ERROR: Invalid version of dependency, need 'libdrm_nouveau' ['>=2.4.109'] found '2.4.104'. A full log can be found at /home/orangepi/MESA/mesa-22.1.5/builddir/meson-logs/meson-log.txtSo in my shitty distro, the latest version of libdrm_nouveau is indeed 2.4.104 and given it's some kind of interface library of the actual shit which is compiled into kernel I cannot move ahead without updating kernel. I hate linux.
An attempt to install the most recent Armbian - SUCCESS
I have given up the idea of making that "Orange Pi OS 3.0.0" frankenstain to work, so I decided to flash an SD card with this armbian image to see if things are working fine there - https://www.armbian.com/orange-pi-4-lts/
It worked just fine, I managed to boot my Orange PI 4 LTS from SD card, to which I flashed the Armbian XFCE image with "balena etcher" exactly how instruction says. Te original "Orange PI OS" stayed on EMMC. I'll prob return to it bit later. The first thing I did is usual apt upgrade ; apt upgrade . Interestingly though, that the distro is having like zillion of different APT repos connected by default, and packages are coming to it from all over the place, like from Ubutntu, Armbian and handful of personal package archives (PPAs). So during that "apt upgrade" phase, some package attempted to override /etc/issue and /etc/issue.net files. Funny.
But now I got Armbian 22.05.4 running linux kernel 5.15-52
Checking OpenGL drivers on Armbian until I mess with it
export DISPLAY=:0.0 glmark2 - works perfectly root@orangepi4-lts:~# glxinfo | grep -i version server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Version: 22.3.0 Max core profile version: 3.1 Max compat profile version: 3.1 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.1 OpenGL core profile version string: 3.1 Mesa 22.3.0-devel (git-b731be2 2022-08-06 jammy-oibaf-ppa) OpenGL core profile shading language version string: 1.40 OpenGL version string: 3.1 Mesa 22.3.0-devel (git-b731be2 2022-08-06 jammy-oibaf-ppa) OpenGL shading language version string: 1.40 OpenGL ES profile version string: OpenGL ES 3.1 Mesa 22.3.0-devel (git-b731be2 2022-08-06 jammy-oibaf-ppa) OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10 GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
Running RetroArch on Armbian - FAILED
It's not an entire failure thought. I manged to apt install it right from connected ubuntu repo, and it did startup even with that default "skin" (they call it "menu driver") which didn't work on "Orange PI OS". I installed some cores with apt:
$ apt list --installed | grep libretro- WARNING: apt does not have a stable CLI interface. Use with caution in scripts. libretro-bsnes-mercury-accuracy/jammy,now 094+git20160126-3build1 arm64 [installed] libretro-bsnes-mercury-performance/jammy,now 094+git20160126-3build1 arm64 [installed] libretro-core-info/jammy,jammy,now 1.4.1+git20170210-1 all [installed] libretro-snes9x/jammy,now 1.53+git20160522-1build1 arm64 [installed]... but none of them working properly. It looks like this, whenver you attempt to run any game from retroarch, the app shuts down with this shit printed to console:
retroarch --verbose ... [INFO] [GL]: VSync => on [INFO] [EGL]: eglSwapInterval(1) [INFO] Written to playlist file: /home/bugman/.config/retroarch/content_history.lpl *** longjmp causes uninitialized stack frame ***: terminated Aborted (core dumped)
Given the very last message in the log is related to VSync - I tried to switch that beast off, but it still getting printed like it's own. Oh those RetroArch developers. Another fucking bug. Did I tell you how I hate all that already?
Running Higan on Armbian - FAILED
Building higan from sources - IN PROGRESS
Building MESA/panfrost on Armbian
Sidenote - some flags you can affect MESA drivers
https://docs.mesa3d.org/envvars.htmlSidenote on using Bluetooth joystick/gamepad on Linux
evtest - can be installed from packages, a handy tool to make sure your Bluetooth joystick / gamepad works fine. Mine was working fine and was found under /dev/input/event10
I prefer to test hardware in some lightweight dedicated testing tools like this, to make sure at least it can be detected and works normally, before moving to something bigger. I quite frequent google things like "how to ensure X is working?" or "how can I get to know B is being detected". This whole topic is very new to me, as I was running Linux on servers for a couple decades, but my desktop experience with all the desktop grade hardware like printers, scanners, usb camers, videocards, bluetooth and wifi is very limited
Surprisingly my own Bluetooth gamepads (some $15 cheap Defenders) were successfully paired in linux and were working just fine.
retrorangepi
https://pcminipro.ru/os/pervyj-zapusk-i-pervaya-nastrojka-retrorangepi/ [ERROR] [XVideo]: Failed to find valid XvPort or format. libmali-midgard-t86x-r18p0-x11/now 1.9-1 arm64 [installed,local]Sidenote on why I hate APT so much or accidental removal of important packages I cannot reinstall
Be careful while using shity debian-based distros with its shitty apt. I installed some package (can't even remember what) via apt and installed all the dependencies. They all were listed in apt log on a screen. So far so good. But later I decided to remove that package, but dependencies it installed before were not removed. I took them from the log and ran "apt remove xxx xxx" command. What happened then, it started to remove some extra packages I didn't ask him to, like below mentioned "orangepi-config". The issue was is that the shitty "Orange Pi OS" distro doesn't have all its packages in the repo, so there's no chance to restore it back with using apt again.
root@orangepi4-lts:~# apt remove libsdl2-dev libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libboost-locale-dev libfreeimage-dev libfreetype6-dev libeigen3-dev libcurl4-openssl-dev libasound2-dev libgl1-mesa-dev build-essential cmake fonts-droid-fallback Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: cmake-data g++ g++-10 gir1.2-ibus-1.0 libblkid-dev libboost-atomic1.74-dev libboost-atomic1.74.0 libboost-chrono1.74-dev libboost-chrono1.74.0 libboost-date-time1.74-dev libboost-date-time1.74.0 libboost-filesystem1.74-dev libboost-filesystem1.74.0 libboost-locale1.74-dev libboost-locale1.74.0 libboost-serialization1.74-dev libboost-serialization1.74.0 libboost-system1.74-dev libboost-system1.74.0 libboost-thread1.74-dev libboost-thread1.74.0 libboost1.74-dev libbrotli-dev libdbus-1-dev libegl1-mesa-dev libffi-dev libfreeimage3 libfreetype-dev libgles-dev libgles1 libglib2.0-dev libglib2.0-dev-bin libglvnd-dev libibus-1.0-5 libibus-1.0-dev libice-dev libilmbase25 libirrlicht1.8 libjxr0 libleveldb1d liblua5.1-0 libmount-dev libopenexr25 libopengl-dev libopengl0 libpcre16-3 libpcre2-dev libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpng-dev libpq5 libpulse-dev libraw20 librhash0 libselinux1-dev libsepol1-dev libsm-dev libsndio-dev libspatialindex6 libstdc++-10-dev libudev-dev libwayland-bin libwayland-dev libxcursor-dev libxfixes-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxrender-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev python3-distutils python3-lib2to3 uuid-dev x11proto-input-dev x11proto-randr-dev x11proto-scrnsaver-dev x11proto-xf86vidmode-dev x11proto-xinerama-dev zlib1g-dev Use 'apt autoremove' to remove them. The following packages will be REMOVED: build-essential cmake fonts-droid-fallback libasound2-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-system-dev libcurl4-openssl-dev libeigen3-dev libfreeimage-dev libfreetype6-dev libgl1-mesa-dev libsdl2-dev minetest minetest-data orangepi-config 0 upgraded, 0 newly installed, 17 to remove and 0 not upgraded. After this operation, 73.3 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 205716 files and directories currently installed.) Removing orangepi-config (3.0.0) ... Removing build-essential (12.9) ... Removing cmake (3.18.4-2+deb11u1) ... Removing minetest (5.3.0+repack-2.1+deb11u1) ... Removing minetest-data (5.3.0+repack-2.1+deb11u1) ... Removing fonts-droid-fallback (1:6.0.1r16-1.1) ... Removing libsdl2-dev:arm64 (2.0.14+dfsg2-3+deb11u1) ... Removing libasound2-dev:arm64 (1.2.4-1.1) ... Removing libboost-date-time-dev:arm64 (1.74.0.3) ... Removing libboost-filesystem-dev:arm64 (1.74.0.3) ... Removing libboost-locale-dev:arm64 (1.74.0.3) ... Removing libboost-system-dev:arm64 (1.74.0.3) ... Removing libcurl4-openssl-dev:arm64 (7.74.0-1.3+deb11u2) ... Removing libeigen3-dev (3.3.9-2) ... Removing libfreeimage-dev (3.18.0+ds2-6) ... Removing libfreetype6-dev:arm64 (2.10.4+dfsg-1+deb11u1) ... Removing libgl1-mesa-dev:arm64 (20.3.5-1) ... Processing triggers for bamfdaemon (0.5.4-2) ... Rebuilding /usr/share/applications/bamf-2.index... Processing triggers for desktop-file-utils (0.26-1) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for gnome-menus (3.36.0-1) ... Processing triggers for man-db (2.9.4-2) ... Processing triggers for mailcap (3.69) ... Processing triggers for fontconfig (2.13.1-4.2) ... ^C
Adding keys for PPA
GPG error: http://armbian.12z.eu/apt buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 93D6889F9F0E78D5
apt-key add ~orangepi/Downloads/armbian.key
No comments:
Post a Comment