I managed to get KVM working on the Cubietruck last week. It’s not exactly simple, but this post describes in overview how to do it.
(1) You will need a Cubietruck, a CP2102 serial cable, a micro SDHC card, a card reader for your host computer, and a network patch cable (the board supports wifi but it doesn’t work with the newer kernel we’ll be using). Optional: 2.5″ SATA HDD or SSD.
(2) Start with Hans De Goede’s AllWinner remix of Fedora 19, and get that working. It’s important to read his README file carefully.
make oldconfig make menuconfig
In menuconfig, enable Large Page Address Extension (LPAE), and then enable KVM in the Virtualization menu.
LOADADDR=0x40008000 make uImage dtbs make modules
sudo cp arch/arm/boot/uImage /boot/uImage.sunxi-test sudo cp arch/arm/boot/dts/sun7i-a20-cubietruck.dtb /boot/sun7i-a20-cubietruck.dtb.sunxi-test sudo make modules_install
Reboot, interrupt u-boot (using the serial console), and type the following commands to load the new kernel:
setenv bootargs console=ttyS0,115200 loglevel=9 earlyprintk ro rootwait root=/dev/mmcblk0p3 ext2load mmc 0 0x46000000 uImage.sunxi-test ext2load mmc 0 0x4b000000 sun7i-a20-cubietruck.dtb.sunxi-test env set fdt_high ffffffff bootm 0x46000000 - 0x4b000000
(4) Build this modified u-boot which supports Hyp mode.
make cubietruck_config make
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/YOURSDCARD bs=1024 seek=8
Reboot again, use the commands above to boot into the upstream kernel, and if everything worked you should see:
Brought up 2 CPUs SMP: Total of 2 processors activated. CPU: All CPU(s) started in HYP mode. CPU: Virtualization extensions available.
/dev/kvm should exist.
(5) Hack QEMU to create Cortex-A7 CPUs using this one-line patch.
Then you should be able to create VMs using libvirt. Note if using libguestfs you will need to use the direct backend (
LIBGUESTFS_BACKEND=direct) because of this libvirt bug.