October 20, 2020, 04:33:52 pm


Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/

Retroarch on Cubietruck

Started by dareaper, June 19, 2014, 06:24:33 am

Previous topic - Next topic


June 19, 2014, 06:24:33 am Last Edit: June 19, 2014, 06:26:25 am by dareaper
Hi everyone.
When i firs got my retroarch i wanted to make an Retro Emulatios station out of it.
As it seems the RPi for example is much better supported for that kind of task as the Cubietruck though I took the chanlenge with a friend of mine (i just some kind of script kiddy)

I just wanted to report what i got so far and see if their are maybe more people willing to help to get it perfect:

My approaches:

1. Took the debian wheezy img as base

2a. Toyed around with "lima"

installed all sunxi binary and compiled retroarch with lima support though it wouldnt start.

then i took drivers from here https://github.com/tobiasjakobi/lima-drm which supposed to be for a simmilar device, my friend made some changed to the code that it would force it to use the framebuffer instead of the drm. It worked, i had retroarch running at great speeds though the screen is sometimes not alligned right (maybe fixable?)

2b. Toyed around with GLES

Ok it was good but still not optimal.
I tried the approach with GLES from what my experience so far is it only seems to work in an X environment.
So i made some basic X running (really only the X server, no window manager) and compiled some gles drivers for X.
This runs pretty good as well... though i have some tearing (just a little) on some games. and it seems you have to stick to low resolutions. Which is not the case for the lima approach as it dynamicly switches the resolutions.

I then found the disrtibution lakka.tv and it seems that would be a much cleaner solution but their are not that far done with the cubie as it seems.

Soooo this is just a quick overview. I just want to know if their more people intrested in this and may be willing to help. I can post more details to my approach or give you screenshots or whatever.

Love my Cubie!

Ah yes I have dosbox and scummvm running as well! For scummvm i compiled an old 1.3.1 version which seems to be the only one running for me.


Framebuffer is the way to go imho.


Hi dareaper, it's kivutar from lakka.tv

Our branch for Cubieboard2 is ready now, it can boot, and go through systemd and launch RetroArch.
I packaged all the sunxi-mali binary drivers, and compiled RetroArch with --enable-gles and --enable-mali_fbdev

I can see rgui or the lakka menu, but get a black screen when launching a core.

I would like to try and improve your mali+fbdev way, can you join us again or publish the code somewhere please?


The priblem you are facing is the lack of proper GLES support in most cores.

See my attempt at retroarch:

