chester's blog

technology, travel, comics, books, math, web, software and random thoughts

Raspberry Pi (with BerryBoot and ChameleonPI)

18 Mar 2013 | Comments

(TL;DR: if you just want to know how to make ChameleonPI v0.3 work with BerryBoot, jump here)

My Raspberry PI

The Raspberry Pi is a low-priced small computer-in-a-board, built for those who want to tinker, learn and have some geeky fun. The overall experience is quite reminiscent of the hobbyist 8-bit personal computer age – it may be more than a coincidence that the project shares British origins with the Sinclair ZX81/Spectrum and the BBC Micro.

Like many of today’s smartphones and low-power devices, the Pi uses an ARM CPU. This is a fun fact because that architecture was created by Acorn, the very same company that built the original BBC Micro! (the “Model A” and “Model B” boards are a clear pun on the BBC Micro models.)

Here is my Pi, close to an SD card (to get an idea of its size). Yes, it's a full-fledged computer.

Here is my Pi, close to an SD card (to give an idea of its size). Yes, it’s a full-fledged computer.

Like those old computers, you’ll use any TV or monitor (with its HDMI or composite input), and can play around without fear of breaking them, thanks to the absence of moving parts and the low price. But unlike them, you use SD Cards for storage. They are the dream of the 80′s hobbyist: fast and interchangeable like cartridges, reusable and manageable like floppy disks, and as cheap as cassette tapes (you can find a a 16GB Class 10 for less than $15).

Here is a cost breakdown (in CAD): I spent less than $50 on my board (here), and $10 on the case from the photo (although you can get creative and spend more/less). I used HDMI cables and a microUSB charger I had here (minimum is 700mA; I’d suggest at least 1A), but had no keyboard/mouse lying around, so I got this mini keyboard with trackball (which works fine, but is so short-ranged that defeats the purpose of being wireless).

A cheap Wi-Fi dongle got me wireless for another $15. It all depends on what you already have on your house, but you won’t spend more than you would on, say, an Apple TV – which provides a bit more of convenience, but a fraction of the functionality and pretty much none of the DIY fun.

Terrible photo, but a milestone: first boot!

Terrible photo, but a milestone: first boot!

The recommended software to start with is Raspbian, a desktop-like Linux distribution to which you can add anything you want. But several custom-build distros were created for specific applications, like OpenELEC (a powerful XBMC-based media player) and Sugar (containing the educational software that runs on the One-Laptop-Per-Child machines).

But the nerdgasms came with ChameleonPI – a collection of emulators for dozens of old-school platforms. Apple II, MSX, ZX81, Spectrum, C64, Arcades (MAME), GameBoy, NES… you name it, ChameleonPI has it. Just throw your ROMs/DSKs/TAPs (or a willingness to write BASIC code) and have fun!

Swapping cards is easy, but can be cumbersome and waste space, which makes BerryBoot useful: it hosts multiple distros on the same SD Card, showing a (customizable) menu for you to pick them. It also downloads most of the popular ones, straight from the Pi, with a couple of clicks. Linux geeks: it’s like apt, but for distros!

Unfortunatelly BerryBoot does not support ChameleonPI. You can add it manually (following the instructions), but BerryBoot expects a two-partition distro (and only uses the second, as the first one is the always the Raspbian boot partition). ChameleonPI v3 added a third one, allowing non-Linux users to copy ROMs to the SD card.

Since I’d rather use Wi-Fi to copy anyway, I tried to go without it. However, some of the emulators (notoriously LinApple) missed the directory structure – and I also could not write to /roms (the mount point for the partition). Here is what I did:

Steps to add ChameleonPI v0.3 to a BerryBoot SD

  • Download ChameleonPI and follow the instructions to add a custom system (ignoring that you’ll see three lines instead of two on the first step; keep using the second one);

  • Extract ChameleonPI to a separate SD and create a .tar.gz file with the contents of the FAT partition – it’s the one with AUTOEXEC.* files on the root and a lot of directories with old computer names; (alternative: download my copy of the ChameleonPI v3 FAT partition)

  • Save that file to a pen drive/USB stick/external HD;

  • Plug the pen drive on the Raspberry Pi;

  • Boot the SD card with BerryMenu and select ChameleonPI.

  • Press T to open a terminal;

  • Ensure you can write to the /roms directory:

    sudo chown zx /roms
  • Also make sure the mount point for the pen drive is there: (thanks @_47Ronin_ for pointing that out):

    sudo mkdir -p /roms/USB
  • Type exit to return to the ChameleonPI menu, then T again, and check if it mounted the pen drive (otherwise reboot and T again until the command shows some files):

    ls /roms/USB
  • Extract the .tar.gz file there:

    cd /roms
    tar -xvzf /roms/USB/chameleon.v03.fat.partition.tar.gz
  • Reboot again

If everything works, LinApple will allow you to select a disk image pressing F3 (instead of crashing for not having the directory where it expects). You will now also be able to connect via Windows Network to your Pi (use the user zx and password spectrum) and mount the roms folder, not the zx one.

Also be aware that these instructions were tested with ChameleonPI 0.3, not with 0.3.1 (which is giving me a hard time to mount anywhere outside the Pi).

Yes, I brought the Pi to Uken - why not doing turtle graphics alongside Rails?

Yes, I brought the Pi to Uken – why not doing turtle graphics alongside Rails?

Tips and Tricks:

  • You can do the image conversion (the “instructions” of the first step) on the Pi itself – it is way slower than any Linux desktop, but will work if you leave it working during the night as I did – just apt-get the software mentioned

  • XBMC becomes way more useful when you add Fusion (so other plugins can be added via the network)

  • All distros recognized my Wi-Fi dongle on-spot, but configuring the network can be tricky. OpenELEC adds an option with its own name on XBMC, under “System”, but some distros will require you to add your network to wpa_supplicant.conf (BerryBoot has it straight on the setup menu, others will look for it in /etc/wpa_supplicant/).

    In any case, adding a block like this to the existing file should be enough:

  • Make sure you set up the Wi-Fi (or have Ethernet plugged) because the Pi lacks a battery-backed clock, and needs to be online to show and use the correct date/time.