Previous: Set up the KVM host system.
To run KVM, you need to build QEMU for ARM. There are several possibilities here:
- build it on native ARM hardware and copy the binary across (should work but not everybody has conveniently set up native hardware)
- run Linux on the Fast Model and build it natively there (should work but will be painfully slow)
- build under QEMU chroot (runs into QEMU bugs at the moment)
- cross compile (tedious to set up and disables a lot of options like SDL support)
This page documents how to do this as a cross compilation.
If you haven't already, install the cross compiler:
$ sudo apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-armhf-cross linux-libc-dev-armhf-cross gcc-arm-linux-gnueabi libc6-dev-armhf-cross cpp-arm-linux-gnueabi
Install some native build dependencies:
$ sudo apt-get build-dep qemu-linaro $ sudo apt-get install libfdt-dev
(This pulls in more than necessary but is an easy way to do it).
We'll use xapt to create and install cross versions of libz and glib, which is the minimal set of dependencies QEMU need (assuming you already have qemu-user-static installed):
$ sudo apt-get install xapt
First create a new file /etc/apt/sources.list.d/armhf-trusty.list with the following contents:
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports trusty main restricted universe multiverse deb-src [arch=armhf] http://ports.ubuntu.com/ubuntu-ports trusty main restricted universe multiverse
$ sudo xapt -a armhf -m -b zlib1g-dev libglib2.0-dev libfdt-dev
This will build a pile of 37 _all debs in /var/lib/xapt/output/; we need most of them, so it's easiest to install them all:
$ sudo dpkg -i /var/lib/xapt/output/*.deb
Put this arm-linux-gnueabihf-pkg-config script on your PATH somewhere, and make it executable, eg:
$ chmod a+x /usr/local/bin/arm-linux-gnueabihf-pkg-config
Get and build QEMU:
$ git clone git://git.linaro.org/qemu/qemu-linaro.git qemu $ cd qemu $ mkdir arm-build $ cd arm-build $ ../configure --cross-prefix=arm-linux-gnueabihf- --target-list=arm-softmmu --enable-kvm $ make $ sudo make install DESTDIR=/srv/arm-trusty-root
This will build QEMU with the cross compiler and install it into the nfs root's /usr/local/bin.
Next: Set up the KVM guest system.
PeterMaydell/KVM/HowTo/BuildQEMU (last modified 2014-12-06 17:44:25)