The world’s smallest AirPlay server

Or at least it probably is. I can’t verify that, but it is really damn small!

I’ve based this around the VoCore, a tiny and inexpensive (US$20) Linux platform based around an Ralink RT5350F and running the fantastic OpenWRT.

With my prototype audio dock the completed size is approx 25 x 25 x 10mm so can be made to fit almost anywhere. It could be easily integrated into an existing amplifier or set of powered speakers, enabling AirPlay-enablement of practically anything.

VoCore with audio dock

Prototype VoCore audio dock in action.

Setting up a new VoCore for AirPlay

First you will either need a VoCore dock and USB sound card or a VoCore audio dock. A USB to serial adapter is also a good idea as it makes life a lot easier if you make a mistake when configuring network settings.

A word of warning: buy your USB sound adapter from a reputable source or manufacturer. Both myself and others I’ve spoken to have found those cheap generic $3 adapters all over eBay and to be of extremely poor quality and very unlikely to work.

VoCore with USB sound adapter

First test using a low-cost USB audio adapter.

Set up networking

If you are using the official VoCore dock, simply plug in an Ethernet cable. If you are using the bare-bones VoCore, join the default WiFi network that it presents. Once that’s done you should be able to SSH into it.

First we need to set up networking so that the VoCore works as a client on your WiFi network. I expect that most folks won’t care about the Ethernet side, and even if you do it simply works out of the box so you don’t need to worry about this step!

Edit the /etc/config/wireless file and ensure it looks like this (remove any existing lines). Note that you will need to substitute your own SSID and passphrase:

config wifi-device 'radio0'
    option type 'mac80211'
    option hwmode '11g'
    option path '10180000.wmac'
    option htmode 'HT20'
    option txpower '20'
    option country '00'

config wifi-iface
    option network 'wwan'
    option ssid 'Your SSID'
    option encryption 'psk2'
    option device 'radio0'
    option mode 'sta'
    option key 'WPA passphrase goes here'

Now edit /etc/config/network and add or update the following lines (leave everything else in place):

 config interface 'wwan'
    option proto 'dhcp'

Reboot the VoCore and it should associate itself with your WiFi network.

Update the firmware

While we can compile a custom OpenWRT build, that’s better suited if we need to add custom hardware support (such as VIA audio support in the HP thin terminal). There’s very little point with the VoCore as the standard Barrier Breaker image works really well for ShairPlay on the VoCore. On your VoCore’s terminal run the following:

cd /tmp

Check that the image file isn’t damaged:

md5sum -c md5sums 2> /dev/null | grep OK

If all is well, perform the upgrade:

sysupgrade -v openwrt-ramips-rt305x-vocore-squashfs-sysupgrade.bin

And wait for the VoCore to restart once the upgrade has completed.

Install the required packages

Now we need a few packages to make ShairPort work including USB audio support:

opkg update
opkg install kmod-usb-audio shairport

Enable the required daemons

We also need to ensure that the daemons required for ShairPort start at boot:

/etc/init.d/dbus enable
/etc/init.d/avahi-daemon enable
/etc/init.d/shairport enable

Edit the ShairPlay configuration

While the defaults for ShairPort work fine, we should at least set a suitable name for the AirPlay server to announce itself as by editing the following line in /etc/config/shairport:

    option bname 'VoCore Audio'

That’s it! Reboot the VoCore and it should soon appear as an output device in OS X or iOS:

OS X Sound Preferences

If you have trouble getting audio to work, run alsamixer on the VoCore and check that the PCM volume is set adequately:


Failing that, use dmesg to confirm that the USB audio device is detected properly:

[   17.550000] snd-usb-audio 2-1:1.0: no of_node; not parsing pinctrl DT
[   17.610000] usbcore: registered new interface driver snd-usb-audio

Ubiquiti Unifi embedded server using an HP t5570e

