Here is a compilation of things I’ve discovered in setting up some NSLU2 storage routers to act as a bluetooth-sensing audio synthesizing network for the inquisitive devices project (a collaboration with Jonah Brucker-Cohen)
Choice of distro.
I am using Angstrom openembedded, a relatively new embedded linux distro, for several reasons
-I am already familiar with openembedded from the gumstix
-It uses glibc, giving better compatibility with desktop software
-It achieves superior floating point emulation performance with the EABI
-Its possible to compile openembedded for BE (big endian) or LE (little endian) operation. I chose bigendian as it should in theory make network operations a little faster.
Software platform:
We are using bluez, python, simpleosc, and pda. This environment will not fit in the NSLU2’s 8MB of internal flash storage, necessitating interfacing a 2GB USB key to the ’slug.
Although its possible to boot linux the normal way, and install software to a mounted drive rather than the default (root) location, support for this is hit and miss. It can work ok for high level software, however packages that contain libraries and kernel modules get pretty confused. For this reason We have reconfigured ‘Apex’, the angstrom bootloader, to use the USB key as the root filing system. The steps involved are:-
Download the compiled openembedded distribution from here
Install the upslug2 tool to reflash the slug. As I’m using ubuntu this involved typing:
sudo apt-get install upslug2
Although I do have the greatest sympathy for windows users who will have to jump through hoops to do this.
Once upslug2 is ready, the netslug can be flashed by turning it on with the reset button depressed for 10 seconds (until the status light turns red), and then (while connected to the same network) issuing:
sudo upslug2 -d eth1 -i Angstrom-base-image-glibc-ipk-2007.11RC3-ixp4xxbe-nslu2.bin
(I used the -d eth1 option as my laptop was using wifi to connect to the router the netslug was plugged into).
-And this just works, instantly, detecting the netslug, reflashing, verifying and rebooting into the new OS. A big improvement on this!
Wait for the netslug to reboot and ssh into it (i.e. ssh root@192.168.1.6 )
Bring ipkg upto date and install apex-env: this allows theparameters of the apex bootloader to be modified from within linux.
ipkg update
ipkg install apex-env
Use apex-env to tell the netslug to boot from the extrnal flash drive:
apex-env setenv cmdline “console=ttyS0,115200n8 root=/dev/sda1 rootfstype=ext2 rw rootdelay=10″
Its then necessary to put the root folder structure onto the USB drive. On Ubuntu I used gunzip to unpack the tar.gz of the rootfs distribution, I copied this onto the newly formatted ext2 drive and then used:
sudo tar -xvf Angstrom-base-image-glibc-ipk-2007.11RC3-ixp4xxbe.rootfs.tar
To replicate the root filing system. I then inserted the USB key in the netslug, rebooted and voila!, df reported 1840328 blocks free.
I then installed sound, bluetooth and python onto the new, large root filing system.
ipkg install task-base-bluetooth
ipkg install kernel-module-snd-usb-audio
ipkg install kernel-module-snd-pcm-oss
ipkg install alsa-lib
ipkg install python-pybluez
depmod - a is necessary to make the bluetooth & sound modules visible.
As before, I added a stratup script to initialise the sound hardware:
#!/bin/sh
echo “Configuring sound…”
modprobe snd-usb-audio
modprobe snd-pcm-oss
echo “Finished configuring sound.”
Save this to /etc/rcS.d/S90sound and make it executable.