Edit: I had update the article to build from latest package and testing.
You might notice that I had written an article before about building QEMU from source. That one is QEMU KVM (Kernel Virtual Machine). As per version version 1.3 QEMU-KVM is merged to upstream QEMU project therefore the QEMU-KVM is no longer maintained. It’s been done long time ago, actually.
QEMU is a generic and open source machine emulator and virtualizer.
When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine. By using dynamic translation, it achieves very good performance.
In this article we will discuss about installing QEMU and use following requirement:
- Slackware64 14.0, although any version is OK
- latest qemu source code
There are two options for us: building the stable release or building the development code.
Obtain the Source Code
Between the stable release source code and development code, which one is suitable for us?If you want to download the latest stable release, you can obtain it from qemu official site here.
At the time of writing this article, the latest stable version is 2.5.0 (per March 20th 2016). You can download it by direct link here. http://wiki.qemu-project.org/download/qemu-2.5.0.tar.bz2
Once you have done downloading, uncompress it with:
mv qemu-2.5.0.tar.bz2 /usr/src tar -jxvf qemu-2.5.0.tar.bz2 cd qemu-2.5.0
If you want to download the development code. You can clone the git repository by:
cd /usr/src git clone git://git.qemu-project.org/qemu.git cd qemu
For any option we choose, we should have qemu source code now.
At this point we are inside the source directory. Qemu support many features. We can list the feature by
For now, we just want a working Qemu with debug enable and install it to /usr. First, create a directory build. This directory will be used for all building process we do.
mkdir build cd build
Next we do usual chant:
../configure --enable-debug --prefix=/usr --enable-modules make -j4
If you want to know my build, here it is:
../configure --enable-debug --prefix=/usr --enable-modules --enable-libusb \ --enable-usb-redir --enable-spice --enable-smartcard
If you like, you can go to next section for testing. If not, you can install QEMU by
Congratulation, you had installed Qemu.
To test if default settings works.
x86_64-softmmu/qemu-system-x86_64 -L pc-bios
To test if KVM is working
x86_64-softmmu/qemu-system-x86_64 -cpu host --enable-kvm -L pc-bios
To test with Linux image
wget http://wiki.qemu.org/download/linux-0.2.img.bz2 bunzip2 linux-0.2.img.bz2 x86_64-softmmu/qemu-system-x86_64 -cpu host --enable-kvm -display gtk linux-0.2.imgqemu, tools, virtualization