Want a nice tidy platform for running Ubiquiti’s UniFi controller as a stand-alone appliance? Here’s a tidy solution using an HP t5570e thin client.


UniFiI recently became involved with a local school who had terrible trouble with their wireless infrastructure. The school is quite small and had a number of first-generation Apple Airport Express access points. Someone has also added a Linksys unit of some description and things were generally pretty flakey. Another local firm had replaced some of the access points with some cheap D-Link ones (Realtek-based) and from there things got even worse (surprise!).

After a little research I implemented two fixes and now things are rock solid:

  1. Replaced a faulty Allied Telesyn Ethernet switch. While it appeared to work at a glance it had a bad habit of randomly dropping frames. Sadly my experience with ATI over the years has not been good and this certainly didn’t help.
  2. Replaced all of the access points with Ubiquiti’s UniFi series.

Now I have no ties to Ubiquiti – I’ve just had a lot of success with their products over the last eight years or so. The UniFi platform is quite interesting as it requires a controller server in order to manage it, log stats and generally provide additional functionality. The trouble is that the school only had one desktop computer and the server is simply a Synology NAS appliance (these are also very good products I might add).

The desktop ran Windows 7 and was used by the office assistant. I installed UniFi on this as it was the only realistic option available at the time, but after a month or so it was clear that this would not suffice. It didn’t support running as a service without a bit of mucking around, and it had a tendancy to hog enough memory to cause a noticeable performance impact to the staff using it. Not only that, staff often needed reminding not to switch the machine off.

I had a look at various low-cost embedded options including the Raspberry Pi and ALIX boards. Most were slow and in many cases weren’t that cheap particularly once a case, storage and power supply were added.

In the end I found a new HP t5570e thin client going very cheap (NZ$90) and gave it a shot. It’s been running a a few months now and has never skipped a beat. It currently manages a network of about six access points and up to 40 clients, and looks to have enough capacity to grow further. The load average sits less than 0.1, memory typically around 60% usage and only 1.3GB disk space has been used.

HP t5570e thin client

HP t5570e thin clientThis is just a small form factor PC that includes the following specs (full PDF here):

  • VIA Nano u3500 1GHz CPU
  • 2GB RAM
  • 4GB IDE SSD (upgraded to an 8GB SSD so that Mongo can journal properly)
  • Gigabit Ethernet

Best of all there’s no moving bits like fans and hard disks to worry about.

I opted to install Voyage Linux 0.9.6 due to the fact it’s built on Debian Wheezy and has a nice small footprint, optimised for installing on small flash storage.

Voyage Linux Installation

