Installing QEMU on Ubuntu 16.04
August 15, 2016 1 Comment
These are my experiences from installing QEMU from source, on Ubuntu 16.04.1.
Starting from the QEMU main page, I navigated to the download page. I downloaded using the command
wget http://wiki.qemu-project.org/download/qemu-2.7.0-rc2.tar.bz2
I unpacked the file using
tar xvjf qemu-2.7.0-rc2.tar.bz2
Changing directory as
cd qemu-2.7.0-rc2
I could then do the configuration, using the command
./configure --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc --enable-sdl
This, however, resulted in an error, as
qemu-2.7.0-rc2$ ./configure --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc --enable-sdl
ERROR: zlib check failed
Make sure to have the zlib libs and headers installed.
The zlib libs and headers were then installed, using the command
sudo apt-get install zlib1g-dev
Trying the configure command again resulted in
qemu-2.7.0-rc2$ ./configure --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc --enable-sdl
ERROR: User requested feature sdl
configure was not able to find it.
Install SDL devel
which was solved using the installation command
sudo apt-get install libsdl2-dev
Now the configure command went through!
But make failed!
qemu-2.7.0-rc2$ make
GEN i386-softmmu/config-devices.mak.tmp
GEN i386-softmmu/config-devices.mak
GEN arm-softmmu/config-devices.mak.tmp
GEN arm-softmmu/config-devices.mak
GEN x86_64-softmmu/config-devices.mak.tmp
GEN x86_64-softmmu/config-devices.mak
GEN config-all-devices.mak
GEN config-host.h
(cd /home/ola/qemu/qemu-2.7.0-rc2/pixman; autoreconf -v --install)
/bin/sh: 1: autoreconf: not found
Makefile:213: recipe for target '/home/ola/qemu/qemu-2.7.0-rc2/pixman/configure' failed
make: *** [/home/ola/qemu/qemu-2.7.0-rc2/pixman/configure] Error 127
So it was time for
sudo apt-get install autoconf
Here I remembered having used apt instead of apt-get, when I did an installation of another program, so I consulted this page about apt vs apt-get.
I tried
sudo apt install autoconf
which worked fine.
Running make now gave another error, as
qemu-2.7.0-rc2$ make
(cd /home/ola/qemu/qemu-2.7.0-rc2/pixman; autoreconf -v --install)
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
configure.ac:75: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
Makefile:213: recipe for target '/home/ola/qemu/qemu-2.7.0-rc2/pixman/configure' failed
make: *** [/home/ola/qemu/qemu-2.7.0-rc2/pixman/configure] Error 1
make: *** Deleting file '/home/ola/qemu/qemu-2.7.0-rc2/pixman/configure'
which led me to install libtool, as
sudo apt install libtool
And now make started to build things – and it seemed to have succeeded!
I then did
sudo make install
which, since the configure command included x86 as well as ARM as targets, we should be able to run Linux for x86 and for ARM on our newly installed QEMU.
Doing some search, and looking at this page about booting a raw disk image in QEMU, led me to commands for obtaining and unpacking a Linux image for x86, as
cd ..
mkdir i386
cd i386/
wget http://wiki.qemu.org/download/linux-0.2.img.bz2
bunzip2 linux-0.2.img.bz2
QEMU could then be started, with this Linux image as the chosen software, as
qemu-system-i386 -drive format=raw,file=linux-0.2.img
For ARM, I did
cd ..
mkdir arm
cd arm
wget http://wiki.qemu.org/download/arm-test-0.2.tar.gz
tar zxvf arm-test-0.2.tar.gz
I could then run QEMU, with the downloaded ARM Linux as software, by doing
cd arm-test/
qemu-system-arm -machine integratorcp -kernel zImage.integrator -initrd arm_root.img -nographic -append "console=ttyAMA0"
For this example, I used Ctrl-A followed by x, to exit the QEMU simulation.