1. Combining tutorials in Enabling KVM virtualization for Raspberry Pi 2 and KVM on the Raspberry Pi2 enabled KVM on RPi 2.
2. sudo apt-get install bridge-utils uml-utilities
3. Using example script in Networking in QEMU
4. So the script looks like (I take no credit for this):
#!/bin/sh
# Disable the QEMU sound driver
export QEMU_AUDIO_DRV=none
# Basic system setup an ARM vexpress with 1 CPU, 256M of RAM
smp=1
cpu=host
ram=256
machine=vexpress-a15
# Where are the kernel and root images stored
dir=/home/pi/vms/linaro
bridge=br0
tap=$(sudo tunctl -u $(whoami) -b)
sudo ip link set $tap up
sleep 1s
sudo brctl addif $bridge $tap
# Source: https://snapshots.linaro.org/ubuntu/images/kvm/latest/zImage-armv7
kernel=$dir/zImage-armv7
# Source: https://snapshots.linaro.org/ubuntu/images/kvm/latest/vexpress-v2p-ca15-tc1.dtb
dtb=$dir/vexpress-v2p-ca15-tc1.dtb
# Source: http://snapshots.linaro.org/ubuntu/images/kvm-guest/36/armhf/kvm-armhf.qcow2.xz
rootfs=$dir/kvm-armhf.qcow2
# Virtual machine Linux command line
cmdline=”root=/dev/vda2 rw mem=${ram}M console=ttyAMA0 rootwait rootfstype=ext4″
sudo qemu-system-arm -enable-kvm -smp $smp -m $ram -M $machine -cpu host \
-kernel $kernel -dtb $dtb -append “$cmdline” \
-drive if=none,id=rootfs,file=$rootfs \
-device virtio-blk-device,drive=rootfs \
-net nic,vlan=0,macaddr=00:16:35:AF:94:4B \
-net tap,vlan=0,ifname=$tap,script=no,downscript=no \
-monitor null -serial stdio -nographic
sudo brctl delif $bridge $tap
sudo ip link set $tap down
sudo tunctl -d $tap