Here’s how to get Voyage onto the thin client.

  1. Download the Voyage live CD image from The Nano is an x86-64 CPU so grab the amd64 version.

  2. Copy the ISO image to a USB stick. In Mac OS X this is done as follows (assuming disk1 is the USB stick device — check with diskutil list). If you use Ubuntu jst use the startup disk creator. In Windows, try XBOOT.

    hdiutil convert -format UDRW -o voyage-0.9.2_amd64.dmg voyage-0.9.2_amd64.iso
    dd if=voyage-0.9.2_amd64.dmg of=/dev/rdisk1 bs=1m
  3. Insert the USB stick into the HP thin terminal, along with a keyboard and display. Power it on and wait for it to boot, then follow the steps below. The default login is root with the password voyage. Note the steps to perform in bold. In most cases the defaults are acceptable.

    Linux voyage 3.10.11-voyage #1 SMP Fri Dec 6 17:15:44 HKT 2013 x86_64
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    __  __
    \ \/ /___ __  __ ___  ___  ___    Useful Commands:
     \  // _ \\ \/ /,-_ |/ _ |/ -_)     remountrw - mount disk as read-write
      \/ \___/ \  / \___,\_  |\___|     remountro - mount disk as read-only
              _/_/        _'_| - remove all docs and manpages
        { V o y a g e } - L i n u x
         < >   Version: 0.9.2 (Build Date 20131219)
    root@voyage:~# mkdir /tmp/root
    root@voyage:/tmp/root#  mkdir /tmp/ide
    root@voyage:~# mount -o loop /lib/live/mount/medium/live/filesystem.squashfs /tmp/root
    root@voyage:~# cd /tmp/root
    root@voyage:/tmp/root# /usr/local/sbin/voyage.update
    What would you like to do?
     1 - Create new Voyage Linux disk
     2 - Update existing Voyage configuration
     3 - Exit
         (default=1 [Create new Voyage Linux disk]):
    some mandatory options are unset, please enter them interactively
    Where is the Voyage Linux distribution directory?
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=2 [Select Target Profile - this overwrites current settings]):
    Please select Voyage profile:
     1 - Keep existing settings
     2 - 4501
     3 - 4511/4521
     4 - 4801
     5 - 5501
     6 - 6501
     7 - ALIX
     8 - APU
     9 - Generic PC
     10 - Notebook (pcmcia)
     11 - WRAP
         (default=7 [ALIX]): 9
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=3 [Select Target Disk]):
    Partitions information
    major minor  #blocks  name
      8        0    2000376 sda
      8        1    2000092 sda1
      8       16    7816704 sdb
      8       17      62432 sdb1
      7        0      51244 loop0
      7        1      51244 loop1
    Which device accesses the target disk [/dev/hde]? /dev/sda
    Which partition should I use on /dev/sda for the Voyage system [1]?
    Device information for /dev/sda1
    device     fs_type label    mount point    UUID
    /dev/sda1  ext2    VOYAGE_FS (not mounted) ed3c0453-149d-4a96-a6d9-5f523e21b0ca
    Where can I mount the target disk [/tmp/ide]?
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=4 [Select Target Bootstrap Loader]):
    Which loader do you want (grub or lilo) [grub]?
    Which partition is used for bootstrap [1]?
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=5 [Configure Target Console]):
    Select terminal type:
     1 - Serial Terminal
     2 - Console Interface
         (default=2 [Console Interface]):
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=6 [Partition and Create Filesystem]):
    What shall I do with your Flash Media?
     1 - Partition Flash Media and Create Filesystem
     2 - Use Flash Media as-is
         (default=1 [Partition Flash Media and Create Filesystem]):
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=7 [Copy Distribution to Target]):
    Configuration details:
    Distribution directory:   /tmp/root
    Disk/Flash Device:        /dev/sda
    Installation Partition:   /dev/sda1
    Create Partition and FS:  yes
    Bootstrap Partition:      /dev/sda1
    Will be mounted on:       /tmp/ide
    Target system profile:    Generic PC
    Target console:           standard
    Bootstrap installer:      grub
    Bootstrap partition:      /dev/sda1
    OK to continue (y/n)? y
    Ready to go ....
    Checking that no-one is using this disk right now ...
    Disk /dev/sda: 249 cylinders, 255 heads, 63 sectors/track
    Old situation:
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
      Device Boot Start     End   #cyls    #blocks   Id  System
    /dev/sda1   *      0+    248     249-   2000092   83  Linux
    /dev/sda2          0       -       0          0    0  Empty
    /dev/sda3          0       -       0          0    0  Empty
    /dev/sda4          0       -       0          0    0  Empty
    New situation:
    Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
      Device Boot Start     End   #cyls    #blocks   Id  System
    /dev/sda1   *      0+    248     249-   2000092   83  Linux
    /dev/sda2          0       -       0          0    0  Empty
    /dev/sda3          0       -       0          0    0  Empty
    /dev/sda4          0       -       0          0    0  Empty
    Successfully wrote the new partition table
    Re-reading the partition table ...
    If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
    to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
    (See fdisk(8).)
    mke2fs 1.42.5 (29-Jul-2012)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    125184 inodes, 500023 blocks
    25001 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=515899392
    16 block groups
    32768 blocks per group, 32768 fragments per group
    7824 inodes per group
    Superblock backups stored on blocks:
       32768, 98304, 163840, 229376, 294912
    Allocating group tables: done
    Writing inode tables: done
    Writing superblocks and filesystem accounting information: done
    tune2fs 1.42.5 (29-Jul-2012)
    Setting maximal mount count to -1
    Setting interval between checks to 0 seconds
    Copying files .... done
    Removing pcmcia from update-rc.d
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
       LANGUAGE = (unset),
       LC_ALL = (unset),
       LANG = "en_NZ.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    update-rc.d: using dependency based boot sequencing
    Removing dnsmasq.pxe.conf in /etc/dnsmasq.more.conf
    Reconfiguring resolvconf
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
       LANGUAGE = (unset),
       LC_ALL = (unset),
       LANG = "en_NZ.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
       LANGUAGE = (unset),
       LC_ALL = (unset),
       LANG = "en_NZ.UTF-8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    Updating /etc/hosts
    Installing grub
    Copy grub files from /tmp/ide to /tmp/ide/boot/grub
    Setting up grub under chroot /tmp/ide script completed
    What would you like to do?
     1 - Specify Distribution Directory
     2 - Select Target Profile - this overwrites current settings
     3 - Select Target Disk
     4 - Select Target Bootstrap Loader
     5 - Configure Target Console
     6 - Partition and Create Filesystem
         (default=8 [Exit]):
    root@voyage:/tmp/root# reboot
  4. Remove the Voyage USB stick when prompted.