I used the folowing retroarch lib as it supports proper gles/egl. I have no idea of the current state of the retroarch project or the support for egl/gles but looking at the commits they did a lot of things this fork also did. (https://github.com/AreaScout/RetroArch)

To check compile flags etc. see the config.log files in the image i created a while back (http://www.cubieforums.com/index.php/topic,1759.msg12469.html#msg12469). Havn't been able to work on it due to finishing my masters thesis and working full time at the same time for the past year.

This project is no way meant for beginners as it requires (quite) some knowledge about the autoconf system to get working properly and some sdl/c hacks. You could probably boot the image and chech the diff with the git repro to see the changes. Maybe the entire compile command will be in the .bash_history file of the linaro/root user ;) .

If I get some free time (if!) it's going to be this winter when i'll give it a go again.


On the black screen issues it's one of the following:

- Your monitor doesn't support the resolution
- SDL tried switching the screen resolution and failed but says it didn't (happens a LOT)
- SDL failed at doing anything and disabled the video core (sound should still play)
- EGL/SDL tried a GL command and segfaulted the mali libraries (see kernel log or console)

- Buy a better monitor
- Force SDL to use one resolution only. This was my fix for most problems as SDL tried "Optimizing" things and hopelessly failed.
- Compile with proper EGL/GLES support.
- The library still contains GL calls even when you compiled with EGL/GLES support. Remove and modify the calls to fit to the GLES standard and the problems will go away (segfaults at least, not crappy screen performance).


can you please upload the image of this (without roms i dont have problem) OR you can put detailed instructions how to do it?


RetroArch now runs without any problem on the Cubie/Cubie2/CT, using the superior GLES2 without X solution (no stupid Xorg involved at all: optimal framerate and no input lag!):
You need:
-This kernel: https://github.com/mireq/linux-sunxi
-These MALI libs: https://www.dropbox.com/s/w266b50gnze44m3/r4p0-mp400-fbdev.tar?dl=0
-These RetroArch binaries I did so you can finally enjoy decent emulation on the CT/CB2 (includes cores, yay!):

-These headers in case you want to build yourself: https://www.dropbox.com/s/ior83ho81wb7l87/r4p0_HEADERS.tar?dl=0
-This code file if you want to build yourself also: https://www.dropbox.com/s/ykfv7ckdlofqof1/mali_fbdev_ctx.c?dl=0. You will have to overwrite current gfx/context/mali_fbdev_ctx.c with this for now, until changes I did are merged in mainstream RetroArch.

I HIGHLY recommend this image to start with: http://www.cubieforums.com/index.php/topic,1275.0.html
Then you install the new kernel, install the libs, and use the binaries I provided, and there you go, perfect framerate emulation on the Cubie using GLES2 on the framebuffer! :D


Nice job!

Maybe it could be useful to provide more info or a tuto:
-to install kernel
-to install mali libs



Good work, have you tried with USB HID peripherals?

I need to get my Cubie out to try this build.  I had retroarch pseudo working on Framebuffer, but GLES2 is better.


December 07, 2014, 09:51:56 am #9 Last Edit: December 07, 2014, 09:54:54 am by null
Where is RetroArch git with yours modifications ?


-To install mali libs, just uncompress them into /usr/lib
-To install new kernel, you can now simply decompress this kernel's uImage (http://mirror.igorpecovnik.com/kernel/cubietruck_kernel_3.4.105_mod_head_fw.zip) in /boot and send the kernel modules modules to /lib. It's very easy!
-The GIT with my modifications is here: https://github.com/vanfanel/RetroArch
The only modifications I did are restricted to the mali_fbdev_ctx.c file. They should be merged into upstream RetroArch, but they are not, so you can use my fork OR simply use upstream RetroArch sources and overwrite the mali_fbdev_ctx.c file.


Hi guys!

Now you can ditch these GLES2 binary blobs (f**k you, Allwinner!!) and run RetroArch on G2D using my Sunxi G2D driver.
Simply clone RetroArch's github repo here:

git clone https://github.com/libretro/RetroArch.git --depth 1

Configure like this:

./configure --enable-sunxi --disable-opengl --disable-gles --enable-neon --disable-x11 --disable-sdl2 --enable-floathard --disable-ffmpeg --disable-netplay --enable-udev --disable-sdl --disable-pulse --disable-oss --disable-freetype --disable-7zip --disable-libxml2 --disable-parport

make and run! :)

No binary blobs required at all, just a good kernel. I use this distro:



April 04, 2015, 09:20:44 am #12 Last Edit: April 04, 2015, 01:16:29 pm by dareaper
hey vanfanel,
i tried reproducing your new method and i kinda fail.

I ve used a jessie 3.0 igor image:

The RetroArch git doesnt compile with the suxi config, so i tried your git which seems to have the patches integrated.
It compiles succensfully. It even starts in the menu but all cores segfault for me.

Any Advice? do i have do give kernel parameters for gfx memory? Maybe somthing like that?
Thanks for all your effort in this topic!

Ok it works if i launch retroarch with -L option and add an rom. But as soon as i switch rom in rgui it segfaults again.

So it works from commandline like:

retroarch -L /core/snes-next.so /path/to/rom
if i go to rgui and start another rom/unload core it segfaults.

framerate seems awesome, though i didnt finalize my setup since starting roms from the commandline in not a real option for me.


Quote from: vanfanel on March 12, 2015, 01:15:39 pm
Hi guys!

Now you can ditch these GLES2 binary blobs (f**k you, Allwinner!!) and run RetroArch on G2D using my Sunxi G2D driver.
Simply clone RetroArch's github repo here:

git clone https://github.com/libretro/RetroArch.git --depth 1

Configure like this:

./configure --enable-sunxi --disable-opengl --disable-gles --enable-neon --disable-x11 --disable-sdl2 --enable-floathard --disable-ffmpeg --disable-netplay --enable-udev --disable-sdl --disable-pulse --disable-oss --disable-freetype --disable-7zip --disable-libxml2 --disable-parport

make and run! :)

No binary blobs required at all, just a good kernel. I use this distro:



I've been trying to compile Retroarch using the above instructions. I'm able to get by the configure section. However once I try to make I get the following error. Hoping someone can help.

gfx/drivers/sunxi_gfx.c: In function âsunxi_set_texture_frameâ:
gfx/drivers/sunxi_gfx.c:899:18: error: âdst_widthâ undeclared (first use in this function)
    uint32_t line[dst_width];
gfx/drivers/sunxi_gfx.c:899:18: note: each undeclared identifier is reported only once for each function it appears in
Makefile:103: recipe for target 'obj-unix/gfx/drivers/sunxi_gfx.o' failed
make: *** [obj-unix/gfx/drivers/sunxi_gfx.o] Error 1