["FrontPage"] > [:Portal_Welcome:...] > [:Portal_Softwares:Softwares] > QEMU

{*} {o} {o} [:Portal_Welcome/Discussion#level:User]

Translation(s): any

(!) [:/Discussion:Discussion]


QEMU overview

QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed. ["Xen"] is the free source alternative to ["VMWare"] and ["Xen"] is the free source alternative to QEMU.

QEMU has two operating modes:

As QEMU requires no host kernel patches to run, it is very safe and easy to use.

There is also an [http://fabrice.bellard.free.fr/qemu/kqemu-doc.html accelerator kernel module] available which speeds up execution when emulating an x86 CPU on a native x86 CPU. The latest release of the kernel accelerator module is open source, and currently available in DebianExperimental.

gcc-4.0 hint

qemu can not yet be compiled with gcc-4.0. Use something like

 $ ./configure --cc=gcc-3.4 --host-cc=gcc-3.4

when compiling qemu yourself and your gcc is already gcc-4.0.

Setting up a testing/unstable system with qemu

qemu is especially handy to set up an emulated testing/unstable system when working on the Debian installer itself or on the boot system, or when trying some experimental features without impact on the productive system. A sid system can be set up with the following steps:

After the installation is done, the system can be booted with

 $ qemu -hda debian.img -m 256

Backing up the disk image

The disk image "debian.img" is a [http://www.wiktionary.org/wiki/sparse sparse] file. After installing a ?DebianBaseSystem, it fits on a CD-ROM even without compression:

 $ tar c --sparse -f backup.tar debian.img

creates a ["tar"] file of about 320M (supposed that the image contains a 1.["9GB"] ext3 root filesystem and a ["250MB"] swap partition). After unpacking with tar xf, the sparse file is restored and can be booted immediately.

Better still, convert from a sparse file into the qemu's own "Copy On Write" image. This conversion will save the same space and still be runnable.

 $ qemu-image convert -c debian.img -O qcow debian_recompressed.img

If the guest system's image is still larger than reasonable, then open up the Guest system and run "dd if=/dev/zero of=/tmp/junk ; sync ; rm /tmp/junk". That will push out deleted file scraps, recompression should work then.

Using kqemu accelerator

As of version 1.3.0pre10, Kqemu is now distributed under a GPL licence (see [http://fabrice.bellard.free.fr/qemu/kqemu-changelog.html Kqemu changelog]). Consequently it is quite simple to compile and install it yourself, using the package kqemu-source, or any of the prebuild modules : kqemu-module-$(uname -r).

qemu will use the kernel accelerator by default if available for user-space processes in the emulated OS. If you wish to use the kernel accelerator for the emulated kernel as well, then use the -kernel-kqemu option to qemu. When running a current Debian release under qemu with this option, you may need to add pci=nobios to the kernel command line.


CategoryEmdebian