Post-Installation Tasks and UniFi Installation

Once the thin terminal has booted into Voyage there are a few more installation steps required.

  1. First set a new root password:

  2. Set a hostname:
    echo unifi > /etc/hostname
  3. Set APT to use NZ (or your local country) repository mirrors instead of Japanese ones to speed up downloads:

    sed -i -e 's/' /etc/apt/sources.list
  4. Update the repository cache and install security patches:

    apt-get update
    apt-get upgrade
  5. Fix locales:

    apt-get install locales
    dpkg-reconfigure locales
  6. Install required locales (e.g. 131) and select as system default.

  7. Uninstall some network services we don’t need to free up disk space and improve security:

    apt-get purge dnsmasq-base hostapd hostap-utils nfs-common nfs-kernel-server nocatsplash tftpd-hpa rpcbind ppp pppoe libglib1.2ldbl
  8. Install default Java runtime environment (OpenJDK 6):

    apt-get install default-jre-headless
  9. Symlink the OpenJDK path to where UniFi expects it to be (/usr/lib/java-6-openjdk):

    cd /usr/lib/jvm
    ln -s java-6-openjdk-amd64 java-6-openjdk
  10. Add APT sources for UniFi and MongoDB by saving the following text in /etc/apt/sources.list.d/unifi.list:

    # UniFi
    deb debian ubiquiti
    # MongoDB
    deb dist 10gen
  11. Add GPG keys for the above APT repositories:

    apt-key adv --keyserver --recv C0A52C50
    apt-key adv --keyserver --recv 9ECBEC467F0CEB10
  12. Update the APT repository cache:

    apt-get update
  13. Install UniFi:

    apt-get install unifi
  14. If you are using a HDD or SSD smaller than 16GB you will need to disable journaling in the UniFi database to save disk space. Note that this could increase the chances of DB corruption after dirty shutdowns.

    service unifi stop
    service mongodb stop
    echo "unifi.db.nojournal=true" >> /var/lib/unifi/
    service mongodb start
    service unifi start
  15. Add ACPI power button support so that staff can easily shut down the server properly if required. This is optional but recommended:

    apt-get install acpid
    echo -e 'event=button/power (PWR.||PBTN)\naction=/sbin/shutdown -h now "Power button pressed"' > /etc/acpi/events/power
    service acpid restart

