Don't understand german? Read or subscribe to my english-only feed.

QEMU: fast processor emulator

Many of you might know the emulator QEMU. This emulator converts each target CPU instruction into host instructions so you can boot another OS without leaving your current running system. Wernfried ‘amne’ Haas tested the current development ISO of grml snapshot with QEMU and he mentioned some features which let me take a closer look at it. ;-)

KQEMU is the “QEMU Accelerator“: the QEMU Accelerator Module increases the speed of QEMU when a PC is emulated on a PC. But: it is not open source:

The QEMU Accelerator is free to use, but it is a closed source proprietary product. You are not allowed to distribute it yourself to other people without an explicit authorisation. Distributors wishing to include the QEMU accelerator on CDs, ISO images or packages must contact the author to know the exact terms.

But if you can live with that just download the sources and compile it against the kernel headers matching your running kernel. Then ‘modprobe kqemu’ and you should see something like this in syslog:

QEMU Accelerator Module version 1.2.0, Copyright (c) 2005 Fabrice Bellard
This is a proprietary product. Read the LICENSE file for more information 
Redistribution of this module is prohibited without authorization
KQEMU installed, max_instances=4 max_locked_mem=128048kB. 

If you start QEMU now (for example: ‘qemu -boot d -cdrom grml_0.4.iso’) you can check KQEMU-support via switching to monitor mode pressing ctrl-alt-2 and typing ‘info kqemu’. If you get ‘kqemu is enabled’ it works as intended. Using the Debian unstable package did not work for me. :-( Therefore I created a Debian package based on the current upstream sources, a patch from bugreport #321232 and kqemu enabled. If you want to use my Debian package get it from the grml-repository.

Wernfried also mentioned the “snapshot feature”. This feature saves the whole virtual machine state to a file and you can restore it later again. Just switch to monitor mode (again: ctrl-alt-2) and use the command “savevm $FILENAME”. Load the VM again via running “loadvm $FILENAME”.

BTW: I wrote a mail to Fabrice Bellard asking for permission to provide the kqemu-kernel-module with the upcoming grml-release. Let’s see what’s the result. ;-)

One Response to “QEMU: fast processor emulator”

  1. micah Says:

    Hey Mika,

    i couldn’t help but comment as your name is too similar…

    if I get your qemu debian package, how do I build kqemu? Do i get the deb source of your qemu package, then get the kqemu source from the website, untar it in the deb soruce and then build it there?

    thanks for the clarification,
    micah