Qemu
Qemu
User Documentation
i
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
7 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Chapter 1: Introduction 1
1 Introduction
1.1 Features
QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation
speed.
QEMU has two operating modes:
− Full system emulation. In this mode, QEMU emulates a full system (for example a PC),
including one or several processors and various peripherals. It can be used to launch
different Operating Systems without rebooting the PC or to debug system code.
− User mode emulation. In this mode, QEMU can launch processes compiled for one
CPU on another CPU. It can be used to launch the Wine Windows API emulator
(http://www.winehq.org) or to ease cross-compilation and cross-debugging.
QEMU can run without an host kernel driver and yet gives acceptable performance.
For system emulation, the following hardware targets are supported:
• PC (x86 or x86 64 processor)
• ISA PC (old style PC without PCI bus)
• PREP (PowerPC processor)
• G3 BW PowerMac (PowerPC processor)
• Mac99 PowerMac (PowerPC processor, in progress)
• Sun4m (32-bit Sparc processor)
• Sun4u (64-bit Sparc processor, in progress)
• Malta board (32-bit MIPS processor)
• ARM Integrator/CP (ARM926E, 1026E or 946E processor)
• ARM Versatile baseboard (ARM926E)
• ARM RealView Emulation baseboard (ARM926EJ-S)
• Spitz, Akita, Borzoi and Terrier PDAs (PXA270 processor)
• Freescale MCF5208EVB (ColdFire V2).
• Arnewsh MCF5206 evaluation board (ColdFire V2).
For user emulation, x86, PowerPC, ARM, MIPS, Sparc32/64 and ColdFire(m68k) CPUs
are supported.
Chapter 2: Installation 2
2 Installation
If you want to compile QEMU yourself, see Chapter 6 [compilation], page 37.
2.1 Linux
If a precompiled package is available for your distribution - you just have to install it.
Otherwise, see Chapter 6 [compilation], page 37.
2.2 Windows
Download the experimental binary installer at http://www.free.oszoo.org/
download.html.
2.3 Mac OS X
Download the experimental binary installer at http://www.free.oszoo.org/
download.html.
Chapter 3: QEMU PC System emulator 3
3.1 Introduction
The QEMU PC System emulator simulates the following peripherals:
− i440FX host PCI bridge and PIIX3 PCI to ISA bridge
− Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions
(hardware level, including all non standard modes).
− PS/2 mouse and keyboard
− 2 PCI IDE interfaces with hard disk and CD-ROM support
− Floppy disk
− PCI/ISA PCI network adapters
− Serial ports
− Creative SoundBlaster 16 sound card
− ENSONIQ AudioPCI ES1370 sound card
− Adlib(OPL2) - Yamaha YM3812 compatible chip
− PCI UHCI USB controller and a virtual USB hub.
SMP is supported with up to 255 CPUs.
Note that adlib is only available when QEMU was configured with -enable-adlib
QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL VGA BIOS.
QEMU uses YM3812 emulation by Tatsuyuki Satoh.
3.3 Invocation
usage: qemu [options] [disk_image]
disk image is a raw hard disk image for IDE hard disk 0.
General options:
‘-M machine’
Select the emulated machine (-M ? for list)
‘-fda file’
‘-fdb file’
Use file as floppy disk 0/1 image (see Section 3.6 [disk images], page 17). You
can use the host floppy by using ‘/dev/fd0’ as filename (see Section 3.6.5
[host drives], page 20).
Chapter 3: QEMU PC System emulator 4
‘-hda file’
‘-hdb file’
‘-hdc file’
‘-hdd file’
Use file as hard disk 0, 1, 2 or 3 image (see Section 3.6 [disk images], page 17).
‘-cdrom file’
Use file as CD-ROM image (you cannot use ‘-hdc’ and and ‘-cdrom’ at the
same time). You can use the host CD-ROM by using ‘/dev/cdrom’ as filename
(see Section 3.6.5 [host drives], page 20).
‘-boot [a|c|d|n]’
Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk
boot is the default.
‘-snapshot’
Write to temporary files instead of disk image files. In this case, the raw disk
image you use is not written back. You can however force the write back by
pressing hC-a si (see Section 3.6 [disk images], page 17).
‘-no-fd-bootchk’
Disable boot signature checking for floppy disks in Bochs BIOS. It may be
needed to boot from old floppy disks.
‘-m megs’ Set virtual RAM size to megs megabytes. Default is 128 MB.
‘-smp n’ Simulate an SMP system with n CPUs. On the PC target, up to 255 CPUs are
supported.
‘-audio-help’
Will show the audio subsystem help: list of drivers, tunable parameters.
‘-soundhw card1,card2,... or -soundhw all’
Enable audio and selected sound hardware. Use ? to print all available sound
hardware.
qemu -soundhw sb16,adlib hda
qemu -soundhw es1370 hda
qemu -soundhw all hda
qemu -soundhw ?
‘-localtime’
Set the real time clock to local time (the default is to UTC time). This option
is needed to have correct date in MS-DOS or Windows.
‘-pidfile file’
Store the QEMU process PID in file. It is useful if you launch QEMU from a
script.
‘-daemonize’
Daemonize the QEMU process after initialization. QEMU will not detach from
standard IO until it is ready to receive connections on any of its devices. This
option is a useful way for external programs to launch QEMU without having
to cope with initialization race conditions.
Chapter 3: QEMU PC System emulator 5
‘-win2k-hack’
Use it when installing Windows 2000 to avoid a disk full bug. After Windows
2000 is installed, you no longer need this option (this option slows down the
IDE transfers).
‘-option-rom file’
Load the contents of file as an option ROM. This option is useful to load things
like EtherBoot.
‘-name string’
Sets the name of the guest. This name will be display in the SDL window
caption. The name will also be used for the VNC server.
Display options:
‘-nographic’
Normally, QEMU uses SDL to display the VGA output. With this option, you
can totally disable graphical output so that QEMU is a simple command line
application. The emulated serial port is redirected on the console. Therefore,
you can still use QEMU to debug a Linux kernel with a serial console.
‘-no-frame’
Do not use decorations for SDL windows and start them using the whole
available screen space. This makes the using QEMU in a dedicated desktop
workspace more convenient.
‘-full-screen’
Start in full screen.
‘-vnc display[,option[,option[,...]]]’
Normally, QEMU uses SDL to display the VGA output. With this option, you
can have QEMU listen on VNC display display and redirect the VGA display
over the VNC session. It is very useful to enable the usb tablet device when
using this option (option ‘-usbdevice tablet’). When using the VNC display,
you must use the ‘-k’ parameter to set the keyboard layout if you are not using
en-us. Valid syntax for the display is
interface:d
TCP connections will only be allowed from interface on display d.
By convention the TCP port is 5900+d. Optionally, interface can
be omitted in which case the server will bind to all interfaces.
unix:path
Connections will be allowed over UNIX domain sockets where path
is the location of a unix socket to listen for connections on.
none
VNC is initialized by not started. The monitor change command
can be used to later start the VNC server.
Following the display value there may be one or more option flags separated by
commas. Valid options are
Chapter 3: QEMU PC System emulator 6
password
Require that password based authentication is used for client con-
nections. The password must be set separately using the change
command in the Section 3.5 [pcsys monitor], page 13
tls
Require that client use TLS when communicating with the VNC
server. This uses anonymous TLS credentials so is susceptible to a
man-in-the-middle attack. It is recommended that this option be
combined with either the x509 or x509verify options.
x509=/path/to/certificate/dir
Valid if tls is specified. Require that x509 credentials are used for
negotiating the TLS session. The server will send its x509 certificate
to the client. It is recommended that a password be set on the VNC
server to provide authentication of the client when this is used. The
path following this option specifies where the x509 certificates are
to be loaded from. See the Section 3.10 [vnc security], page 24
section for details on generating certificates.
x509verify=/path/to/certificate/dir
Valid if tls is specified. Require that x509 credentials are used for
negotiating the TLS session. The server will send its x509 certifi-
cate to the client, and request that the client send its own x509
certificate. The server will validate the client’s certificate against
the CA certificate, and reject clients when validation fails. If the
certificate authority is trusted, this is a sufficient authentication
mechanism. You may still wish to set a password on the VNC
server as a second authentication layer. The path following this
option specifies where the x509 certificates are to be loaded from.
See the Section 3.10 [vnc security], page 24 section for details on
generating certificates.
‘-k language’
Use keyboard layout language (for example fr for French). This option is only
needed where it is not easy to get raw PC keycodes (e.g. on Macs, with some
X11 servers or with a VNC display). You don’t normally need to use it on
PC/Linux or PC/Windows hosts.
The available layouts are:
ar de-ch es fo fr-ca hu ja mk no pt-br sv
da en-gb et fr fr-ch is lt nl pl ru th
de en-us fi fr-be hr it lv nl-be pt sl tr
The default is en-us.
USB options:
‘-usb’ Enable the USB driver (will be the default soon)
‘-usbdevice devname’
Add the USB device devname. See Section 3.9.1 [usb devices], page 23.
Chapter 3: QEMU PC System emulator 7
Network options:
‘-net nic[,vlan=n][,macaddr=addr][,model=type]’
Create a new Network Interface Card and connect it to VLAN n (n = 0 is the
default). The NIC is an ne2k pci by default on the PC target. Optionally, the
MAC address can be changed. If no ‘-net’ option is specified, a single NIC
is created. Qemu can emulate several different models of network card. Valid
values for type are i82551, i82557b, i82559er, ne2k_pci, ne2k_isa, pcnet,
rtl8139, smc91c111, lance and mcf_fec. Not all devices are supported on all
targets. Use -net nic,model=? for a list of available devices for your target.
‘-net user[,vlan=n][,hostname=name]’
Use the user mode network stack which requires no administrator privilege to
run. ‘hostname=name’ can be used to specify the client hostname reported by
the builtin DHCP server.
‘-net tap[,vlan=n][,fd=h][,ifname=name][,script=file]’
Connect the host TAP network interface name to VLAN n and use the network
script file to configure it. The default network script is ‘/etc/qemu-ifup’.
Use ‘script=no’ to disable script execution. If name is not provided, the OS
automatically provides one. ‘fd=h’ can be used to specify the handle of an
already opened host TAP interface. Example:
qemu linux.img -net nic -net tap
More complicated example (two NICs, each one connected to a TAP device)
qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
-net nic,vlan=1 -net tap,vlan=1,ifname=tap1
‘-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]’
Connect the VLAN n to a remote VLAN in another QEMU virtual machine
using a TCP socket connection. If ‘listen’ is specified, QEMU waits for in-
coming connections on port (host is optional). ‘connect’ is used to connect to
another QEMU instance using the ‘listen’ option. ‘fd=h’ specifies an already
opened TCP socket.
Example:
# launch a first QEMU instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
-net socket,listen=:1234
# connect the VLAN 0 of this instance to the VLAN 0
# of the first instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
-net socket,connect=127.0.0.1:1234
‘-net socket[,vlan=n][,fd=h][,mcast=maddr:port]’
Create a VLAN n shared with another QEMU virtual machines using a UDP
multicast socket, effectively making a bus for every QEMU with same multicast
address maddr and port. NOTES:
1. Several QEMU can be running on different hosts and share same bus (as-
suming correct multicast setup for these hosts).
Chapter 3: QEMU PC System emulator 8
the server option QEMU will wait for a client socket application
to connect to the port before continuing, unless the nowait option
was specified. The nodelay option disables the Nagle buffering
algorithm. If host is omitted, 0.0.0.0 is assumed. Only one TCP
connection at a time is accepted. You can use telnet to connect
to the corresponding character device.
Example to send tcp console to 192.168.0.2 port 4444
-serial tcp:192.168.0.2:4444
Example to listen and wait on port 4444 for connection
-serial tcp::4444,server
Example to not wait and listen on ip 192.168.0.100 port
4444
-serial tcp:192.168.0.100:4444,server,nowait
telnet:host:port[,server][,nowait][,nodelay]
The telnet protocol is used instead of raw tcp sockets. The options
work the same as if you had specified -serial tcp. The difference
is that the port acts like a telnet server or client using telnet option
negotiation. This will also allow you to send the MAGIC SYSRQ
sequence if you use a telnet that supports sending the break se-
quence. Typically in unix telnet you do it with Control-] and then
type "send break" followed by pressing the enter key.
unix:path[,server][,nowait]
A unix domain socket is used instead of a tcp socket. The option
works the same as if you had specified -serial tcp except the unix
domain socket path is used for connections.
mon:dev_string
This is a special option to allow the monitor to be multiplexed
onto another serial port. The monitor is accessed with key se-
quence of hControl-ai and then pressing hci. See monitor access Sec-
tion 3.4 [pcsys keys], page 13 in the -nographic section for more
keys. dev string should be any one of the serial devices specified
above. An example to multiplex the monitor onto a telnet server
listening on port 4444 would be:
-serial mon:telnet::4444,server,nowait
‘-parallel dev’
Redirect the virtual parallel port to host device dev (same devices as the serial
port). On Linux hosts, ‘/dev/parportN’ can be used to use hardware devices
connected on the corresponding host parallel port.
This option can be used several times to simulate up to 3 parallel ports.
Use -parallel none to disable all parallel ports.
‘-monitor dev’
Redirect the monitor to host device dev (same devices as the serial port). The
default device is vc in graphical mode and stdio in non graphical mode.
Chapter 3: QEMU PC System emulator 12
‘-echr numeric_ascii_value’
Change the escape character used for switching to the monitor when using mon-
itor and serial sharing. The default is 0x01 when using the -nographic option.
0x01 is equal to pressing Control-a. You can select a different character from
the ascii control keys where 1 through 26 map to Control-a through Control-
z. For instance you could use the either of the following to change the escape
character to Control-t.
-echr 0x14
-echr 20
‘-s’ Wait gdb connection to port 1234 (see Section 3.11 [gdb usage], page 27).
‘-p port’ Change gdb connection port. port can be either a decimal number to specify a
TCP port, or a host device (same devices as the serial port).
‘-S’ Do not start CPU at startup (you must type ’c’ in the monitor).
‘-hdachs c,h,s,[,t]’
Force hard disk 0 physical geometry (1 <= c <= 16383, 1 <= h <= 16, 1 <= s
<= 63) and optionally force the BIOS translation mode (t=none, lba or auto).
Usually QEMU can guess all those parameters. This option is useful for old
MS-DOS disk images.
‘-L path’ Set the directory for the BIOS, VGA BIOS and keymaps.
‘-std-vga’
Simulate a standard VGA card with Bochs VBE extensions (default is Cirrus
Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0 VBE ex-
tensions (e.g. Windows XP) and if you want to use high resolution modes (>=
1280x1024x16) then you should use this option.
‘-no-acpi’
Disable ACPI (Advanced Configuration and Power Interface) support. Use it
if your guest OS complains about ACPI problems (PC target machine only).
‘-no-reboot’
Exit instead of rebooting.
‘-loadvm file’
Start right away with a saved state (loadvm in monitor)
‘-semihosting’
Enable semihosting syscall emulation (ARM and M68K target machines only).
On ARM this implements the "Angel" interface. On M68K this implements
the "ColdFire GDB" interface used by libgloss.
Note that this allows guest direct access to the host filesystem, so should only
be used with trusted guest OS.
Chapter 3: QEMU PC System emulator 13
3.4 Keys
During the graphical emulation, you can use the following keys:
hCtrl-Alt-fi Toggle full screen
hCtrl-Alt-ni Switch to virtual console ’n’. Standard console mappings are:
1 Target system display
2 Monitor
3 Serial port
hCtrl-Alti Toggle mouse and keyboard grab.
In the virtual consoles, you can use hCtrl-Upi, hCtrl-Downi, hCtrl-PageUpi and hCtrl-PageDowni to
move in the back log.
During emulation, if you are using the ‘-nographic’ option, use hCtrl-a hi to get terminal
commands:
hCtrl-a hi Print this help
hCtrl-a xi Exit emulator
hCtrl-a si Save disk data back to file (if -snapshot)
hCtrl-a ti toggle console timestamps
hCtrl-a bi Send break (magic sysrq in Linux)
hCtrl-a ci Switch between console and monitor
hCtrl-a Ctrl-ai
Send Ctrl-a
3.5.1 Commands
The following commands are available:
‘help or ? [cmd]’
Show the help for all commands or just for command cmd.
‘commit’ Commit changes to the disk images (if -snapshot is used)
‘info subcommand’
show various information about the system state
‘info network’
show the various VLANs and the associated devices
Chapter 3: QEMU PC System emulator 14
‘info block’
show the block devices
‘info registers’
show the cpu registers
‘info history’
show the command line history
‘info pci’ show emulated PCI device
‘info usb’ show USB devices plugged on the virtual USB hub
‘info usbhost’
show all USB host devices
‘info capture’
show information about active capturing
‘info snapshots’
show list of VM snapshots
‘info mice’
show which guest mouse is receiving events
‘q or quit’
Quit the emulator.
‘eject [-f] device’
Eject a removable medium (use -f to force it).
‘change device setting’
Change the configuration of a device
‘change diskdevice filename ’
Change the medium for a removable disk device to point to file-
name. eg
(qemu) change cdrom /path/to/some.iso
‘change vnc display,options ’
Change the configuration of the VNC server. The valid syntax for
display and options are described at Section 3.3 [sec invocation],
page 3. eg
(qemu) change vnc localhost:1
‘change vnc password’
Change the password associated with the VNC server. The monitor
will prompt for the new password to be entered. VNC passwords
are only significant upto 8 letters. eg.
(qemu) change vnc password
Password: ********
‘screendump filename’
Save screen into PPM image filename.
Chapter 3: QEMU PC System emulator 15
‘mouse_move dx dy [dz]’
Move the active mouse to the specified coordinates dx dy with optional scroll
axis dz.
‘mouse_button val’
Change the active mouse button state val (1=L, 2=M, 4=R).
‘mouse_set index’
Set which mouse device receives events at given index, index can be obtained
with
info mice
‘wavcapture filename [frequency [bits [channels]]]’
Capture audio into filename. Using sample rate frequency bits per sample bits
and number of channels channels.
Defaults:
− Sample rate = 44100 Hz - CD quality
− Bits = 16
− Number of channels = 2 - Stereo
‘stopcapture index’
Stop capture with a given index, index can be obtained with
info capture
‘log item1[,...]’
Activate logging of the specified items to ‘/tmp/qemu.log’.
‘savevm [tag|id]’
Create a snapshot of the whole virtual machine. If tag is provided, it is used
as human readable identifier. If there is already a snapshot with the same tag
or ID, it is replaced. More info at Section 3.6.3 [vm snapshots], page 17.
‘loadvm tag|id’
Set the whole virtual machine to the snapshot identified by the tag tag or the
unique snapshot ID id.
‘delvm tag|id’
Delete the snapshot identified by tag or id.
‘stop’ Stop emulation.
‘c or cont’
Resume emulation.
‘gdbserver [port]’
Start gdbserver session (default port=1234)
‘x/fmt addr’
Virtual memory dump starting at addr.
‘xp /fmt addr’
Physical memory dump starting at addr.
fmt is a format which tells the command how to format the data. Its syntax is:
‘/{count}{format}{size}’
Chapter 3: QEMU PC System emulator 16
‘p or print/fmt expr’
Print expression value. Only the format part of fmt is used.
‘sendkey keys’
Send keys to the emulator. Use - to press several keys simultaneously. Example:
sendkey ctrl-alt-f1
This command is useful to send keys that your graphical user interface intercepts
at low level, such as ctrl-alt-f1 in X Window.
‘system_reset’
Reset the system.
‘usb_add devname’
Add the USB device devname. For details of available devices see Section 3.9.1
[usb devices], page 23
Chapter 3: QEMU PC System emulator 17
‘usb_del devname’
Remove the USB device devname from the QEMU virtual USB hub. devname
has the syntax bus.addr. Use the monitor command info usb to see the
devices you can remove.
3.6.3 VM snapshots
VM snapshots are snapshots of the complete virtual machine including CPU state, RAM,
device state and the content of all the writable disks. In order to use VM snapshots, you
must have at least one non removable and writable block device using the qcow2 disk image
format. Normally this device is the first virtual hard drive.
Use the monitor command savevm to create a new VM snapshot or replace an existing one.
A human readable name can be assigned to each snapshot in addition to its numerical ID.
Use loadvm to restore a VM snapshot and delvm to remove a VM snapshot. info snapshots
lists the available snapshots with their associated information:
(qemu) info snapshots
Snapshot devices: hda
Snapshot list (from hda):
ID TAG VM SIZE DATE VM CLOCK
1 start 41M 2006-08-06 12:38:02 00:00:14.954
2 40M 2006-08-06 12:43:29 00:00:18.633
3 msys 40M 2006-08-06 12:44:04 00:00:23.514
Chapter 3: QEMU PC System emulator 18
A VM snapshot is made of a VM state info (its size is shown in info snapshots) and a
snapshot of every writable disk image. The VM state info is stored in the first qcow2 non
removable and writable block device. The disk image snapshots are stored in every disk
image. The size of a snapshot in a disk image is difficult to evaluate and is not shown by
info snapshots because the associated disk sectors are shared among all the snapshots to
save disk space (otherwise each snapshot would need a full copy of all the disk images).
When using the (unrelated) -snapshot option (Section 3.6.2 [disk images snapshot mode],
page 17), you can always make VM snapshots, but they are deleted as soon as you exit
QEMU.
VM snapshots currently have the following known limitations:
• They cannot cope with removable devices if they are removed or inserted after a snap-
shot is done.
• A few device drivers still have incomplete snapshot support so their state is not saved
or restored properly (in particular USB).
cow User Mode Linux Copy On Write image format. Used to be the
only growable image format in QEMU. It is supported only for
compatibility with previous versions. It does not work on win32.
vmdk VMware 3 and 4 compatible image format.
cloop Linux Compressed Loop image, useful only to reuse directly com-
pressed CD-ROM images present for example in the Knoppix CD-
ROMs.
size is the disk image size in kilobytes. Optional suffixes M (megabyte) and G (giga-
byte) are supported
output filename
is the destination disk image filename
output fmt
is the destination format
-c indicates that target image must be compressed (qcow format only)
-e indicates that the target image must be encrypted (qcow format only)
-6 indicates that the target image must use compatibility level 6 (vmdk format
only)
Command description:
‘create [-6] [-e] [-b base_image ] [-f fmt ] filename [size ]’
Create the new disk image filename of size size and format fmt.
If base image is specified, then the image will record only the differences from
base image. No size needs to be specified in this case. base image will never
be modified unless you use the commit monitor command.
‘commit [-f fmt ] filename ’
Commit the changes recorded in filename in its base image.
‘convert [-c] [-e] [-f fmt ] filename [-O output_fmt ] output_filename ’
Convert the disk image filename to disk image output filename using format
output fmt. It can be optionally encrypted (-e option) or compressed (-c
option).
Only the format qcow supports encryption or compression. The compression is
read-only. It means that if a compressed sector is rewritten, then it is rewritten
as uncompressed data.
Encryption uses the AES format which is very secure (128 bit keys). Use a long
password (16 characters) to get maximum protection.
Image conversion is also useful to get smaller image when using a growable
format such as qcow or cow: the empty sectors are detected and suppressed
from the destination image.
‘info [-f fmt ] filename ’
Give information about the disk image filename. Use it in particular to know
the size reserved on disk which can be different from the displayed size. If VM
snapshots are stored in the disk image, they are displayed too.
Chapter 3: QEMU PC System emulator 20
3.6.5.1 Linux
On Linux, you can directly use the host device filename instead of a disk image filename
provided you have enough privileges to access it. For example, use ‘/dev/cdrom’ to access
to the CDROM or ‘/dev/fd0’ for the floppy.
CD You can specify a CDROM device even if no CDROM is loaded. QEMU has
specific code to detect CDROM insertion or removal. CDROM ejection by the
guest OS is supported. Currently only data CDs are supported.
Floppy You can specify a floppy device even if no floppy is loaded. Floppy removal is
currently not detected accurately (if you change floppy without doing floppy
access while the floppy is not loaded, the guest OS will think that the same
floppy is loaded).
Hard disks
Hard disks can be used. Normally you must specify the whole disk (‘/dev/hdb’
instead of ‘/dev/hdb1’) so that the guest OS can see it as a partitioned disk.
WARNING: unless you know what you do, it is better to only make READ-
ONLY accesses to the hard disk otherwise you may corrupt your host data
(use the ‘-snapshot’ command line option or modify the device permissions
accordingly).
3.6.5.2 Windows
CD The preferred syntax is the drive letter (e.g. ‘d:’). The alternate syntax
‘\\.\d:’ is supported. ‘/dev/cdrom’ is supported as an alias to the first
CDROM drive.
Currently there is no specific code to handle removable media, so it is better to
use the change or eject monitor commands to change or eject media.
Hard disks
Hard disks can be used with the syntax: ‘\\.\PhysicalDriveN’ where N is the
drive number (0 is the first hard disk).
WARNING: unless you know what you do, it is better to only make READ-
ONLY accesses to the hard disk otherwise you may corrupt your host data
(use the ‘-snapshot’ command line so that the modifications are written in a
temporary file).
3.6.5.3 Mac OS X
‘/dev/cdrom’ is an alias to the first CDROM.
Currently there is no specific code to handle removable media, so it is better to use the
change or eject monitor commands to change or eject media.
Chapter 3: QEMU PC System emulator 21
3.7.1 VLANs
QEMU simulates several VLANs. A VLAN can be symbolised as a virtual connection
between several network devices. These devices can be for example QEMU virtual Ethernet
cards or virtual Host ethernet devices (TAP devices).
--load-privkey ca-key.pem
--template ca.info \
--outfile ca-cert.pem
The ca-cert.pem file should be copied to all servers and clients wishing to utilize TLS
support in the VNC server. The ca-key.pem must not be disclosed/copied at all.
# certtool --generate-certificate \
--load-ca-certificate ca-cert.pem \
--load-ca-privkey ca-key.pem \
--load-privkey client-key.pem \
--template client.info \
--outfile client-cert.pem
The client-key.pem and client-cert.pem files should now be securely copied to the
client for which they were generated.
3.12.2 Windows
If you have a slow host, using Windows 95 is better as it gives the best speed. Windows
2000 is also a good choice.
− Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard and power/reset
logic
− ESP SCSI controller with hard disk and CD-ROM support
− Floppy drive
− CS4231 sound device (only on SS-5, not working yet)
The number of peripherals is fixed in the architecture.
Since version 0.8.2, QEMU uses OpenBIOS http://www.openbios.org/. OpenBIOS is a
free (GPL v2) portable firmware implementation. The goal is to implement a 100% IEEE
1275-1994 (referred to as Open Firmware) compliant firmware.
A sample Linux 2.6 series kernel and ram disk image are available on the QEMU web site.
Please note that currently NetBSD, OpenBSD or Solaris kernels don’t work.
The following options are specific to the Sparc32 emulation:
‘-g WxHx[xDEPTH]’
Set the initial TCX graphic mode. The default is 1024x768x8, currently the
only other possible mode is 1024x768x24.
‘-prom-env string’
Set OpenBIOS variables in NVRAM, for example:
qemu-system-sparc -prom-env ’auto-boot?=false’ \
-prom-env ’boot-device=sd(0,2,0):d’ -prom-env ’boot-args=linux single’
‘-M [SS-5|SS-10]’
Set the emulated machine type. Default is SS-5.
The ARM RealView Emulation baseboard is emulated with the following devices:
− ARM926E CPU
− ARM AMBA Generic/Distributed Interrupt Controller
− Four PL011 UARTs
− SMC 91c111 Ethernet adapter
− PL110 LCD controller
− PL050 KMI with PS/2 keyboard and mouse
− PCI host bridge
− PCI OHCI USB controller
− LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
− PL181 MultiMedia Card Interface with SD card.
The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi" and "Terrier") emu-
lation includes the following peripherals:
− Intel PXA270 System-on-chip (ARM V5TE core)
− NAND Flash memory
− IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
− On-chip OHCI USB controller
− On-chip LCD controller
− On-chip Real Time Clock
− TI ADS7846 touchscreen controller on SSP bus
− Maxim MAX1111 analog-digital converter on I2 C bus
− GPIO-connected keyboard controller and LEDs
− Secure Digital card connected to PXA MMC/SD host
− Three on-chip UARTs
− WM8750 audio CODEC on I2 C and I2 S busses
A Linux 2.6 test image is available on the QEMU web site. More information is available
in the QEMU mailing-list archive.
qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
/usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
• On ppc, you’ll have to tell qemu where your x86 libraries (and dynamic linker) are
installed:
qemu-i386 -L /opt/x86_root/ /bin/ls
-L /opt/x86_root/ tells that the dynamic linker (dyld) path is in
‘/opt/x86_root/usr/bin/dyld’.
6.1 Linux/Unix
6.1.1 Compilation
First you must decompress the sources:
cd /tmp
tar zxvf qemu-x.y.z.tar.gz
cd qemu-x.y.z
Then you configure QEMU and build it (usually no options are needed):
./configure
make
Then type as root user:
make install
to install QEMU in ‘/usr/local’.
6.2 Windows
• Install the current versions of MSYS and MinGW from http://www.mingw.org/. You
can find detailed installation instructions in the download section and the FAQ.
• Download the MinGW development library of SDL 1.2.x (‘SDL-devel-1.2.x-
mingw32.tar.gz’) from http://www.libsdl.org. Unpack it in a temporary place,
and unpack the archive ‘i386-mingw32msvc.tar.gz’ in the MinGW tool directory.
Edit the ‘sdl-config’ script so that it gives the correct SDL directory when invoked.
• Extract the current version of QEMU.
• Start the MSYS shell (file ‘msys.bat’).
• Change to the QEMU directory. Launch ‘./configure’ and ‘make’. If you have prob-
lems using SDL, verify that ‘sdl-config’ can be launched from the MSYS command
line.
• You can install QEMU in ‘Program Files/Qemu’ by typing ‘make install’. Don’t
forget to copy ‘SDL.dll’ in ‘Program Files/Qemu’.
6.4 Mac OS X
The Mac OS X patches are not fully merged in QEMU, so you should look at the QEMU
mailing list archive to have all the necessary information.
Chapter 7: Index 39
7 Index
(Index is nonexistent)