From here you should be able to browse to the UniFi web interface (it should appear at https://unifi:8443) and get started setting up access points.

Some users may wish to assign a static IP address to the UniFi controller too – I felt this unnecessary and in practice it doesn’t seem to matter.

Restoring sanity to Cinnamon 2.0 in Ubuntu Precise

When the Cinnamon 2.0 was recently released for Ubuntu (PPA here) I noticed it broke quite a few default settings and resulted in the desktop looking like quite a mess when logging in. For some machines I had set up for other people to use this caused no end of strife so I investigated a fix.

It seems that Cinnamon 2.0 is now a fork of Gnome 3 rather than a shell, so as a result it now uses its own Gschema settings. Unfortunately it doesn’t bother to migrate any existing settings from Gnome so we end up with a bit of a mess on stock Ubuntu with missing icons and a very broken desktop theme. Fortunately it’s easy to fix!

Window and GTK+ themes

Edit /usr/share/glib-2.0/schemas/org.cinnamon.desktop.interface.gschema.xml and modify the following lines:

    <key type="s" name="icon-theme">
      <summary>Icon Theme</summary>
      <description>Icon theme to use for the panel, nautilus etc.</description>
    <key type="s" name="gtk-theme">
      <summary>Gtk+ Theme</summary>
      <description>Basename of the default theme used by gtk+.</description>


    <key type="s" name="cursor-theme">
      <summary>Cursor theme</summary>
      <description>Cursor theme name. Used only by Xservers that support the Xcursor extension.</description>

Edit /usr/share/glib-2.0/schemas/org.cinnamon.desktop.wm.preferences.gschema.xml and modify the following line:

    <key type="s" name="theme">
      <summary>Current theme</summary>
      <description>The theme determines the appearance of window borders, titlebar, and so forth.</description>

Desktop background

Edit /usr/share/glib-2.0/schemas/org.cinnamon.desktop.background.gschema.xml and modify the following line:

    <key type="s" name="picture-uri">
      <summary>Picture URI</summary>
      <description>URI to use for the background image. Not that the backend only supports local (file://) URIs.</description>

Apply changes

To actually make the changes take effect we need to recompile the binary schema file from the ones we’ve just edited:

sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

Menu icon

The Mint menu icon also looks pretty ugly and out of place so let’s change it to a nice Ubuntu logo.

sudo sed -i.orig -e 's%/usr/share/cinnamon/theme/menu.png%/usr/share/unity-greeter/ubuntu_badge.png%' /usr/share/cinnamon/applets/

Original Cinnamon menu icon New Cinnamon menu icon

And that pretty much sums it up!


So why not use Mint? Well to be honest I don’t find it particularly good looking and once the surface is scratched it just feels a little kludgy under the hood. Pretty subjective I know, but it just doesn’t quite feel right.

Cinnamon isn’t the most polished of desktop environments either – its multi-monitor support is terrible and in my opinion Nemo feels a little clunky in comparison to Nautilus (not to mention the complete lack of CD/DVD burning support). Where it really shines is the fact that it provides a very low barrier for less technical users who are used to Windows. So much so that I’ve been able to install it in place of Windows and have no complaints from users until this happened. It’s almost enough to make me consider Unity again…

OpenWRT AirPlay server on HP Thin Terminal

HP t5525 thin terminalI decided I needed an easier way of playing music on my old stereo in the workshop so it was time to see what could be done. I’m already quite a fan of Apple’s AirPlay protocol as it is very easy to use, however I wasn’t so keen on its proprietary nature. Fortunately this side of things has been solved and popular FOSS AirPlay server has been developed for Linux called ShairPlay.

The second part of the puzzle was to find some suitable hardware. I wanted something small and low power, preferably without moving part or dongles hanging of ports. Many folks use the Rasberry Pi and while I have  some lying about, the fact it uses PWM for the analogue audio output is a serious let down for music playback.

Diving deeper into the junk box I dug up an old HP t5525 thin terminal. This is really just a standard x86 PC crammed into a little box and designed for low power operation. It’s very well built and has no fans or other moving bits, and best of all it features far better audio performance than the Rasberry Pi. Here’s the basic specs:

  • VIA Eden 800MHz CPU
  • 128MB DDR RAM
  • 256MB IDE flash
  • VIA Rhine II Fast Ethernet
  • VIA AC’97 audio codec
  • 4x USB 2.0 ports
  • 1x serial, 1x parallel port

These thin terminals and later variants with AMD Sempron and Intel Atom CPUs can often be found dirt cheap on the second hand market (often for less than an RPi) and feature very low power consumption.

As far as software goes, OpenWRT supports x86 platforms and is designed for embedded platforms so it fits nicely with the limited amount of memory and storage on the thin terminal.

Image Download

If you just want to turn your VIA-based HP thin terminal into an AirPlay server with little fuss, just grab the image below.

Download OpenWRT 12.09 ‘Attitude Adjustment’ image with AirPlay support for VIA-based HP thin terminals.

This includes SSH, NTP, ShairPlay, ALSA, Avahi and kernel modules for the VIA Padlock crypto engine, VIA Rhine network and VIA AC’97 codec. Basic IPv6 support is included as ShairPlay seems to get upset without it. There’s also USB keyboard support which is handy if you don’t have a null modem cable lying about.

It’s very lean and I haven’t bothered to include much more than the bare necessities to administer the box and get AirPlay working. There is no web interface, wireless support or even drivers for any other brands of network interface. The root partition is 120MB so the while thing also fits onto the 128MB flash module fitted to the t5520 (Windows CE version of the t5525).

If you want additional functionality I suggest reading below to build an image with other utilities and packages.

OpenWRT Build Process

I’ve listed all the steps I took to build OpenWRT from scratch just in case it’s useful to anybody else.

This is easiest on a Linux distro. I suggest Linux Mint if you are new to that game and the instructions below are aimed at Ubuntu or Mint. If you use OS X then that should be fine; the OpenWRT wiki has a list of dependencies and you can install these easily via MacPorts or similar.

Install Dependencies

First install all the software we will require for obtaining and compiling the OpenWRT source:

sudo apt-get install build-essential gawk gcc-multilib git-core libncurses5-dev libxml-parser-perl subversion zlib1g-dev

Download the OpenWRT Source Tree

I used Attitude Adjustment so that’s what we will download here. Feel free to use a different version.

svn co svn://

Once this is complete you should find the entire source tree in the attitude_adjustment directory. The remaining commands assume you are working from this directory.

cd attitude_adjustment

Add ShairPlay Source

Mike Juni has forked an OpenWRT-specific version of ShairPlay. To include it, simply add the following line to feeds.conf.default:

src-git mikejuni git://;master

Now update the feeds:

scripts/feeds update -a
scripts/feeds install -a

Enable VIA AC’97 Kernel Modules

By default, OpenWRT doesn’t include modules for the VT8200 series AC’97 audio codec used in these old VIA HP thin terminals. That’s okay though as the modules we need are included in the mainline kernel, so it’s simply a matter of creating a suitable package definition to have OpenWRT include this.

Add the following lines to /kernel/modules/ Note that the vt82xx modules depend on mpu401-uart.

define KernelPackage/sound-mpu401-uart
  TITLE:=MPU 401 UART support
  AUTOLOAD:=$(call AutoLoad,36,snd-mpu401-uart)
  $(call AddDepends/sound)

define KernelPackage/sound-mpu401-uart/description
  Routines for control of MPU-401 in UART mode

$(eval $(call KernelPackage,sound-mpu401-uart))

define KernelPackage/sound-via82xx
  TITLE:=VIA VT82xx series AC97 Controller
  DEPENDS:=+kmod-ac97 +kmod-mpu401-uart
  AUTOLOAD:=$(call AutoLoad,37,snd-via82xx)
  $(call AddDepends/sound)

define KernelPackage/sound-via82xx/description
 Support for the integrated AC97 sound device on motherboards
 with VIA chipsets.

$(eval $(call KernelPackage,sound-via82xx))

Those trying to get sound support on older VIA C3 ITX boards may also find this useful.

Package Configuration

Now it’s time to configure the packages to be built in the OpenWRT image.

make menuconfig

This will start a menu driven interface similar to the one presented when selecting Linux kernel options.

OpenWRT configration menu

Here’s the options I chose; feel free to change these to suit your system. I set all to * to include them in the base image rather than as a package.

  • Target System: x86
  • Subtarget: Generic
  • Target Profile: Generic
  • Target Images
    • Root filesystem partition size: 120MB
  • IPv6
    • <*> 6scripts
  • Kernel Modules
    • Cryptographic API Modules
      • kmod-crypto-aes
      • kmod-crypto-hash
      • kmod-crypto-hw-padlock
    • Filesystems
      • kmod-fs-ext4
    • Libraries
      • kmod-lib-zlib
    • Network Devices
      • kmod-via-rhine
    • Sound Support
      • kmod-sound-mpu401-uart
      • kmod-sound-seq
      • kmod-sound-soc-ac97
      • kmod-sound-via82xx
    • USB Support
      • kmod-usb-hid
      • kmod-usb-storage
      • kmod-usb2
  • Network
    • IP Addresses and Names
      • avahi-autoipd
      • avahi-dnsconfd
    • SSH
      • openssh-client
      • openssh-server
    • Time Synchronization
      • ntpd
  • Libraries
    • Filesystem
      • libext2fs
    • SSL
      • libopenssl
    • alsalib
    • libavahi-client
    • libavahi-dbus-support
  • Utilities
    • alsa-utils
  • Sound
    • shairport

Exit the configuration menu and save changes when prompted.

Now go make some coffee while we compile; depending on the options chosen and the speed of your machine this can take over an hour.


If you are an optimisation freak check the make options on the OpenWRT wiki.

One the build process is finished the OpenWRT images can be found in bin/x86.

Installing onto the Thin Terminal

The easiest way is to copy the resulting image to a USB flash drive and boot off that. This process completely overwrites any existing content on the drive!

Plug the USB drive in and then locate the device node it uses:

dmesg | tail

Decompress the OpenWRT image and copy the OpenWRT image to the USB drive shown above (in this case /dev/sdc). It’s easiest to do this in one command and shown below:

gunzip -c bin/x86/openwrt-foo.img.gz | sudo dd of=/dev/sdc bs=1M

Once that’s complete, rescan the partitions with partprobe or unplug and reinsert the drive. If we mount the partitions now we can make some configuration changes before booting so you don’t need a keyboard or display on the thin terminal.

If it doesn’t mount automatically you will need to do this manually (once again replace /dev/sdc with your USB drive device):

sudo mkdir -p /mnt/openwrt/boot /mnt/openwrt/root
sudo mount /dev/sdc1 /mnt/openwrt/boot
sudo mount /dev/sdc2 /mnt/openwrt/root


Root Password

You will need to change the root password before you can login via SSH. If you have mounted the USB stick simply do this with chroot (replace the path to the OpenWRT root partition if necessary):

chroot /mnt/openwrt/
passwd root

Enter a new password then type exit to leave the chroot.


Network settings are configured by editing /etc/config/network. Here’s an example:

# Copyright (C) 2006

config interface loopback
    option ifname   lo
    option proto    static
    option ipaddr
    option netmask

config interface lan
    option ifnam    eth0
    option type     bridge
    option proto    static
    option ipaddr
    option netmask
    option gateway
    option dns


You will need to change the name of the mixer control to use for the AirPlay volume control or ShairPlay will crash.

Edit etc/config/airplay and set the volume line to PCM. You can also change the display name that ShairPoint anncounces itself as, for example ‘Workshop’ or ‘Games Room’.

config airplay
        option bname 'Workshop'
        option initbuf 320
        option daemonize true
#       option port 5002
#       option password '123456'
        option pcm 'default'
        option ctl 'default'
        option volume 'PCM'

Boot Config

Because we will be initially booting off a USB stick we will need to change the target device in the GRUB configuration. This is held in the first partition on the USB stick (e.g. /mnt/openwrt/boot).

As an alternative, if you have a keyboard and display attached to your target machine you can press e in the GRUB boot menu and edit the line manually during each boot. This will save you needing to edit it again once it is copied to the internal flash.

Edit boot/grub/menu.1st and change /dev/sda2 to /dev/sdb2 (you can use command below to do this for you).

sed -i -e 's/sda/sdb/' boot/grub/menu.1st

Don’t forget to unmount the USB stick before unplugging it!

Installing on the Target System

Insert the USB stick and boot up the target machine. It should be accessible via SSH after a few moments. If not, plug in a screen and check for any errors.

The last remaining steps are to configure ALSA to actually output sound and then install the image onto the built-in IDE flash.

ALSA Configuration

Run alsamixer to set the output volume. Set Headphones to 100% and press M to unmute it. Do the same for PCM but I recommend setting the level to about 60%.


ALSA will forget this when the system is shut down so we need to make it persistent. First save the configuration as it is now:

alsactl -f /etc/alsa0.state store 0

Then to restore this on boot, save the following into /etc/init.d/alsa-cfg. Setting the order to 98 ensures that ALSA is set up correctly before ShairPlay starts.

#!/bin/sh /etc/rc.common
start() {                                 
    alsactl -f /etc/alsa0.state restore 0

Make it executable:

chmod +x /etc/init.d/alsa-cfg

Then enable it on boot:

/etc/init.d/alsa-cfg enable

Install on Internal Flash

From here simply block copy the USB stick onto the internal IDE flash:

dd if=/dev/sdb of=/dev/sda bs=1M

Once that’s complete, unplug the USB stick and reboot. Hopefully everything works as expected!


It’s getting late and I should really be doing homework so please accept my apologies if I’ve missed something!

I also found that image also works perfectly on the HP t5515 which is very similar but based on an 800MHz Transmeta Crusoe CPU. It draws even less power than the t5525 and appears to run happily off a 12v 1.5A power supply.


OpenWRT build documentation

ShairPort discussion

Stripboard Magic

Stripboard Magic is a Windows application for designing PCB layouts on stripboard (aka prototyping board). It was released by a British company called Ambyr which ceased trading a long time ago. The interface is a quite primitive and a little strange but the program is functional even on Windows XP. It also works great in Linux using Wine. Read more of this post

Brother HL-2150N in Ubuntu Karmic

Normally I try to stick with HP printers when using them in Linux as they seem to have the best support thanks to HP’s efforts with HPLIP.

I recently went against my own advice and purchased a Brother HL-2150N monochrome network laser printer. Brother have at least tried to provide drivers for Linux and even supply Deb packages. Unfortunately installation is a mess involving ugly binary wrappers and packages that don’t appear to conform to Debian policies very well.

Whilst there is no official support for this printer model in Ubuntu 9.10, it can be set up to work via Ethernet fairly easily. Read more of this post

Flash drive fakes

Against my recommendation a relative recently bought a 32GB USB flash drive off Trade Me. It cost something like $85 when such drives are currently about $130 at wholesale rates. Read more of this post

Grep for Windows

Ever since using Ubuntu as my primary OS I’ve missed many of the command line tools when using Windows. However I just discovered Windows has it’s own version of the grep command called findstr.

I’m probably a bit behind the eight ball here but despite it’s awful name, mangled switches and  other Microsoftisms findstr seems to behave in quite a similar fashion to good old grep, enough for basic commands at least.