Use an OpenPandora as a Boot Device

Posted on April 17, 2013 by Jack Kelly
Tags: openpandora

I recently bought myself an OpenPandora. It’s a surprisingly well-made device, given that it’s a massive volunteer effort, and unlike pretty much every other arm-based handheld or tablet on the market, it’s not locked down for no good reason. Having a full GNU/Linux system lets it do some really interesting things - it can expose one of its two SD cards as a USB mass storage device. The obvious thing to do is to put SYSLINUX on it and use it to boot other systems. Here’s how I prepared an old 4GB SDHC card. Pretty much all the commands require root, so go and run sudo -i now.

The card was automounting at /media/sd, so the first thing to do is unmount (but not eject) it so we can mess with partition tables and such:

# umount /media/sd

It’s currently partitioned with a single partition that fills the entire card. Great. Let’s make it bootable. Those following along should double-check they’re targeting the right /dev nodes:

# fdisk /dev/mmcblk0
Command (m for help): a
Partition number (1-4): 1

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

Well, force the re-read then:

# partprobe

Now I want to relabel it “bootcard” instead of “sd”. You may need to install dosfstools:

# dosfslabel /dev/mmcblk0p1 bootcard

Then I remounted the card, grabbed version 4.06 of SYSLINUX (the latest version, 5.01, doesn’t have working keyboard input on my machine) and installed it to the block device, along with its MBR code. Note that these commands are being run from different directories of the syslinux distribution. Note that if you don’t make the “boot” directory first, you get a stupidly cryptic “/dev/mmcblk0p1: No such file or directory” error:

# mkdir /media/bootcard/boot
syslinux-4.06/linux# ./syslinux -i -d /boot /dev/mmcblk0p1
syslinux-4.06/mbr# dd conv=notrunc bs=440 count=1 if=mbr.bin of=/dev/mmcblk0
# echo "say Hello from SYSLINUX">/media/bootcard/boot/syslinux.cfg

And that was that. With the Pandora connected to my laptop in SD-Mass-Storage mode, SYSLINUX loads. Choosing boot images and setting up fancy menus are left as an exercise for the reader.

EDIT: I have prepared a background image that looks nice with the SYSLINUX vesamenu, based off the logo on the OpenPandora Wiki:

OpenPandora SYSLINUX wallpaper

This extract from my syslinux.cfg sets up the wallpaper and a pleasing colour scheme to match:

UI vesamenu.c32
MENU TITLE Pandora BootCard
MENU BACKGROUND pandora.png
MENU COLOR border 34;40 #00000000 #000000000 std
MENU COLOR title 1;36;40 #ff00b0fe #00000000 std
MENU COLOR tabmsg 1;33;40 #90ffff00 #00000000 std
MENU COLOR sel 33;40 #ffba7e00 #00000000 std
MENU COLOR hotsel 1;33;40 #ffffff00 #00000000 std
MENU COLOR unsel 34;40 #ff00425f #00000000 std
MENU COLOR hotkey 36;40 #ff0092c8 #00000000 std
Previous Post
All Posts | RSS | Atom
Next Post
Copyright © 2024 Jack Kelly
Site generated by Hakyll (source)