Update: Handheld console project

Using Yocto I was able to build an image for the Raspberry Pi. I followed the instructions in a blog post on Jumpnow Technologies blog. This got me started on making progress.

The instructions include adding a layer to your Yocto project, found here on GitHub: https://github.com/jumpnow/meta-rpi

Working with this layer gave me insight into the Yocto system and allowed me to gain a deeper understanding of the build process. It was a solid starting block for the project, which now has these steps completed:

Getting started

I built the basic console image as per instructions. It boots into the console and sets up the PiTFT 2.8″ display. The display is available as non-accelerated framebuffer on /dev/fb1, and fb0 remains as the main HDMI display. There is a blog post detailing how to get accelerated content on the PiTFT display here. Graphics acceleration ended up not being a requirement, however.

Add an emulator of your choice

I added snes9x-rpi from meta-game-emulators into the project. I patched the source code with the help of the Yocto devtool to make it compile correctly. The emulator uses the SDL library and runs games smoothly on the Raspberry Pi 3 (I upgraded).

Define video modes

The snes9x-rpi emulator, when ran, complained about “No video mode large enough for 320×240”. I found this strange as my main display on the HDMI connector was 1600×1200 and displayed the console correctly. The PiTFT also has a resolution of 320×240. The solution was to add a .bbappend file for fbset-modes recipe to include the proper video mode definitions. To get the video mode definitions, run fbset -i -fb /dev/fb* where * is the number of the frame buffer you want to query. Append the output into /etc/fb.modes file. The file is left empty on purpose in the original recipe.


# Replace contents of fb.modes with appropriate configuration

# Intentionally overwrites the SRC_URI variable!
SRC_URI = "file://fb.modes"


mode "320x240"
    geometry 320 240 320 240 32
    timings 0 0 0 0 0 0 0
    rgba 8/16,8/8,8/0,8/24

The only purpose of fbset-modes recipe is to include this file. That is why I thought it appropriate to replace the variable contents.

Enabling audio

This was surprisingly easy. Add the following line to your config.txt on the boot partition:


…and add alsa to the DISTRO_FEATURES variable in your local.conf or your image recipe.

Be sure to include alsa-utils package to your image. It contains all the useful tools to control audio on your device.

Running a game

To run a game on the PiTFT display instead of the default HDMI display, define the environment variable SDL_FBDEV:

SDL_FBDEV=/dev/fb1 snes9x-rpi <romname>

Next steps

Now the basics are under control, I can move on to making the system truly mobile. There are some housekeeping related items coming up, such as removing dependencies to the Jumpnow Technologies layer, and defining my own image recipe for the build. I want only the essential packages running in the system. Another goal is to make the root file system read-only. Other goals include:

  • Connect a USB SNES controller to the system
  • Connect a battery management circuit and read battery status of the device
  • Connect a set of tiny speakers to the system for audio
  • Tie it all together with a simple launcher software that starts on boot
  • Customize the boot screens for a professional, polished look
This entry was posted in embeddedlinux, raspberrypi. Bookmark the permalink.