python-vmbuilder is also an interesting approach. This is probably the easiest but might also be more error-prone than automatic vmbuilder approach.
This installation takes about half an hour.
Precautions? CF-card lifetime?
Boot the virtual machine off the CDROM.
sudo qemu -hda /dev/sdc -cdrom ubuntu-10.04-server-i386.iso -m 128 -net nic,vlan=0 -net user,vlan=0
Use the entire CF-card, set the timezone and add the OpenSSH server. Then reboot and turn off the virtual machine.
Boot the virtual machine off the disk instead of off the CDROM.
sudo qemu -hda /dev/sdc -m 128 -net nic,vlan=0 -net user,vlan=0
Log into the new installation, update it and install a generic kernel. See note 1.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install linux-image-generic
TODO: document removal of previous kernels.
Reconfigure the your system to spawn a login shell on the serial port. Paste the following into /etc/init/ttyS0.conf:
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -L 115200 ttyS0 vt102
Edit /etc/default/grub:
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"
GRUB_CMDLINE_LINUX=""
# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
sudo update-grub
The card is 8GB with about 5,8GB free space after installation.
Fill it up with nothing:
sudo dd if=/dev/zero of=file5G.random bs=1M count=5000
#!/bin/sh
while true; do
dd if=/dev/zero of=8M.zero bs=1M count=7
done
Did a bunch of of runs, no great variance so just one result-set is provided.
dd if=/dev/zero of=8M.zero bs=1M count=7
hdparm -tT /dev/sda
Timing cached reads: 92 MB in 2.02 seconds = 45.55 MB/sec
Timing buffered disk reads: 34 MB in 3.02 seconds = 11.24 MB/sec
Write performance: 7340032 bytes (7,3 MB) copied, 0,782797 s, 9,4 MB/s
/dev/sda1 7334612 6953884 8148 100% /
/dev/sda1 7334612 6953888 8144 100% /
/dev/sda1 7334612 6953888 8144 100% /