Building RetroArch and cores from scratch on Pocket C.H.I.P


Greetings! I’m Auston, author of the Macifom NES emulator and an enthusiastic supporter of C.H.I.P.! For some reason I decided to forego sleep this evening and break in my new Pocket C.H.I.P. by building RetroArch and a few cores from scratch. I thought I might share the recipe as it’s an attractive alternative to Mednafen. C.H.I.P. OS being Debian-based, it was straightforward enough, though I stumbled upon some issues when configuring keyboard input and video.

EDIT: I’ve updated this to build both the SDL v1.2 and v2 drivers, as the former, while it has aspect ratio issues, is much quicker.
EDIT 2: Figured out a workaround for aspect ratio issues with the SDL v1.2 driver and updated my recommended settings for performant, scaled Game Boy video.
EDIT 3: Updated my screenshot to reflect the new recommended settings.

First, you’ll want to open Terminal and pull down the necessary tools and libraries:

sudo apt-get install build-essential git pkg-config libsdl2-dev libsdl1.2-dev

Next, clone the latest RetroArch sources from GitHub and build them. I’ve disabled a number of non-essential features to cut down the dependencies and build time.

git clone
cd RetroArch
./configure --enable-sdl --disable--sdl2 --enable-floathard --enable-neon --disable-opengl --disable-gles --disable-vg --disable-fbo --disable-egl --disable-pulse --disable-oss --disable-x11 --disable-wayland --disable-ffmpeg --disable-7zip --disable-libxml2 --disable-freetype
sudo make install

Note: You can instead use --enable-sdl2 --disable-sdl to use SDL v2 and get automatic aspect ratio preservation at the cost of performance. RetroArch does’t seem to be able to support both versions in the same binary.

Once you’re built RetroArch, you can run it from Terminal simply by typing retroarch. Do that to ensure that it works and writes out a default config to ~/.config/retroarch/retroarch.cfg. Depending on which drivers you selected, you may notice that the screen is zoomed in and clipped and the menu doesn’t respond to keyboard input. If so, tap the Home button, select Terminal and hit Ctrl-C to kill RetroArch and continue.

The visual issues can be addressed by adjusting settings in ~/.config/retroarch/retroarch.cfg. I recommend the following for full-screen Game Boy emulation:

video_driver = "sdl"
input_driver = "sdl"
input_joypad_driver = "sdl"
video_scale = "1.000000"
video_fullscreen_x = "302"
video_fullscreen_y = "272"
video_fullscreen = "true"
video_windowed_fullscreen = "false"
video_scale_integer = "false"
video_smooth = "false"
input_keyboard_layout = "us"
audio_latency = "128"

Note: If you built with --enable-sdl2, use ‘sdl2’ in place of ‘sdl’ in the above lines and the specify the full ‘480’ for video_fullscreen_x. The SDL v2 renderer will preserve the proper aspect ratio for each emulated system, though performance suffers. Also, if you’re using SDL v2, you’ll need to set an environment variable to prevent it from rendering with OpenGL, which currently results in atrocious performance:

export SDL_RENDER_DRIVER="software"

With all of that behind us we’re ready to build and install the many emulation cores available in the libretro repository:
I chose the excellent Gambatte core supplying Game Boy and Game Boy Color emulation for my testing. To try it out, you need only do the following:

First, clone the gambatte-libretro repository and compile the module:

git clone
cd gambatte-libretro/libgambatte
make -f Makefile.libretro

This will produce a shared object file that you can reference when invoking RetroArch like so:

retroarch -L "/path/to/" my_rom_file.gbc

By default the arrow keys are used for the directional pad, Z and X act as action buttons and Return as Start.

Here’s The Legend of Zelda: Oracle of Seasons running smoothly on my Pocket C.H.I.P. using SDL v1.2 and the above settings.

Open GLES Retroarch
How do I configure a generic USB keypad for RetroArch?
Cave story? On chip
RetroArch - Self build cores or download them?

I took a nap and then compiled the snes9x2010 core (better known as SNES9x 1.52) and was able to run Super Nintendo games at about half speed (~26fps).

git clone
cd snes9x2010
make -f Makefile.libretro
retroarch -L /path/to/rom.smc

Time to see what can be done about video performance.

NES Emulation with FCEUX

Sweet!! Good to see people working on another emulation alternatives like some others are doing with Mednafen, Lakka?, and some more standalone emulators. If it actually runs snes roms at less than 30 fps, do you believe that they will run full speed with some optimizations and the coming gpu drivers are ready? I don’t refer to games with SFX/SFX2 chips because those ones are a little heavy even when I run them using Retroarch Gamecube but at least the other ones.


