I’ve been meaning to play with Plug Computers for some time now, as I need a low-power embedded system around the house. I recently bought a Soekris Net6501 (a pretty powerful Intel CPU, that even has VT support), but had annoying issues getting it working reliably. I ordered an ARM-based Dreamplug as an alternative (and as a bonus, the Dreamplug is 6x cheaper than the Soekris!). Here are my notes on getting it to work.
- Aside from the Dreamplug itself, make sure you order the optional JTAG module. This provides a serial console that is essential to getting any development done with it.
- I also grabbed the extra 16GB Class 10 SLC SD Card, to act as my home directory.
- You will also need another functional system running Debian (or a VM on your Mac; whatever is easiest). The JTAG drivers for the USB serial are easiest to get running on Linux.
The Dreamplug arrived with a working installation, but running the absolutely ancient Debian Lenny. A dist-upgrade through to Wheezy led to bricking it almost immediately, and so I did a fresh installation from scratch.
For a fresh installation, place a USB stick of suitable size (greater than 2GB is best) into your functional Debian installation. Then:
The Marvell bootloader boots from a VFAT partition, so you will need two partitions. The first should be a small
fat16(I picked 150MB) and the remainder an
ext3partition for Linux itself. There are good instructions available on the Tor/Dreamplug wiki which show you how to do this.
I grabbed the latest kernel (at this time, 3.2.7) from with-linux, and installed it with the following commands (assuming your USB stick is
$ sudo mount /dev/sdb1 /mnt $ sudo cp uImage /mnt $ sudo umount /mnt
You now need to use
debootstrapto install a fresh root image. Because it is ARM and your main PC is probably an x86, you will need to setup the QEMU CPU emulator. An extremely cool feature of QEMU is that it can do transparent emulation of foreign binaries, so you can chroot directly into the ARM filesystem and run commands as if they were x86. The
qemu-deboostrapcommand will take care of this for you, if you perform the steps below (again, assuming your USB stick is
$ sudo apt-get install qemu-user-static debootstrap $ sudo mount /dev/sdb2 /mnt $ sudo mkdir -p /mnt/usr/bin $ sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/ $ sudo qemu-debootstrap --arch=armel wheezy http://ftp.uk.debian.org/debian/
Now grab the kernel modules from the same place as your uImage (for 3.2.7, from here). Then, chroot into your fresh installation and untar them.
$ cd /mnt $ sudo tar -zxvf ~/sheeva-3.2.7-Modules.tar.gz $ sudo chroot /mnt $ depmod -a # edit /etc/network/interfaces # edit /etc/resolv.conf
The wireless setup involves some extremely crap firmware which relentlessly kernel panicked for me, so I just disabled it by adding the following to
/etc/modprobe.d/dpwifiap.conf, as I only want wired access:
blacklist libertas blacklist libertas_sdio
- From there on, put the USB stick into the Dreamplug, and follow the rest of the boot instructions from the Tor wiki to interact with the Marvell BIOS and boot from the USB stick. I copied the contents of the USB stick onto the internal MicroSD, and it all boots standalone now.
OCaml on ARM
One of the reasons I wanted an ARM-based setup is to experiment with the OCaml native code generation. Benedikt Meurer has been doing some excellent work on improving code generation for embedded systems, including support for 16-bit Thumb code, exception backtraces, and dynamic linking and profiling.
Once Linux was up and running, compiling up the latest ocaml-trunk was straightforward.
$ sudo apt-get install build-essential git $ git clone http://github.com/OCamlPro/ocp-ocaml svn-trunk $ cd ocp-ocaml $ ./configure && make world opt opt.opt install
This compiles the bytecode and native code compilers, and then compiles them again using the native code generator. This takes a while to do on the poor little ARM CPU. Once that finished, I compiled up a few simple modules and they worked great! Since the trunk of OCaml is a development branch, you may run into a few packaging issues (use the very latest OASIS to regenerate any
setup.ml, and you will need a small patch until PR 5503 is applied).