RetroArch packages for Raspbian

After looking around on the net it looked like RetroArch was the best way to run old emulator games, specifically ToadKing’s port for the Pi over at github. Unfortunately there didn’t seem to be any packages available so the only option to install it was to compile it yourself. I decided to set out and build some package. At the moment I’ve only packaged retroarch-rpi, libretro-fceu and retroarch-phoenix. I’ll be adding the other libs as I get a chance.

Building

I built everything using qemu-user as per my previous past. I didn’t create the packages from scratch, I based my packages off the ones that Filthy Pants made for Ubuntu. I’ve made my sources available on github.

Installing

I’m using Raspbian provided on the main Raspberry Pi site dated 2012-08-16. I’ve made the packages available, first you need to add the following to /etc/apt/sources.list.d/changeover.list:

deb http://archive.changeover.za.net/raspbian wheezy main

Then you’ll need to import my key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 2747C7CF

I recommend making sure everything is up-to-date:

sudo apt-get update; sudo apt-get dist-upgrade

Then install the packages (take note, the only libs I’ve packaged so far are the NES ones):

sudo apt-get install libretro-fceu retroarch retroarch-phoenix

Running

I included RetroArch-Phoenix to launch your game, however I wouldn’t recommend using it as it incorrectly sets the video driver. I have made up a config that works for me. Put the contents into a file in your home directory called ~/.config/retroarch/retroarch.cfg:

video_driver = "rpi"
audio_driver = "alsa"
input_player1_a = "x"
input_player1_b = "z"
input_player1_start = "enter"
input_player1_select = "rshift"
input_player1_left = "left"
input_player1_right = "right"
input_player1_up = "up"
libretro_path = "/usr/lib/libretro-fceu.so"

Then launch RetroArch like this:

retroarch <filename.nes> -c ~/.config/retroarch/retroarch.cfg -v

If the game doesn’t launch, try making sure you’re using a CPU/GPU split of 128MB/128MB.

Troubleshooting

If you don’t have sound, make sure that the snd_bcm2835 module is loaded, follow the steps over at eLinux

EDIT 2012-09-04: Updated to not use rpi-update because Raspbian now packages the firmware.

Posted in Uncategorized | 17 Comments

Development environment

It became clear to me after playing around with Raspbian that I would need to compile my own software and/or Debian packages. Raspbian is new project and is still getting its feet off the ground.

Compiling on the R Pi itself is slow, it takes an hour to compile Quake3 and about 12 hours to compile XBMC, so I decided to compile on my desktop PC. The problem is that my desktop is running Ubuntu 12.04 i386 and my Pi is running Raspbian for armhf.

I’ve never created a Debian chroot before and I’ve never created one that runs on a different architecture to the native PC. So after some googling I found this wiki page.

I used that as a base to create my own chroot that can cross-compile for armhf. Here are instructions for Ubuntu 12.04 i386:

Installing QEMU

In order to compile for a different architecture then we are currently running on we need an emulator. We will use QEMU for this:

apt-get install qemu-user-static

Creating the chroot

Create the chroot (using qemu-debootstrap) and mount some needed filesystems:

sudo apt-get install debootstrap
sudo qemu-debootstrap --arch armhf wheezy chroot-raspbian-armhf http://archive.raspbian.org/raspbian
sudo mount -t proc proc chroot-raspbian-armhf/proc
sudo mount -t sysfs sysfs chroot-raspbian-armhf/sys
sudo mount -o bind /dev chroot-raspbian-armhf/dev

Remember that is as minimal as a distro can get, you need to set up everything yourself from here, including adding a user and the applications you need.

Edit: Updated this section to use qemu-debootstrap. This handles the qemu binary and debootstrap –second-stage all for you.

Changing to the chroot

Now that you have everything setup, you can change to your chroot with:

sudo LC_ALL=C chroot chroot-raspbian-armhf

Some setting up

Now that you have the environment, you may need to do some house cleaning to get things running smoothly.

Adding a user

useradd -m -s /bin/bash <username>

Setting up reposatory and adding Raspbian GPG key

In order to install packages from the Raspbian repo, you need to add the repo to sources.list and grab the GPG key:

echo "deb http://archive.raspbian.org/raspbian wheezy main" >> /etc/apt/sources.list
wget http://archive.raspbian.org/raspbian.public.key -O - | apt-key add -
apt-get update

VideCoreIV userspace libs

You may need to fetch the libraries for VideoCoreIV for hf, these live here: https://github.com/raspberrypi/firmware/tree/master/hardfp

Reboot

Note that some of these changes won’t survive a reboot. You will need to run the following should you reboot your desktop:

sudo mount -t proc proc chroot-raspbian-armhf/proc
sudo mount -t sysfs sysfs chroot-raspbian-armhf/sys
sudo mount -o bind /dev chroot-raspbian-armhf/dev
Posted in Uncategorized | 36 Comments

Introduction

Hi

Just a quick intro to the blog and what I want to be doing.

I’m going to be making my Raspberry Pi run emulated games (NES/SNES/MAME, etc) and play videos with XBMC. I want things to be neat and tidy, so that means I may be compiling my own packages.

I’ve decided to use Raspbian as it seems to be the neatest Debian based distro for R Pi.

Posted in Uncategorized | 3 Comments