!Goal I finally got around to digging a VP882 I have. The VP882 was IndigoVision’s most powerful MPEG4 codec at the time I left in 2005. Today I want to use it for the following purposes:

  • My disc server is hidden in a room where it can be as noisy as it likes to be. I want the silent VP882 to be able to access my MP3/OGG collection and play it in the lounge. Bonus points for getting a nice interface like that of mpd.
  • Connect a camera to the VP882 and do at least picture capture, at best video streaming, probably using VLC, to have a cat-checking Web cam type thing.
  • Run all the servers from the VP882 so no-one can attack me using x86-based exploits. Ok that’s not possible, the VP882 won’t be enough to serve anything more than plain files. Unfortunately I won’t be able to use the MPEG4 encode hardware, as I’d have to speak VBTP or something for that to work, and those protocols are Indigo property. Oh well.

!Strategy We’ll install a full Debian on the x86 disc server, then the VP882 will chroot into it. We’ll use mpd on the vp882, and phpmp on the file server, pointing to the vp882, saving our having a Web server there.

!Recipe !!Installing Debian I gave up my previous method of using debootstrap: debootstrap’s problem is that it doesn’t work to build a system for a different architecture (e.g. ARM on a x86), and trying to run it directly from the VP882 won’t work because it’s missing some functions (e.g. printf), which I can’t compile without a cross-gcc which I’d really prefer not to have to build.

Luckily, a long time ago, installing Debian was dumber and simpler: Potato has a simple tarball called [[base2_2.tgz http://archive.debian.org/debian-archive/dists/potato/main/disks-arm/current/base2_2.tgz]] which should correspond to what debootstrap would download.

Untar that somewhere (as root, so device files get created correctly). Mount it from the VP882 (with rw,hard,intr,nolock as usual, or you’ll wait forever). At best create a new NFS export for that directory and add no_root_squash, so that the VP882 has full access to its root file system. Chroot. Done. Careful: no_root_squash only works if you mount the exact export.

E.g.:

# Stop the VideoBridge applications so we can access
# /dev/dsp
/etc/init.d/vbapp stop

mkdir /tmp/rfs
mount -o rw,hard,intr,nolock 192.168.0.250:/home/shared/arm/debianrfs /tmp/rfs

# Before chrooting, insmod the loopback interface (for swap
# over NFS)
insmod /tmp/rfs/lib/modules/loop.o

chroot /tmp/rfs

# Setup swap
losetup /dev/loop0 /tmp/swap
swapon /dev/loop0

It seems to be vitally important to put at least / and /proc in /etc/fstab, something like:

192.168.0.250:/home/shared/arm/debianrfs / nfs defaults 0 0
proc /proc proc defaults 0 0

and even more important is to fix an old APT problem by adding to /etc/apt/apt.conf:

APT::Cache-Limit "10000000";

Upgrade to more recent versions have to be done step by step: potato, woody, sarge, etch. Otherwise, it’ll blow up. Be prepared for various problems as the upgrade goes, as the configuration isn’t at all standard. At some point APT asked to remove essential packages, which it then complained weren’t present anymore. You’ll find the old versions of Debian on the Debian Archive site http://www.debian.org/distrib/archive. Old version aren’t mirrored, so downloading will take a while as it must come from the mothership.

Last touches :

  • Set /etc/resolv.conf to something that makes sense.
  • Update /etc/apt/sources.list (only upgrade one version at a time – don’t go jumping from Potato to Etch, will you?)
  • Create some swap (on NFS – this is good):
    dd if=/dev/zero of=/tmp/swap
    mkswap /tmp/swap
    

    *Setup /etc/fstab:

    proc /proc proc defaults 0 0
    192.168.0.250:/home /home nfs rw,intr,nolock 0 0
    

    (That’s an example only – I like to have my homes shared).

!Building Mpd The Xscale processor has no floating point unit. This means all the pre-compiled audio software in Debian is essentially useless. We’ll need to rebuild the software we want to use against integer-only libraries: libmad for MP3, and Tremor for Ogg. !!Install libmad

aptitude install libmad0-dev

(You can also install madplay to test things out)

!!Building tremor Tremor isn’t part of Debian at all so we need to build it from scratch.

(Done that, didn’t document it. Doh. Install it to /usr/local).

!!Other dependencies We don’t have, nor want, ALSA support. Luckily mpd also supports libao which is fine for our purpose. OSS support may be enough, too (I coded the VP882 audio driver – we didn’t go for ALSA at the time because it was both too complicated and basically entirely undocumented. A recent look suggests it’s not changed much.)

aptitude install libao-dev

!!Building mpd We’ll build it light for now. We disable everything we don’t have nor want, and tell where tremor is.

apt-get source mpd
./configure --enable-ao --disable-alsa --disable-shout --disable-sun --disable-pulse --with-tremor=/usr/local --with-mad
make
sudo make install

Meanwhile we install phpmp and make it point to the vp882.

A good trick is to install Debian’s mpd, that way you get all the daemon infrastructure installed for you. Just edit /etc/init.d/mpd and /etc/mpd.conf accordingly: You’ll need to change the bind_to_address setting so the file server can connect to mpd, and run /usr/local/bin/mpd instead of /usr/bin/mpd.

Indexing the MP3’s takes a //long// time, as the files are accessed through NFS. And then, it all works! We can now access Phpmp through the Apache server on the file server, which connects to the mpd running on the VP882, which in turns accesses the MP3 files through NFS on the file server.

We now have a fan-less music listening experience in the lounge!

Left as an exercise to the reader is writing a small script that does all the chroot setup and runs mpd upon startup.