My experience on iOS and OS X has been that drawing to the screen via a slow path with multiple inefficient copies and pixel format swizzling is often more costly than the emulation itself. I think there’s little doubt that a 1Ghz Cortex-A7 can handle semi-accurate (e.g. Snes9X 1.52+) SNES emulation with proper acceleration in place.


So I’ve done a bit more digging today and discovered a few interesting things:

  1. Not terribly surprising but mali_fbdev isn’t working in RetroArch with the included EGL / GLES libraries. Wedging in binaries from Odroid, also not surprisingly, didn’t work.
  2. For some reason SDL v1.2 is 20-50% faster than SDL v2 in RetroArch, especially when any sort of scaling is involved. Unfortunately, RetroArch refuses to preserve the aspect ratio of the game video when in fullscreen mode with the SDL v1.2 driver.
  3. Specifying either ‘sdl’ or ‘sdl2’ as the input_driver allows you to use Pocket C.H.I.P.'s built-in keyboard in RetroArch. ‘linuxraw’ is supposedly also supported but it aborts on launch in my build.


some one managed to run emulationstation, I will try both now :


BRILLIANT! If only i’d seen this in time to go into my review…

I had a go at building uae4arm but i’m no compiler settings expert and don’t know if i did an optimal job… I don’t suppose you’d consider doing the uae core next?


So I’ve done a bit more digging today and discovered a few interesting things:

There are no mali drivers available yet so any GL operations will fail


Thanks for your great work @macifom! I’ve adapted your instructions and put it up on the NTC blog. Keep up the great work!


Thanks for the shout-out, @dcschelt! I have a few more projects up my sleeve :slight_smile: As a side note, I discovered that if you supply the SDL v1.2 renderer with video_fullscreen_x/video_fullscreen_y values smaller than the screen’s native size it centers the resulting image. So you can have good performance and a proper aspect ratio, though you’ll need to adjust your settings for each emulated console. I’ll add in a note in my post.


Good find, @macifom. I’ll have to try this out on my install.


and about ?
is for raspberry and debian, could run on pocket chip?


@pietrondo, retropie appears to require GLES drivers for the Mali GPU. Unfortunately Next Thing and/or AllWinner haven’t released the binary drivers so we don’t have real hardware graphics acceleration yet.


Because I’m trying it on my raspberry (zero) and is “very good”!
I’ll wait the mali driver


I tried to follow the blog instructions but got stuck at the beginning. When I tried to download the git clone it asks for username and password. I tried entering my github username and password but nothing happens. I get a fatal error. Can someone help? Thanks a bunch. I’m a complete noobie to this but I want to learn.

[APT] Pocket Home (Marshmallow edition)

I got it working, however I need a little help getting a USB keypad/gamepad to work. Anyone tried to map buttons on something that doesn’t get picked up by the built-in mapping function?


Hi all,

First thanks to macifom for very helpful instructions. If you are interested, i just compile retroarch with the following cores: - AMSTRAD CPC - NES - GB/GBC - GENESIS / SMS / GAMEGEAR - GBA (bios place into system folder) - GAME AND WATCH - Compatible with MAME 0.37b5 romset - PC-ENGINE / CD - PSX - GENESIS - DOOM (prboom.wad place into rom folder) - SNES - SNES - ATARI 2600

I have made an archive containing RetroArch, Cores, Configuration and Dependencies. For install you can follow those instructions (ssh or directly on your pocketchip).

Get archive:
wget -O RetroArch-PCHIP.tar.gz

tar -xzvf RetroArch-PCHIP.tar.gz

Go to RetroArch folder:
cd RetroArch

Warning, make a copy of your existing config file retroarch.cfg (/home/chip/.config/retroarch/)
Install and configure (default SDL1.2, better performances):
(SDL2: ./ sdl2)

Launching RetroArch:

Additional informations:
RetroArch configs: /home/chip/.config/retroarch/
RetroArch cores: /home/chip/.config/retroarch/cores
Roms folder: /home/chip/Roms

Controls mapping:

  • pad
  • a = 8
  • b = 6
  • x = 5
  • y = 7
  • l = 3
  • r = 4
  • start = enter
  • select = rshift
  • escape = display menu

Thanks for your feedbacks.

You can find more informations here:

Mednafen (Emulator) configuration (GBC/GBA/SNES/NES)

Thank you so much for doing this.
It works brilliantly!


If you are grabbing the latest source code from, make sure to add the --disable-shaderpipeline flag to the ./configure command or it will not build.


I have one question.
Where do I place the GBA bios?
I can’t find a system folder. I’ve tried placing it in other folders, but it still doesn’t seem to work.
I googled and it seemed like it needed to go into the Roms folder, but this didn’t work either.