Preparing the host server
Firstly, install the required packages on your host server:
host# apt-get qemu vde nfs-kernel-server debootstrap
debootstrap allows the creation of a base Debian or Ubuntu system, and is a very simple method for building chroots and virtual machines quickly.
VDE is a virtual network emulator, much like user mode linux's uml_net, allowing a QEMU-emulated machine to connect to the host server's network through a tap interface.
Make sure that your host kernel has support for the "Universal TUN/TAP device driver"; the kernel configuration option for this is named "TUN". If you're running a modularised kernel, there's a good chance that it will
be named 'tun.o'.
Once you have a kernel with tun support, set up a tap interface for the emulated machine to communicate through. In
/etc/network/interfaces on your host machine, add the following stanza:
auto tap0
iface tap0 inet static
address 10.1.6.1
netmask 255.255.255.0
network 10.1.6.0
broadcast 10.1.6.255
vde-switch vde-net
Ensure that
/dev/net/tun is owned by group
vde-net and that you are also a member of that group; add this to your host server's
/etc/group file and log out and back in again, if necessary.
Then, bring up the interface:
host# ifup tap0
You'll need a partition with enough spare space on it to hold a basic Debian installation; make sure you have enough room on it to grow in the future. You can probably get away with 300Mb at the minimum. I placed my tree under
/nfs/share/arm/.
Now, run debootstrap to download and install the base Debian/arm distribution, and copy a few of the files from your host system into it:
host# mkdir /nfs/share/arm
host# debootstrap --foreign --arch arm etch /nfs/share/arm
host# cd /nfs/share/arm
host# cp /etc/passwd etc/passwd
host# cp /etc/shadow etc/shadow
host# cp /etc/group etc/group
host# echo "proc /proc proc defaults 0 0" > etc/fstab
host# echo "10.1.6.1:/nfs/share/arm / nfs defaults 0 1" >> etc/fstab
debootstrap's
--foreign option tells it to only perform the first stage of the bootstrap process, downloading and unpacking the packages. Since we're downloading Debian for a different architecture from that on which we're running on the host server, our host system would not be able to use this new system in a chroot to run the pre- and post-installation scripts.