QEMU is a generic and open source processor emulator which
achieves a good emulation speed by using dynamic translation.
QEMU has two operating modes:
Full system emulation. In this mode, QEMU emulates a full system
(for example a PC), including a processor and various
peripherials. It can be used to launch different Operating
Systems without rebooting the PC or to debug system code.
User mode emulation (Linux host only). In this mode, QEMU can
launch Linux processes compiled for one CPU on another CPU.
As QEMU requires no host kernel driver to run, it is very safe
and easy to use.
QEMU generic features
User space only or full system emulation.
Using dynamic translation to native code for reasonnable speed.
Working on x86 and PowerPC hosts. Being tested on ARM, Sparc32,
Alpha and S390.
Self-modifying code support.
Precise exceptions support.
The virtual CPU is a library (libqemu) which can be used in
other projects (look at `qemu/tests/qruncom.c' to have an
example of user mode libqemu usage).
QEMU user mode emulation features
Generic Linux system call converter, including most ioctls.
clone() emulation using native CPU clone() to use Linux
scheduler for threads.
Accurate signal handling by remapping host signals to target
QEMU full system emulation features
QEMU can either use a full software MMU for maximum portability
or use the host system call mmap() to simulate the target MMU.
As qemu is a virtualization program it doesnt touch your real
discs, instead you give it a big file and tell the system to use
that for it's C:.
As a simple start we'll set aside a blank 2Gb file for Windows
to install into, we can create that easily enough:
# dd of=newhdd.img bs=1024 seek=4000000 count=0
0+0 records in
0+0 records out
0 bytes transferred in 0.000493 seconds (0 bytes/sec)
That's given us a file called newhdd.img which is 4000000 bytes
long, close enough to 4Gb for us to proceed.
The next thing we need to do is have a Windows XP CD-ROM handy,
we have two choices here either place it in your CD-ROM drive,
or use an ISO image.
We want to tell the system that it's first hard drive should be
the big empty file we have just created, that the CD-ROM drive
should be read from the drive we have - and that it should boot
# qemu -boot d -cdrom /dev/cdrom -hda newhdd.img
QEMU 0.6.0 monitor - type 'help' for more information
The '-boot d' flag tells the system to boot from the CD-ROM
drive we've specified, the '-hda newhdd.img' tells the system
that the first hard drive should be the contents of the file
hd.img which we created previously.
This should bring up a window upon your desktop within which
you'll see Windows boot. You can click in the window to give it
focus, and when you wish to return the mouse to your desktop
press "Ctrl + Shift". Pressing Ctrl + Shift + f will toggle you
between fullscreen and windowed mode.
Now you install windows XP normalway.If you want to check how to
install windows xp check
When it came to networking that Debian doesn't
allow non-root users to write to the tun driver by default, as
#chgrp users /dev/net/tun
#chmod g+w /dev/net/tun
(If you don't have that device file you will need to run these
commands, this assumes you're running Kernel 2.6.x)
#mkdir -p /dev/net
#mknod /dev/net/tun c 10 200
Finally we add in the module to enable the device :
#echo 'tun' >> /etc/modules
Now that you're installed the operating system you can create a
backup of the image by simply copying the 'newhdd.img' file
which is being used as the disk drive:
#cp newhdd.img pristine.img
Any time you wish to restore back simply overwrite the
newhdd.img with the pristine one - you'll never have to
Now that we've done the installation we can start the system for
# qemu -hda newhdd.img -boot c
From bootup to login prompt takes me 39 seconds, which is pretty
Networking should be setup properly for you in the sense that on
the host machine you will have the interface tun0 setup.
Once that's done you need to setup some way for the emulated
machine to talk to the world, or it's host at least.
We chose to give the host machine an IP address on it's own
network. We do this by first setting up an address on the host,
then on the guest.
We use 172.20.0.1 for the host, and 172.20.0.2 for the Windows
On the host run:
# ifconfig tun0 172.20.0.1 up
Then on the host adjust the networking so that the Windows
operating system has the ip address 172.20.0.2, with the gateway
set to point to 172.20.0.1.
This should allow you to ping both the guest from the host, and