Hosts/Linux

From QEMU
Revision as of 15:56, 2 June 2012 by Stefan Weil (talk | contribs) (Build instructions for Debian and related Linux distributions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

QEMU on Linux hosts

This documentation is work in progress - more information needs to be added for different Linux distributions.

Linux is QEMU's main host platform. Therefore it is the platform which gets most support. Both 32 and 64 bit Linux hosts are supported. Most of the following instructions are valid for both variants.

Building QEMU for Linux

Most Linux distributions already provide binary packages for QEMU (or KVM).

Usually they also include all packages which are needed to compile QEMU for Linux. The default installation of most distributions will not include everything, so you have to install some additional packages before you can build QEMU.

Debian GNU Linux / Ubuntu Linux / Linux Mint

Debian and Debian based or similar distributions normally include compiler and compilation tools (gcc, make, ...) in their default installation.

Required additional packages

  • git (30 MiB), version manager
  • glib2.0-dev (9 MiB), this automatically includes zlib1g-dev

Recommended additional packages

  • git-email, used for sending patches
  • libsdl1.2-dev (23 MiB), needed for the SDL based graphical user interface

Getting the source code

If you want the latest code, follow the development of the code, work with several versions or maybe even contribute to the code, you will need a local copy of the QEMU code repository which is managed using git.

Get the code like this:

git clone git://git.qemu.org/qemu.git

The resulting directory qemu is your QEMU root directory. QEMU supports builds in this directory (not recommended) or in an extra directory (out-of-tree builds, recommended).

There can be any number of out-of-tree builds, so if you plan to make cross builds, debug and release builds, out-of-tree builds are what you need.

Here is my typical build scenario:

# Switch to the QEMU root directory.
cd qemu
# Prepare a native debug build.
mkdir -p bin/debug/native
cd bin/debug/native
# Configure QEMU and start the build.
../../../configure --enable-debug
make
# Return to the QEMU root directory.
cd ../../..

Now let's start a simple test:

bin/debug/native/x86_64-softmmu/qemu-system-x86_64 -L pc-bios

This test runs the QEMU system emulation which boots a PC BIOS.

Cross builds

Cross building for non-native architectures is quite common. TODO: add description.

Native builds

Running QEMU on Linux

System emulation

All QEMU system emulation should be working.

User mode emulation

User mode emulation is also supported.

Links