Debian on the WRAP router platform
4 minutes read

Through a friend of mine, I got my hands on very neat embedded PC from PCengines, the WRAP version 1C. This board contains a 266MHz Geode SC1100 processor (compatible and comparable with an i585 processor), 64Mb onboard DRAM, a compact-flash slot, one or two mini-PCI ports and up to three onboard network cards. All this functionality is crammed on a PCB of roughly 15 x 15 cm.

For now, we had only one purpose: to run Linux on it, preferably without any custom or exotic distributions. So we packed it with a 1GB CF disk, along with a Atheros-compatible WiFi-card and booted it. Well, it didn’t boot at all since the CF disk was empty :)

Since this board does not provide any network-booting abilities, like PXE, not does it come with an IDE-connector for a CD-ROM, we had to come up with other means to install Linux on this thing.

We decided to preload the CF disk on another machine with a minimalistic Debian installation. So, I put the CF disk into a 8-in-1 USB media reader on my machine. To reduce the number of writes on the CF disk, I first created a minimalistic chroot-environment, using the debootstrap program of Debian:

debootstrap --arch i386 sid /root/cf_linux

This will download and install all necessary packages for a minimalistic Debian environment. After this process completed, I chroot’ed into it and ran the base configuration:

chroot /root/cf_linux /bin/sh
mount /proc

After the basic configuration, you might want to tweak the installation a bit more, like adding network drivers/interfaces, etc. The WRAP board uses the natsemi modules for its ethernet devices.

At this point, I had a small, more or less functional, Debian installation. However, to make it actual bootable, I needed to install a kernel and a bootloader. Since my “host-machine” is running a 2.6.9 kernel from the unstable branch, and the Atheros WiFi-card needs some custom compiled modules, I needed to install the same kernel on the WRAP board. Before we install the actual kernel image, we need to modify the /etc/fstab file with concrete mountpoints:

# /etc/fstab: minimalistic filesystem table
proc            /proc           proc    defaults  0 0
/dev/hda1       /               ext2    defaults,errors=remount-ro  0 1

Note that we do not have set up a swap partition for our WRAP board, nor that we make use of a journalling filesystem like EXT3.

We can now install the linux kernel and our bootloader (we use LILO, since GRUB has some boot problems on the WRAP system):

apt-get install kernel-image-2.6.9-1-386 lilo
# optionally install other packages of your choice...

After the installation of LILO, do not run liloconfig as it probably will ruin your current installed bootloader! Instead, we manually create its configuration file /etc/lilo.conf:

# /etc/lilo.conf: minimalistic LILO configuration
# NOTE: the following boot/root options *must* point to the device/partition
# of your CF-disk on the installation machine! This is *not* the actual boot
# and root device!!!

     label="Linux 2.6.9"
     # Set the root option to the *actual* root partition of your CF-disk!

Note that, since we’re not installing on the actual target system, that the boot/root options must point to the device and mountpoint of the CF disk as seen on the installation machine! To let the target system find its actual root partition, we set the root option in the image settings.

Another note is the explicit enabling of the console on the first serial port. Since our WRAP board does not have a keyboard, nor a VGA-card, we need to access it through our serial port. Do not forget to enable a getty line (named T0) for the serial port in /etc/inittab (you can disable all real consoles if you want).

Before actually installing the LILO bootblock, first create a partition on your CF disk, format it with a filesystem and copy our minimalistic installation:

# leave your chroot for this !
# partition it to your like, a single partition is sufficient
fdisk /dev/sda
mkfs.ext2 /dev/sda1
mkdir /root/cf
mount /dev/sda1 /root/cf -t ext2
cd /root/linux_cf && tar -cf - . | ( cd /root/cf && tar -xBf -)

Now the minimalistic Debian installation is copies to your CF disk, we should run LILO to make it bootable:

chroot /root/cf /bin/sh
mount /proc
# test your LILO configuration and install it when it's OK...
lilo -t && lilo -v
umount /proc
umount /root/cf

We now got a bootable CF disk with a minimalistic Debian installation! To test it, we put it into our WRAP board and fired it up. Lo and Behold! After the initialisation of the BIOS, a nice LILO boot prompt showed up and Linux started nicely. Everything seems to work like a charm. Well, almost everything, as the timekeeping of the WRAP is lost upon each reboot, however, that is fixable…

Back to posts