blob: 74d0edf057b4cd8951ecd9af4a9b055aae668f8f [file] [log] [blame]
bellard386405f2003-03-23 21:28:45 +00001\input texinfo @c -*- texinfo -*-
bellarddebc7062006-04-30 21:58:41 +00002@c %**start of header
3@setfilename qemu-doc.info
bellard8f40c382006-09-20 20:28:05 +00004@settitle QEMU Emulator User Documentation
bellarddebc7062006-04-30 21:58:41 +00005@exampleindent 0
6@paragraphindent 0
7@c %**end of header
bellard386405f2003-03-23 21:28:45 +00008
bellard0806e3f2003-10-01 00:15:32 +00009@iftex
bellard386405f2003-03-23 21:28:45 +000010@titlepage
11@sp 7
bellard8f40c382006-09-20 20:28:05 +000012@center @titlefont{QEMU Emulator}
bellarddebc7062006-04-30 21:58:41 +000013@sp 1
14@center @titlefont{User Documentation}
bellard386405f2003-03-23 21:28:45 +000015@sp 3
16@end titlepage
bellard0806e3f2003-10-01 00:15:32 +000017@end iftex
bellard386405f2003-03-23 21:28:45 +000018
bellarddebc7062006-04-30 21:58:41 +000019@ifnottex
20@node Top
21@top
22
23@menu
24* Introduction::
25* Installation::
26* QEMU PC System emulator::
27* QEMU System emulator for non PC targets::
bellard83195232007-02-05 19:42:07 +000028* QEMU User space emulator::
bellarddebc7062006-04-30 21:58:41 +000029* compilation:: Compilation from the sources
30* Index::
31@end menu
32@end ifnottex
33
34@contents
35
36@node Introduction
bellard386405f2003-03-23 21:28:45 +000037@chapter Introduction
38
bellarddebc7062006-04-30 21:58:41 +000039@menu
40* intro_features:: Features
41@end menu
42
43@node intro_features
bellard322d0c62003-06-15 23:29:28 +000044@section Features
bellard386405f2003-03-23 21:28:45 +000045
bellard1f673132004-04-04 15:21:17 +000046QEMU is a FAST! processor emulator using dynamic translation to
47achieve good emulation speed.
bellard1eb20522003-06-25 16:21:49 +000048
49QEMU has two operating modes:
bellard0806e3f2003-10-01 00:15:32 +000050
51@itemize @minus
52
53@item
bellard1f673132004-04-04 15:21:17 +000054Full system emulation. In this mode, QEMU emulates a full system (for
bellard3f9f3aa2005-12-18 20:11:37 +000055example a PC), including one or several processors and various
56peripherals. It can be used to launch different Operating Systems
57without rebooting the PC or to debug system code.
bellard1eb20522003-06-25 16:21:49 +000058
bellard0806e3f2003-10-01 00:15:32 +000059@item
bellard83195232007-02-05 19:42:07 +000060User mode emulation. In this mode, QEMU can launch
61processes compiled for one CPU on another CPU. It can be used to
bellard1f673132004-04-04 15:21:17 +000062launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
63to ease cross-compilation and cross-debugging.
bellard1eb20522003-06-25 16:21:49 +000064
65@end itemize
66
bellard7c3fc842005-02-10 21:46:47 +000067QEMU can run without an host kernel driver and yet gives acceptable
bellard6f2f2b22005-02-20 19:09:44 +000068performance.
bellard322d0c62003-06-15 23:29:28 +000069
bellard52c00a52004-04-25 21:27:03 +000070For system emulation, the following hardware targets are supported:
71@itemize
bellard9d0a8e62005-07-03 17:34:05 +000072@item PC (x86 or x86_64 processor)
bellard3f9f3aa2005-12-18 20:11:37 +000073@item ISA PC (old style PC without PCI bus)
bellard52c00a52004-04-25 21:27:03 +000074@item PREP (PowerPC processor)
bellard9d0a8e62005-07-03 17:34:05 +000075@item G3 BW PowerMac (PowerPC processor)
76@item Mac99 PowerMac (PowerPC processor, in progress)
bellard34751872005-07-02 14:31:34 +000077@item Sun4m (32-bit Sparc processor)
78@item Sun4u (64-bit Sparc processor, in progress)
bellard3f9f3aa2005-12-18 20:11:37 +000079@item Malta board (32-bit MIPS processor)
pbrooked96ca32006-02-20 00:35:00 +000080@item ARM Integrator/CP (ARM926E or 1026E processor)
pbrook00a9bf12006-05-13 16:55:46 +000081@item ARM Versatile baseboard (ARM926E)
pbrookd7739d72007-02-28 16:25:17 +000082@item ARM RealView Emulation baseboard (ARM926EJ-S)
bellard52c00a52004-04-25 21:27:03 +000083@end itemize
bellard386405f2003-03-23 21:28:45 +000084
pbrooke6e59062006-10-22 00:18:54 +000085For user emulation, x86, PowerPC, ARM, MIPS, Sparc32/64 and ColdFire(m68k) CPUs are supported.
bellard0806e3f2003-10-01 00:15:32 +000086
bellarddebc7062006-04-30 21:58:41 +000087@node Installation
bellard5b9f4572003-10-28 00:49:54 +000088@chapter Installation
89
bellard15a34c62004-07-08 21:26:26 +000090If you want to compile QEMU yourself, see @ref{compilation}.
91
bellarddebc7062006-04-30 21:58:41 +000092@menu
93* install_linux:: Linux
94* install_windows:: Windows
95* install_mac:: Macintosh
96@end menu
97
98@node install_linux
bellard1f673132004-04-04 15:21:17 +000099@section Linux
100
bellard7c3fc842005-02-10 21:46:47 +0000101If a precompiled package is available for your distribution - you just
102have to install it. Otherwise, see @ref{compilation}.
bellard5b9f4572003-10-28 00:49:54 +0000103
bellarddebc7062006-04-30 21:58:41 +0000104@node install_windows
bellard1f673132004-04-04 15:21:17 +0000105@section Windows
bellard8cd0ac22004-05-12 19:09:16 +0000106
bellard15a34c62004-07-08 21:26:26 +0000107Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000108@url{http://www.free.oszoo.org/@/download.html}.
bellardd691f662003-03-24 21:58:34 +0000109
bellarddebc7062006-04-30 21:58:41 +0000110@node install_mac
bellard1f673132004-04-04 15:21:17 +0000111@section Mac OS X
bellardd691f662003-03-24 21:58:34 +0000112
bellard15a34c62004-07-08 21:26:26 +0000113Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000114@url{http://www.free.oszoo.org/@/download.html}.
bellarddf0f11a2003-05-28 00:27:57 +0000115
bellarddebc7062006-04-30 21:58:41 +0000116@node QEMU PC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +0000117@chapter QEMU PC System emulator
bellard1eb20522003-06-25 16:21:49 +0000118
bellarddebc7062006-04-30 21:58:41 +0000119@menu
120* pcsys_introduction:: Introduction
121* pcsys_quickstart:: Quick Start
122* sec_invocation:: Invocation
123* pcsys_keys:: Keys
124* pcsys_monitor:: QEMU Monitor
125* disk_images:: Disk Images
126* pcsys_network:: Network emulation
127* direct_linux_boot:: Direct Linux Boot
128* pcsys_usb:: USB emulation
129* gdb_usage:: GDB usage
130* pcsys_os_specific:: Target OS specific information
131@end menu
132
133@node pcsys_introduction
bellard0806e3f2003-10-01 00:15:32 +0000134@section Introduction
135
136@c man begin DESCRIPTION
137
bellard3f9f3aa2005-12-18 20:11:37 +0000138The QEMU PC System emulator simulates the
139following peripherals:
bellard0806e3f2003-10-01 00:15:32 +0000140
141@itemize @minus
bellard15a34c62004-07-08 21:26:26 +0000142@item
143i440FX host PCI bridge and PIIX3 PCI to ISA bridge
bellard0806e3f2003-10-01 00:15:32 +0000144@item
bellard15a34c62004-07-08 21:26:26 +0000145Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
146extensions (hardware level, including all non standard modes).
bellard0806e3f2003-10-01 00:15:32 +0000147@item
148PS/2 mouse and keyboard
149@item
bellard15a34c62004-07-08 21:26:26 +00001502 PCI IDE interfaces with hard disk and CD-ROM support
bellard1f673132004-04-04 15:21:17 +0000151@item
152Floppy disk
bellard0806e3f2003-10-01 00:15:32 +0000153@item
bellard15a34c62004-07-08 21:26:26 +0000154NE2000 PCI network adapters
bellard0806e3f2003-10-01 00:15:32 +0000155@item
bellard05d58182004-08-24 21:12:04 +0000156Serial ports
157@item
bellardc0fe3822005-11-05 18:55:28 +0000158Creative SoundBlaster 16 sound card
159@item
160ENSONIQ AudioPCI ES1370 sound card
161@item
162Adlib(OPL2) - Yamaha YM3812 compatible chip
bellardb389dbf2005-11-06 16:49:55 +0000163@item
164PCI UHCI USB controller and a virtual USB hub.
bellard0806e3f2003-10-01 00:15:32 +0000165@end itemize
166
bellard3f9f3aa2005-12-18 20:11:37 +0000167SMP is supported with up to 255 CPUs.
168
bellardc0fe3822005-11-05 18:55:28 +0000169Note that adlib is only available when QEMU was configured with
170-enable-adlib
171
bellard15a34c62004-07-08 21:26:26 +0000172QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
173VGA BIOS.
174
bellardc0fe3822005-11-05 18:55:28 +0000175QEMU uses YM3812 emulation by Tatsuyuki Satoh.
176
bellard0806e3f2003-10-01 00:15:32 +0000177@c man end
178
bellarddebc7062006-04-30 21:58:41 +0000179@node pcsys_quickstart
bellard1eb20522003-06-25 16:21:49 +0000180@section Quick Start
181
bellard285dc332003-10-27 23:58:04 +0000182Download and uncompress the linux image (@file{linux.img}) and type:
bellard0806e3f2003-10-01 00:15:32 +0000183
184@example
bellard285dc332003-10-27 23:58:04 +0000185qemu linux.img
bellard0806e3f2003-10-01 00:15:32 +0000186@end example
187
188Linux should boot and give you a prompt.
189
bellard6cc721c2005-07-28 22:27:28 +0000190@node sec_invocation
bellard1f673132004-04-04 15:21:17 +0000191@section Invocation
192
193@example
194@c man begin SYNOPSIS
195usage: qemu [options] [disk_image]
196@c man end
197@end example
198
199@c man begin OPTIONS
200@var{disk_image} is a raw hard disk image for IDE hard disk 0.
201
202General options:
203@table @option
bellard3dbbdc22005-11-06 18:20:37 +0000204@item -M machine
205Select the emulated machine (@code{-M ?} for list)
206
bellard1f673132004-04-04 15:21:17 +0000207@item -fda file
208@item -fdb file
bellarddebc7062006-04-30 21:58:41 +0000209Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You can
bellard19cb3732006-08-19 11:45:59 +0000210use the host floppy by using @file{/dev/fd0} as filename (@pxref{host_drives}).
bellard1f673132004-04-04 15:21:17 +0000211
212@item -hda file
213@item -hdb file
214@item -hdc file
215@item -hdd file
bellarddebc7062006-04-30 21:58:41 +0000216Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
bellard1f673132004-04-04 15:21:17 +0000217
218@item -cdrom file
219Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
bellardbe3edd92004-06-03 12:48:45 +0000220@option{-cdrom} at the same time). You can use the host CD-ROM by
bellard19cb3732006-08-19 11:45:59 +0000221using @file{/dev/cdrom} as filename (@pxref{host_drives}).
bellard1f673132004-04-04 15:21:17 +0000222
thseec85c22007-01-05 17:41:07 +0000223@item -boot [a|c|d|n]
224Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot
225is the default.
bellard1f673132004-04-04 15:21:17 +0000226
227@item -snapshot
228Write to temporary files instead of disk image files. In this case,
229the raw disk image you use is not written back. You can however force
ths42550fd2006-12-22 16:34:12 +0000230the write back by pressing @key{C-a s} (@pxref{disk_images}).
bellard1f673132004-04-04 15:21:17 +0000231
bellard52ca8d62006-06-14 16:03:05 +0000232@item -no-fd-bootchk
233Disable boot signature checking for floppy disks in Bochs BIOS. It may
234be needed to boot from old floppy disks.
235
bellard1f673132004-04-04 15:21:17 +0000236@item -m megs
bellard15a34c62004-07-08 21:26:26 +0000237Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
bellard1f673132004-04-04 15:21:17 +0000238
bellard3f9f3aa2005-12-18 20:11:37 +0000239@item -smp n
240Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
241CPUs are supported.
242
bellard1f673132004-04-04 15:21:17 +0000243@item -nographic
244
245Normally, QEMU uses SDL to display the VGA output. With this option,
246you can totally disable graphical output so that QEMU is a simple
247command line application. The emulated serial port is redirected on
248the console. Therefore, you can still use QEMU to debug a Linux kernel
249with a serial console.
250
ths5f189492007-02-19 01:23:15 +0000251@item -no-frame
252
253Do not use decorations for SDL windows and start them using the whole
254available screen space. This makes the using QEMU in a dedicated desktop
255workspace more convenient.
256
ths73fc9742006-12-22 02:09:07 +0000257@item -vnc display
bellard24236862006-04-30 21:28:36 +0000258
259Normally, QEMU uses SDL to display the VGA output. With this option,
ths73fc9742006-12-22 02:09:07 +0000260you can have QEMU listen on VNC display @var{display} and redirect the VGA
bellard3c656342006-07-14 13:13:51 +0000261display over the VNC session. It is very useful to enable the usb
262tablet device when using this option (option @option{-usbdevice
263tablet}). When using the VNC display, you must use the @option{-k}
ths73fc9742006-12-22 02:09:07 +0000264option to set the keyboard layout if you are not using en-us.
265
266@var{display} may be in the form @var{interface:d}, in which case connections
267will only be allowed from @var{interface} on display @var{d}. Optionally,
268@var{interface} can be omitted. @var{display} can also be in the form
269@var{unix:path} where @var{path} is the location of a unix socket to listen for
270connections on.
271
bellard24236862006-04-30 21:28:36 +0000272
bellard3d11d0e2004-12-12 16:56:30 +0000273@item -k language
274
275Use keyboard layout @var{language} (for example @code{fr} for
276French). This option is only needed where it is not easy to get raw PC
bellard3c656342006-07-14 13:13:51 +0000277keycodes (e.g. on Macs, with some X11 servers or with a VNC
278display). You don't normally need to use it on PC/Linux or PC/Windows
279hosts.
bellard3d11d0e2004-12-12 16:56:30 +0000280
281The available layouts are:
282@example
283ar de-ch es fo fr-ca hu ja mk no pt-br sv
284da en-gb et fr fr-ch is lt nl pl ru th
285de en-us fi fr-be hr it lv nl-be pt sl tr
286@end example
287
288The default is @code{en-us}.
289
bellard1d14ffa2005-10-30 18:58:22 +0000290@item -audio-help
291
292Will show the audio subsystem help: list of drivers, tunable
293parameters.
294
bellard6a36d842005-12-18 20:34:32 +0000295@item -soundhw card1,card2,... or -soundhw all
bellard1d14ffa2005-10-30 18:58:22 +0000296
297Enable audio and selected sound hardware. Use ? to print all
298available sound hardware.
299
300@example
301qemu -soundhw sb16,adlib hda
302qemu -soundhw es1370 hda
bellard6a36d842005-12-18 20:34:32 +0000303qemu -soundhw all hda
bellard1d14ffa2005-10-30 18:58:22 +0000304qemu -soundhw ?
305@end example
bellarda8c490c2004-04-26 20:59:17 +0000306
bellard15a34c62004-07-08 21:26:26 +0000307@item -localtime
308Set the real time clock to local time (the default is to UTC
309time). This option is needed to have correct date in MS-DOS or
310Windows.
311
bellardd63d3072004-10-03 13:29:03 +0000312@item -full-screen
313Start in full screen.
314
bellardf7cce892004-12-08 22:21:25 +0000315@item -pidfile file
316Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
317from a script.
318
ths71e3ceb2006-12-22 02:11:31 +0000319@item -daemonize
320Daemonize the QEMU process after initialization. QEMU will not detach from
321standard IO until it is ready to receive connections on any of its devices.
322This option is a useful way for external programs to launch QEMU without having
323to cope with initialization race conditions.
324
bellard9d0a8e62005-07-03 17:34:05 +0000325@item -win2k-hack
326Use it when installing Windows 2000 to avoid a disk full bug. After
327Windows 2000 is installed, you no longer need this option (this option
328slows down the IDE transfers).
329
ths9ae02552007-01-05 17:39:04 +0000330@item -option-rom file
331Load the contents of file as an option ROM. This option is useful to load
332things like EtherBoot.
333
thsc35734b2007-03-19 15:17:08 +0000334@item -name string
335Sets the name of the guest. This name will be display in the SDL window
336caption. The name will also be used for the VNC server.
337
bellard1f673132004-04-04 15:21:17 +0000338@end table
339
bellardb389dbf2005-11-06 16:49:55 +0000340USB options:
341@table @option
342
343@item -usb
344Enable the USB driver (will be the default soon)
345
346@item -usbdevice devname
pbrook0aff66b2006-05-26 00:49:52 +0000347Add the USB device @var{devname}. @xref{usb_devices}.
bellardb389dbf2005-11-06 16:49:55 +0000348@end table
349
bellard1f673132004-04-04 15:21:17 +0000350Network options:
351
352@table @option
353
pbrooka41b2ff2006-02-05 04:14:41 +0000354@item -net nic[,vlan=n][,macaddr=addr][,model=type]
bellard41d03942005-11-15 23:02:53 +0000355Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
356= 0 is the default). The NIC is currently an NE2000 on the PC
357target. Optionally, the MAC address can be changed. If no
358@option{-net} option is specified, a single NIC is created.
pbrooka41b2ff2006-02-05 04:14:41 +0000359Qemu can emulate several different models of network card. Valid values for
360@var{type} are @code{ne2k_pci}, @code{ne2k_isa}, @code{rtl8139},
361@code{smc91c111} and @code{lance}. Not all devices are supported on all
362targets.
bellard1f673132004-04-04 15:21:17 +0000363
pbrook115defd2006-04-16 11:06:58 +0000364@item -net user[,vlan=n][,hostname=name]
bellard7e894632005-11-19 17:42:52 +0000365Use the user mode network stack which requires no administrator
pbrooka03a6052006-04-16 18:46:12 +0000366priviledge to run. @option{hostname=name} can be used to specify the client
pbrook115defd2006-04-16 11:06:58 +0000367hostname reported by the builtin DHCP server.
bellard3f1a88f2005-06-05 16:48:41 +0000368
bellard41d03942005-11-15 23:02:53 +0000369@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
370Connect the host TAP network interface @var{name} to VLAN @var{n} and
371use the network script @var{file} to configure it. The default
ths6a1cbf62007-02-02 00:37:56 +0000372network script is @file{/etc/qemu-ifup}. Use @option{script=no} to
373disable script execution. If @var{name} is not
bellard41d03942005-11-15 23:02:53 +0000374provided, the OS automatically provides one. @option{fd=h} can be
375used to specify the handle of an already opened host TAP interface. Example:
bellard3f1a88f2005-06-05 16:48:41 +0000376
bellard41d03942005-11-15 23:02:53 +0000377@example
378qemu linux.img -net nic -net tap
379@end example
bellard1f673132004-04-04 15:21:17 +0000380
bellard41d03942005-11-15 23:02:53 +0000381More complicated example (two NICs, each one connected to a TAP device)
382@example
383qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
384 -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
385@end example
bellard1f673132004-04-04 15:21:17 +0000386
bellard52c00a52004-04-25 21:27:03 +0000387
bellard41d03942005-11-15 23:02:53 +0000388@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]
389
390Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual
391machine using a TCP socket connection. If @option{listen} is
392specified, QEMU waits for incoming connections on @var{port}
393(@var{host} is optional). @option{connect} is used to connect to
bellard3d830452005-12-18 16:36:49 +0000394another QEMU instance using the @option{listen} option. @option{fd=h}
395specifies an already opened TCP socket.
bellard41d03942005-11-15 23:02:53 +0000396
397Example:
398@example
399# launch a first QEMU instance
bellarddebc7062006-04-30 21:58:41 +0000400qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
401 -net socket,listen=:1234
402# connect the VLAN 0 of this instance to the VLAN 0
403# of the first instance
404qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
405 -net socket,connect=127.0.0.1:1234
bellard41d03942005-11-15 23:02:53 +0000406@end example
407
bellard3d830452005-12-18 16:36:49 +0000408@item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]
409
410Create a VLAN @var{n} shared with another QEMU virtual
411machines using a UDP multicast socket, effectively making a bus for
412every QEMU with same multicast address @var{maddr} and @var{port}.
413NOTES:
414@enumerate
415@item
416Several QEMU can be running on different hosts and share same bus (assuming
417correct multicast setup for these hosts).
418@item
419mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
420@url{http://user-mode-linux.sf.net}.
421@item Use @option{fd=h} to specify an already opened UDP multicast socket.
422@end enumerate
423
424Example:
425@example
426# launch one QEMU instance
bellarddebc7062006-04-30 21:58:41 +0000427qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
428 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000429# launch another QEMU instance on same "bus"
bellarddebc7062006-04-30 21:58:41 +0000430qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
431 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000432# launch yet another QEMU instance on same "bus"
bellarddebc7062006-04-30 21:58:41 +0000433qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
434 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000435@end example
436
437Example (User Mode Linux compat.):
438@example
bellarddebc7062006-04-30 21:58:41 +0000439# launch QEMU instance (note mcast address selected
440# is UML's default)
441qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
442 -net socket,mcast=239.192.168.1:1102
bellard3d830452005-12-18 16:36:49 +0000443# launch UML
444/path/to/linux ubd0=/path/to/root_fs eth0=mcast
445@end example
446
bellard41d03942005-11-15 23:02:53 +0000447@item -net none
448Indicate that no network devices should be configured. It is used to
bellard039af322006-02-01 21:30:55 +0000449override the default configuration (@option{-net nic -net user}) which
450is activated if no @option{-net} options are provided.
bellard52c00a52004-04-25 21:27:03 +0000451
ths0db11372007-02-20 00:12:07 +0000452@item -tftp dir
bellard9bf05442004-08-25 22:12:49 +0000453When using the user mode network stack, activate a built-in TFTP
ths0db11372007-02-20 00:12:07 +0000454server. The files in @var{dir} will be exposed as the root of a TFTP server.
455The TFTP client on the guest must be configured in binary mode (use the command
456@code{bin} of the Unix TFTP client). The host IP address on the guest is as
457usual 10.0.2.2.
bellard9bf05442004-08-25 22:12:49 +0000458
ths47d5d012007-02-20 00:05:08 +0000459@item -bootp file
460When using the user mode network stack, broadcast @var{file} as the BOOTP
461filename. In conjunction with @option{-tftp}, this can be used to network boot
462a guest from a local directory.
463
464Example (using pxelinux):
465@example
466qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
467@end example
468
bellard2518bd02004-09-30 22:35:13 +0000469@item -smb dir
470When using the user mode network stack, activate a built-in SMB
471server so that Windows OSes can access to the host files in @file{dir}
472transparently.
473
474In the guest Windows OS, the line:
475@example
47610.0.2.4 smbserver
477@end example
478must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
479or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
480
481Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
482
483Note that a SAMBA server must be installed on the host OS in
ths366dfc52006-12-11 18:35:08 +0000484@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version
bellard6cc721c2005-07-28 22:27:28 +00004852.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
bellard2518bd02004-09-30 22:35:13 +0000486
bellard9bf05442004-08-25 22:12:49 +0000487@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
488
489When using the user mode network stack, redirect incoming TCP or UDP
490connections to the host port @var{host-port} to the guest
491@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
492is not specified, its value is 10.0.2.15 (default address given by the
493built-in DHCP server).
494
495For example, to redirect host X11 connection from screen 1 to guest
496screen 0, use the following:
497
498@example
499# on the host
500qemu -redir tcp:6001::6000 [...]
501# this host xterm should open in the guest X11 server
502xterm -display :1
503@end example
504
505To redirect telnet connections from host port 5555 to telnet port on
506the guest, use the following:
507
508@example
509# on the host
510qemu -redir tcp:5555::23 [...]
511telnet localhost 5555
512@end example
513
514Then when you use on the host @code{telnet localhost 5555}, you
515connect to the guest telnet server.
516
bellard1f673132004-04-04 15:21:17 +0000517@end table
518
bellard41d03942005-11-15 23:02:53 +0000519Linux boot specific: When using these options, you can use a given
bellard1f673132004-04-04 15:21:17 +0000520Linux kernel without installing it in the disk image. It can be useful
521for easier testing of various kernels.
522
523@table @option
524
525@item -kernel bzImage
526Use @var{bzImage} as kernel image.
527
528@item -append cmdline
529Use @var{cmdline} as kernel command line
530
531@item -initrd file
532Use @var{file} as initial ram disk.
533
534@end table
535
bellard15a34c62004-07-08 21:26:26 +0000536Debug/Expert options:
bellard1f673132004-04-04 15:21:17 +0000537@table @option
bellarda0a821a2004-07-14 17:38:57 +0000538
539@item -serial dev
bellard0bab00f2006-06-25 14:49:44 +0000540Redirect the virtual serial port to host character device
541@var{dev}. The default device is @code{vc} in graphical mode and
542@code{stdio} in non graphical mode.
543
544This option can be used several times to simulate up to 4 serials
545ports.
546
bellardc03b0f02006-09-03 14:10:53 +0000547Use @code{-serial none} to disable all serial ports.
548
bellard0bab00f2006-06-25 14:49:44 +0000549Available character devices are:
bellarda0a821a2004-07-14 17:38:57 +0000550@table @code
551@item vc
552Virtual console
553@item pty
554[Linux only] Pseudo TTY (a new PTY is automatically allocated)
bellardc03b0f02006-09-03 14:10:53 +0000555@item none
556No device is allocated.
bellarda0a821a2004-07-14 17:38:57 +0000557@item null
558void device
bellardf8d179e2005-11-08 22:30:36 +0000559@item /dev/XXX
bellarde57a8c02005-11-10 23:58:52 +0000560[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
bellardf8d179e2005-11-08 22:30:36 +0000561parameters are set according to the emulated ones.
bellarde57a8c02005-11-10 23:58:52 +0000562@item /dev/parportN
563[Linux only, parallel port only] Use host parallel port
ths5867c882007-02-17 23:44:43 +0000564@var{N}. Currently SPP and EPP parallel port features can be used.
bellardf8d179e2005-11-08 22:30:36 +0000565@item file:filename
566Write output to filename. No character can be read.
bellarda0a821a2004-07-14 17:38:57 +0000567@item stdio
568[Unix only] standard input/output
bellardf8d179e2005-11-08 22:30:36 +0000569@item pipe:filename
bellard0bab00f2006-06-25 14:49:44 +0000570name pipe @var{filename}
571@item COMn
572[Windows only] Use host serial port @var{n}
bellard951f1352006-06-27 21:02:43 +0000573@item udp:[remote_host]:remote_port[@@[src_ip]:src_port]
574This implements UDP Net Console. When @var{remote_host} or @var{src_ip} are not specified they default to @code{0.0.0.0}. When not using a specifed @var{src_port} a random port is automatically chosen.
bellarda0a821a2004-07-14 17:38:57 +0000575
bellard951f1352006-06-27 21:02:43 +0000576If you just want a simple readonly console you can use @code{netcat} or
577@code{nc}, by starting qemu with: @code{-serial udp::4555} and nc as:
578@code{nc -u -l -p 4555}. Any time qemu writes something to that port it
579will appear in the netconsole session.
bellard0bab00f2006-06-25 14:49:44 +0000580
581If you plan to send characters back via netconsole or you want to stop
582and start qemu a lot of times, you should have qemu use the same
583source port each time by using something like @code{-serial
bellard951f1352006-06-27 21:02:43 +0000584udp::4555@@:4556} to qemu. Another approach is to use a patched
bellard0bab00f2006-06-25 14:49:44 +0000585version of netcat which can listen to a TCP port and send and receive
586characters via udp. If you have a patched version of netcat which
587activates telnet remote echo and single char transfer, then you can
588use the following options to step up a netcat redirector to allow
589telnet on port 5555 to access the qemu port.
590@table @code
bellard951f1352006-06-27 21:02:43 +0000591@item Qemu Options:
592-serial udp::4555@@:4556
593@item netcat options:
594-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
595@item telnet options:
596localhost 5555
bellard0bab00f2006-06-25 14:49:44 +0000597@end table
598
599
pbrookf7499982007-01-28 00:10:01 +0000600@item tcp:[host]:port[,server][,nowait][,nodelay]
bellard951f1352006-06-27 21:02:43 +0000601The TCP Net Console has two modes of operation. It can send the serial
602I/O to a location or wait for a connection from a location. By default
603the TCP Net Console is sent to @var{host} at the @var{port}. If you use
bellardf5420862006-08-21 20:26:44 +0000604the @var{server} option QEMU will wait for a client socket application
605to connect to the port before continuing, unless the @code{nowait}
pbrookf7499982007-01-28 00:10:01 +0000606option was specified. The @code{nodelay} option disables the Nagle buffering
607algoritm. If @var{host} is omitted, 0.0.0.0 is assumed. Only
bellard951f1352006-06-27 21:02:43 +0000608one TCP connection at a time is accepted. You can use @code{telnet} to
609connect to the corresponding character device.
610@table @code
611@item Example to send tcp console to 192.168.0.2 port 4444
612-serial tcp:192.168.0.2:4444
613@item Example to listen and wait on port 4444 for connection
614-serial tcp::4444,server
615@item Example to not wait and listen on ip 192.168.0.100 port 4444
616-serial tcp:192.168.0.100:4444,server,nowait
617@end table
618
pbrookf7499982007-01-28 00:10:01 +0000619@item telnet:host:port[,server][,nowait][,nodelay]
bellard951f1352006-06-27 21:02:43 +0000620The telnet protocol is used instead of raw tcp sockets. The options
621work the same as if you had specified @code{-serial tcp}. The
622difference is that the port acts like a telnet server or client using
623telnet option negotiation. This will also allow you to send the
624MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
625sequence. Typically in unix telnet you do it with Control-] and then
626type "send break" followed by pressing the enter key.
627
thsffd843b2006-12-21 19:46:43 +0000628@item unix:path[,server][,nowait]
629A unix domain socket is used instead of a tcp socket. The option works the
630same as if you had specified @code{-serial tcp} except the unix domain socket
631@var{path} is used for connections.
632
ths20d8a3e2007-02-18 17:04:49 +0000633@item mon:dev_string
634This is a special option to allow the monitor to be multiplexed onto
635another serial port. The monitor is accessed with key sequence of
636@key{Control-a} and then pressing @key{c}. See monitor access
637@ref{pcsys_keys} in the -nographic section for more keys.
638@var{dev_string} should be any one of the serial devices specified
639above. An example to multiplex the monitor onto a telnet server
640listening on port 4444 would be:
641@table @code
642@item -serial mon:telnet::4444,server,nowait
643@end table
644
bellard0bab00f2006-06-25 14:49:44 +0000645@end table
bellard05d58182004-08-24 21:12:04 +0000646
bellarde57a8c02005-11-10 23:58:52 +0000647@item -parallel dev
648Redirect the virtual parallel port to host device @var{dev} (same
649devices as the serial port). On Linux hosts, @file{/dev/parportN} can
650be used to use hardware devices connected on the corresponding host
651parallel port.
652
653This option can be used several times to simulate up to 3 parallel
654ports.
655
bellardc03b0f02006-09-03 14:10:53 +0000656Use @code{-parallel none} to disable all parallel ports.
657
bellarda0a821a2004-07-14 17:38:57 +0000658@item -monitor dev
659Redirect the monitor to host device @var{dev} (same devices as the
660serial port).
661The default device is @code{vc} in graphical mode and @code{stdio} in
662non graphical mode.
663
ths20d8a3e2007-02-18 17:04:49 +0000664@item -echr numeric_ascii_value
665Change the escape character used for switching to the monitor when using
666monitor and serial sharing. The default is @code{0x01} when using the
667@code{-nographic} option. @code{0x01} is equal to pressing
668@code{Control-a}. You can select a different character from the ascii
669control keys where 1 through 26 map to Control-a through Control-z. For
670instance you could use the either of the following to change the escape
671character to Control-t.
672@table @code
673@item -echr 0x14
674@item -echr 20
675@end table
676
bellard1f673132004-04-04 15:21:17 +0000677@item -s
bellarddebc7062006-04-30 21:58:41 +0000678Wait gdb connection to port 1234 (@pxref{gdb_usage}).
bellard1f673132004-04-04 15:21:17 +0000679@item -p port
pbrook4046d912007-01-28 01:53:16 +0000680Change gdb connection port. @var{port} can be either a decimal number
681to specify a TCP port, or a host device (same devices as the serial port).
bellard52c00a52004-04-25 21:27:03 +0000682@item -S
683Do not start CPU at startup (you must type 'c' in the monitor).
bellard1f673132004-04-04 15:21:17 +0000684@item -d
685Output log in /tmp/qemu.log
bellard46d47672004-11-16 01:45:27 +0000686@item -hdachs c,h,s,[,t]
687Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
688@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
689translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
690all thoses parameters. This option is useful for old MS-DOS disk
691images.
bellard7c3fc842005-02-10 21:46:47 +0000692
bellard87b47352006-08-17 17:22:54 +0000693@item -L path
694Set the directory for the BIOS, VGA BIOS and keymaps.
695
bellard15a34c62004-07-08 21:26:26 +0000696@item -std-vga
697Simulate a standard VGA card with Bochs VBE extensions (default is
bellard3cb08532006-06-21 21:19:50 +0000698Cirrus Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0
699VBE extensions (e.g. Windows XP) and if you want to use high
700resolution modes (>= 1280x1024x16) then you should use this option.
701
bellard3c656342006-07-14 13:13:51 +0000702@item -no-acpi
703Disable ACPI (Advanced Configuration and Power Interface) support. Use
704it if your guest OS complains about ACPI problems (PC target machine
705only).
706
bellardd1beab82006-10-02 19:44:22 +0000707@item -no-reboot
708Exit instead of rebooting.
709
bellardd63d3072004-10-03 13:29:03 +0000710@item -loadvm file
711Start right away with a saved state (@code{loadvm} in monitor)
pbrook8e716212007-01-20 17:12:09 +0000712
713@item -semihosting
714Enable "Angel" semihosting interface (ARM target machines only).
715Note that this allows guest direct access to the host filesystem,
716so should only be used with trusted guest OS.
bellard1f673132004-04-04 15:21:17 +0000717@end table
718
bellard3e11db92004-07-14 17:47:14 +0000719@c man end
720
bellarddebc7062006-04-30 21:58:41 +0000721@node pcsys_keys
bellard3e11db92004-07-14 17:47:14 +0000722@section Keys
723
724@c man begin OPTIONS
725
bellarda1b74fe2004-05-08 13:26:35 +0000726During the graphical emulation, you can use the following keys:
727@table @key
bellardf9859312004-10-03 14:33:10 +0000728@item Ctrl-Alt-f
bellarda1b74fe2004-05-08 13:26:35 +0000729Toggle full screen
bellarda0a821a2004-07-14 17:38:57 +0000730
bellardf9859312004-10-03 14:33:10 +0000731@item Ctrl-Alt-n
bellarda0a821a2004-07-14 17:38:57 +0000732Switch to virtual console 'n'. Standard console mappings are:
733@table @emph
734@item 1
735Target system display
736@item 2
737Monitor
738@item 3
739Serial port
bellarda1b74fe2004-05-08 13:26:35 +0000740@end table
741
bellardf9859312004-10-03 14:33:10 +0000742@item Ctrl-Alt
bellarda0a821a2004-07-14 17:38:57 +0000743Toggle mouse and keyboard grab.
744@end table
745
bellard3e11db92004-07-14 17:47:14 +0000746In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
747@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
748
bellarda0a821a2004-07-14 17:38:57 +0000749During emulation, if you are using the @option{-nographic} option, use
750@key{Ctrl-a h} to get terminal commands:
bellard1f673132004-04-04 15:21:17 +0000751
752@table @key
bellarda1b74fe2004-05-08 13:26:35 +0000753@item Ctrl-a h
bellard1f673132004-04-04 15:21:17 +0000754Print this help
bellarda1b74fe2004-05-08 13:26:35 +0000755@item Ctrl-a x
ths366dfc52006-12-11 18:35:08 +0000756Exit emulator
bellarda1b74fe2004-05-08 13:26:35 +0000757@item Ctrl-a s
bellard1f673132004-04-04 15:21:17 +0000758Save disk data back to file (if -snapshot)
ths20d8a3e2007-02-18 17:04:49 +0000759@item Ctrl-a t
760toggle console timestamps
bellarda1b74fe2004-05-08 13:26:35 +0000761@item Ctrl-a b
bellard1f673132004-04-04 15:21:17 +0000762Send break (magic sysrq in Linux)
bellarda1b74fe2004-05-08 13:26:35 +0000763@item Ctrl-a c
bellard1f673132004-04-04 15:21:17 +0000764Switch between console and monitor
bellarda1b74fe2004-05-08 13:26:35 +0000765@item Ctrl-a Ctrl-a
766Send Ctrl-a
bellard1f673132004-04-04 15:21:17 +0000767@end table
768@c man end
769
770@ignore
771
bellard1f673132004-04-04 15:21:17 +0000772@c man begin SEEALSO
773The HTML documentation of QEMU for more precise information and Linux
774user mode emulator invocation.
775@c man end
776
777@c man begin AUTHOR
778Fabrice Bellard
779@c man end
780
781@end ignore
782
bellarddebc7062006-04-30 21:58:41 +0000783@node pcsys_monitor
bellard1f673132004-04-04 15:21:17 +0000784@section QEMU Monitor
785
786The QEMU monitor is used to give complex commands to the QEMU
787emulator. You can use it to:
788
789@itemize @minus
790
791@item
792Remove or insert removable medias images
793(such as CD-ROM or floppies)
794
795@item
796Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
797from a disk file.
798
799@item Inspect the VM state without an external debugger.
800
801@end itemize
802
803@subsection Commands
804
805The following commands are available:
806
807@table @option
808
809@item help or ? [cmd]
810Show the help for all commands or just for command @var{cmd}.
811
812@item commit
813Commit changes to the disk images (if -snapshot is used)
814
815@item info subcommand
816show various information about the system state
817
818@table @option
819@item info network
bellard41d03942005-11-15 23:02:53 +0000820show the various VLANs and the associated devices
bellard1f673132004-04-04 15:21:17 +0000821@item info block
822show the block devices
823@item info registers
824show the cpu registers
825@item info history
826show the command line history
bellardb389dbf2005-11-06 16:49:55 +0000827@item info pci
828show emulated PCI device
829@item info usb
830show USB devices plugged on the virtual USB hub
831@item info usbhost
832show all USB host devices
bellarda3c25992006-07-18 21:09:59 +0000833@item info capture
834show information about active capturing
bellard13a2e802006-08-06 14:50:31 +0000835@item info snapshots
836show list of VM snapshots
ths455204e2007-01-05 16:42:13 +0000837@item info mice
838show which guest mouse is receiving events
bellard1f673132004-04-04 15:21:17 +0000839@end table
840
841@item q or quit
842Quit the emulator.
843
844@item eject [-f] device
845Eject a removable media (use -f to force it).
846
847@item change device filename
848Change a removable media.
849
850@item screendump filename
851Save screen into PPM image @var{filename}.
852
ths455204e2007-01-05 16:42:13 +0000853@item mouse_move dx dy [dz]
854Move the active mouse to the specified coordinates @var{dx} @var{dy}
855with optional scroll axis @var{dz}.
856
857@item mouse_button val
858Change the active mouse button state @var{val} (1=L, 2=M, 4=R).
859
860@item mouse_set index
861Set which mouse device receives events at given @var{index}, index
862can be obtained with
863@example
864info mice
865@end example
866
bellarda3c25992006-07-18 21:09:59 +0000867@item wavcapture filename [frequency [bits [channels]]]
868Capture audio into @var{filename}. Using sample rate @var{frequency}
869bits per sample @var{bits} and number of channels @var{channels}.
870
871Defaults:
872@itemize @minus
873@item Sample rate = 44100 Hz - CD quality
874@item Bits = 16
875@item Number of channels = 2 - Stereo
876@end itemize
877
878@item stopcapture index
879Stop capture with a given @var{index}, index can be obtained with
880@example
881info capture
882@end example
883
bellard1f673132004-04-04 15:21:17 +0000884@item log item1[,...]
885Activate logging of the specified items to @file{/tmp/qemu.log}.
886
bellard13a2e802006-08-06 14:50:31 +0000887@item savevm [tag|id]
888Create a snapshot of the whole virtual machine. If @var{tag} is
889provided, it is used as human readable identifier. If there is already
890a snapshot with the same tag or ID, it is replaced. More info at
891@ref{vm_snapshots}.
bellard1f673132004-04-04 15:21:17 +0000892
bellard13a2e802006-08-06 14:50:31 +0000893@item loadvm tag|id
894Set the whole virtual machine to the snapshot identified by the tag
895@var{tag} or the unique snapshot ID @var{id}.
896
897@item delvm tag|id
898Delete the snapshot identified by @var{tag} or @var{id}.
bellard1f673132004-04-04 15:21:17 +0000899
900@item stop
901Stop emulation.
902
903@item c or cont
904Resume emulation.
905
906@item gdbserver [port]
907Start gdbserver session (default port=1234)
908
909@item x/fmt addr
910Virtual memory dump starting at @var{addr}.
911
912@item xp /fmt addr
913Physical memory dump starting at @var{addr}.
914
915@var{fmt} is a format which tells the command how to format the
916data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
917
918@table @var
919@item count
920is the number of items to be dumped.
921
922@item format
923can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
924c (char) or i (asm instruction).
925
926@item size
bellard52c00a52004-04-25 21:27:03 +0000927can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
928@code{h} or @code{w} can be specified with the @code{i} format to
929respectively select 16 or 32 bit code instruction size.
bellard1f673132004-04-04 15:21:17 +0000930
931@end table
932
933Examples:
934@itemize
935@item
936Dump 10 instructions at the current instruction pointer:
937@example
938(qemu) x/10i $eip
9390x90107063: ret
9400x90107064: sti
9410x90107065: lea 0x0(%esi,1),%esi
9420x90107069: lea 0x0(%edi,1),%edi
9430x90107070: ret
9440x90107071: jmp 0x90107080
9450x90107073: nop
9460x90107074: nop
9470x90107075: nop
9480x90107076: nop
949@end example
950
951@item
952Dump 80 16 bit values at the start of the video memory.
bellarddebc7062006-04-30 21:58:41 +0000953@smallexample
bellard1f673132004-04-04 15:21:17 +0000954(qemu) xp/80hx 0xb8000
9550x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
9560x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
9570x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
9580x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
9590x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
9600x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
9610x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9620x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9630x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9640x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
bellarddebc7062006-04-30 21:58:41 +0000965@end smallexample
bellard1f673132004-04-04 15:21:17 +0000966@end itemize
967
968@item p or print/fmt expr
969
970Print expression value. Only the @var{format} part of @var{fmt} is
971used.
972
bellarda3a91a32004-06-04 11:06:21 +0000973@item sendkey keys
974
975Send @var{keys} to the emulator. Use @code{-} to press several keys
976simultaneously. Example:
977@example
978sendkey ctrl-alt-f1
979@end example
980
981This command is useful to send keys that your graphical user interface
982intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
983
bellard15a34c62004-07-08 21:26:26 +0000984@item system_reset
985
986Reset the system.
987
bellardb389dbf2005-11-06 16:49:55 +0000988@item usb_add devname
989
pbrook0aff66b2006-05-26 00:49:52 +0000990Add the USB device @var{devname}. For details of available devices see
991@ref{usb_devices}
bellardb389dbf2005-11-06 16:49:55 +0000992
993@item usb_del devname
994
995Remove the USB device @var{devname} from the QEMU virtual USB
996hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
997command @code{info usb} to see the devices you can remove.
998
bellard1f673132004-04-04 15:21:17 +0000999@end table
1000
1001@subsection Integer expressions
1002
1003The monitor understands integers expressions for every integer
1004argument. You can use register names to get the value of specifics
1005CPU registers by prefixing them with @emph{$}.
1006
1007@node disk_images
1008@section Disk Images
1009
bellardacd935e2004-11-15 22:57:26 +00001010Since version 0.6.1, QEMU supports many disk image formats, including
1011growable disk images (their size increase as non empty sectors are
bellard13a2e802006-08-06 14:50:31 +00001012written), compressed and encrypted disk images. Version 0.8.3 added
1013the new qcow2 disk image format which is essential to support VM
1014snapshots.
bellard1f673132004-04-04 15:21:17 +00001015
bellarddebc7062006-04-30 21:58:41 +00001016@menu
1017* disk_images_quickstart:: Quick start for disk image creation
1018* disk_images_snapshot_mode:: Snapshot mode
bellard13a2e802006-08-06 14:50:31 +00001019* vm_snapshots:: VM snapshots
bellarddebc7062006-04-30 21:58:41 +00001020* qemu_img_invocation:: qemu-img Invocation
bellard19cb3732006-08-19 11:45:59 +00001021* host_drives:: Using host drives
bellarddebc7062006-04-30 21:58:41 +00001022* disk_images_fat_images:: Virtual FAT disk images
1023@end menu
1024
1025@node disk_images_quickstart
bellardacd935e2004-11-15 22:57:26 +00001026@subsection Quick start for disk image creation
1027
1028You can create a disk image with the command:
bellard1f673132004-04-04 15:21:17 +00001029@example
bellardacd935e2004-11-15 22:57:26 +00001030qemu-img create myimage.img mysize
bellard1f673132004-04-04 15:21:17 +00001031@end example
bellardacd935e2004-11-15 22:57:26 +00001032where @var{myimage.img} is the disk image filename and @var{mysize} is its
1033size in kilobytes. You can add an @code{M} suffix to give the size in
1034megabytes and a @code{G} suffix for gigabytes.
1035
bellarddebc7062006-04-30 21:58:41 +00001036See @ref{qemu_img_invocation} for more information.
bellard1f673132004-04-04 15:21:17 +00001037
bellarddebc7062006-04-30 21:58:41 +00001038@node disk_images_snapshot_mode
bellard1f673132004-04-04 15:21:17 +00001039@subsection Snapshot mode
1040
1041If you use the option @option{-snapshot}, all disk images are
1042considered as read only. When sectors in written, they are written in
1043a temporary file created in @file{/tmp}. You can however force the
bellardacd935e2004-11-15 22:57:26 +00001044write back to the raw disk images by using the @code{commit} monitor
1045command (or @key{C-a s} in the serial console).
bellard1f673132004-04-04 15:21:17 +00001046
bellard13a2e802006-08-06 14:50:31 +00001047@node vm_snapshots
1048@subsection VM snapshots
1049
1050VM snapshots are snapshots of the complete virtual machine including
1051CPU state, RAM, device state and the content of all the writable
1052disks. In order to use VM snapshots, you must have at least one non
1053removable and writable block device using the @code{qcow2} disk image
1054format. Normally this device is the first virtual hard drive.
1055
1056Use the monitor command @code{savevm} to create a new VM snapshot or
1057replace an existing one. A human readable name can be assigned to each
bellard19d36792006-08-07 21:34:34 +00001058snapshot in addition to its numerical ID.
bellard13a2e802006-08-06 14:50:31 +00001059
1060Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
1061a VM snapshot. @code{info snapshots} lists the available snapshots
1062with their associated information:
1063
1064@example
1065(qemu) info snapshots
1066Snapshot devices: hda
1067Snapshot list (from hda):
1068ID TAG VM SIZE DATE VM CLOCK
10691 start 41M 2006-08-06 12:38:02 00:00:14.954
10702 40M 2006-08-06 12:43:29 00:00:18.633
10713 msys 40M 2006-08-06 12:44:04 00:00:23.514
1072@end example
1073
1074A VM snapshot is made of a VM state info (its size is shown in
1075@code{info snapshots}) and a snapshot of every writable disk image.
1076The VM state info is stored in the first @code{qcow2} non removable
1077and writable block device. The disk image snapshots are stored in
1078every disk image. The size of a snapshot in a disk image is difficult
1079to evaluate and is not shown by @code{info snapshots} because the
1080associated disk sectors are shared among all the snapshots to save
bellard19d36792006-08-07 21:34:34 +00001081disk space (otherwise each snapshot would need a full copy of all the
1082disk images).
bellard13a2e802006-08-06 14:50:31 +00001083
1084When using the (unrelated) @code{-snapshot} option
1085(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
1086but they are deleted as soon as you exit QEMU.
1087
1088VM snapshots currently have the following known limitations:
1089@itemize
1090@item
1091They cannot cope with removable devices if they are removed or
1092inserted after a snapshot is done.
1093@item
1094A few device drivers still have incomplete snapshot support so their
1095state is not saved or restored properly (in particular USB).
1096@end itemize
1097
bellardacd935e2004-11-15 22:57:26 +00001098@node qemu_img_invocation
1099@subsection @code{qemu-img} Invocation
bellard1f673132004-04-04 15:21:17 +00001100
bellardacd935e2004-11-15 22:57:26 +00001101@include qemu-img.texi
bellard05efe462004-06-16 20:34:33 +00001102
bellard19cb3732006-08-19 11:45:59 +00001103@node host_drives
1104@subsection Using host drives
1105
1106In addition to disk image files, QEMU can directly access host
1107devices. We describe here the usage for QEMU version >= 0.8.3.
1108
1109@subsubsection Linux
1110
1111On Linux, you can directly use the host device filename instead of a
1112disk image filename provided you have enough proviledge to access
1113it. For example, use @file{/dev/cdrom} to access to the CDROM or
1114@file{/dev/fd0} for the floppy.
1115
bellardf5420862006-08-21 20:26:44 +00001116@table @code
bellard19cb3732006-08-19 11:45:59 +00001117@item CD
1118You can specify a CDROM device even if no CDROM is loaded. QEMU has
1119specific code to detect CDROM insertion or removal. CDROM ejection by
1120the guest OS is supported. Currently only data CDs are supported.
1121@item Floppy
1122You can specify a floppy device even if no floppy is loaded. Floppy
1123removal is currently not detected accurately (if you change floppy
1124without doing floppy access while the floppy is not loaded, the guest
1125OS will think that the same floppy is loaded).
1126@item Hard disks
1127Hard disks can be used. Normally you must specify the whole disk
1128(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
1129see it as a partitioned disk. WARNING: unless you know what you do, it
1130is better to only make READ-ONLY accesses to the hard disk otherwise
1131you may corrupt your host data (use the @option{-snapshot} command
1132line option or modify the device permissions accordingly).
1133@end table
1134
1135@subsubsection Windows
1136
bellard01781962007-01-07 22:43:30 +00001137@table @code
1138@item CD
1139The prefered syntax is the drive letter (e.g. @file{d:}). The
1140alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
1141supported as an alias to the first CDROM drive.
bellard19cb3732006-08-19 11:45:59 +00001142
1143Currently there is no specific code to handle removable medias, so it
1144is better to use the @code{change} or @code{eject} monitor commands to
1145change or eject media.
bellard01781962007-01-07 22:43:30 +00001146@item Hard disks
1147Hard disks can be used with the syntax: @file{\\.\PhysicalDriveN}
1148where @var{N} is the drive number (0 is the first hard disk).
1149
1150WARNING: unless you know what you do, it is better to only make
1151READ-ONLY accesses to the hard disk otherwise you may corrupt your
1152host data (use the @option{-snapshot} command line so that the
1153modifications are written in a temporary file).
1154@end table
1155
bellard19cb3732006-08-19 11:45:59 +00001156
1157@subsubsection Mac OS X
1158
1159@file{/dev/cdrom} is an alias to the first CDROM.
1160
1161Currently there is no specific code to handle removable medias, so it
1162is better to use the @code{change} or @code{eject} monitor commands to
1163change or eject media.
1164
bellarddebc7062006-04-30 21:58:41 +00001165@node disk_images_fat_images
bellard2c6cadd2005-12-18 18:31:45 +00001166@subsection Virtual FAT disk images
1167
1168QEMU can automatically create a virtual FAT disk image from a
1169directory tree. In order to use it, just type:
1170
1171@example
1172qemu linux.img -hdb fat:/my_directory
1173@end example
1174
1175Then you access access to all the files in the @file{/my_directory}
1176directory without having to copy them in a disk image or to export
1177them via SAMBA or NFS. The default access is @emph{read-only}.
1178
1179Floppies can be emulated with the @code{:floppy:} option:
1180
1181@example
1182qemu linux.img -fda fat:floppy:/my_directory
1183@end example
1184
1185A read/write support is available for testing (beta stage) with the
1186@code{:rw:} option:
1187
1188@example
1189qemu linux.img -fda fat:floppy:rw:/my_directory
1190@end example
1191
1192What you should @emph{never} do:
1193@itemize
1194@item use non-ASCII filenames ;
1195@item use "-snapshot" together with ":rw:" ;
bellard85b2c682005-12-19 22:12:34 +00001196@item expect it to work when loadvm'ing ;
1197@item write to the FAT directory on the host system while accessing it with the guest system.
bellard2c6cadd2005-12-18 18:31:45 +00001198@end itemize
1199
bellarddebc7062006-04-30 21:58:41 +00001200@node pcsys_network
bellard9d4fb822004-04-26 20:55:38 +00001201@section Network emulation
1202
bellard41d03942005-11-15 23:02:53 +00001203QEMU can simulate several networks cards (NE2000 boards on the PC
1204target) and can connect them to an arbitrary number of Virtual Local
1205Area Networks (VLANs). Host TAP devices can be connected to any QEMU
1206VLAN. VLAN can be connected between separate instances of QEMU to
1207simulate large networks. For simpler usage, a non priviledged user mode
1208network stack can replace the TAP device to have a basic network
1209connection.
bellard9d4fb822004-04-26 20:55:38 +00001210
bellard41d03942005-11-15 23:02:53 +00001211@subsection VLANs
bellard9d4fb822004-04-26 20:55:38 +00001212
bellard41d03942005-11-15 23:02:53 +00001213QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
1214connection between several network devices. These devices can be for
1215example QEMU virtual Ethernet cards or virtual Host ethernet devices
1216(TAP devices).
1217
1218@subsection Using TAP network interfaces
1219
1220This is the standard way to connect QEMU to a real network. QEMU adds
1221a virtual network device on your host (called @code{tapN}), and you
1222can then configure it as if it was a real ethernet card.
bellard9d4fb822004-04-26 20:55:38 +00001223
bellard8f40c382006-09-20 20:28:05 +00001224@subsubsection Linux host
1225
bellard9d4fb822004-04-26 20:55:38 +00001226As an example, you can download the @file{linux-test-xxx.tar.gz}
1227archive and copy the script @file{qemu-ifup} in @file{/etc} and
1228configure properly @code{sudo} so that the command @code{ifconfig}
1229contained in @file{qemu-ifup} can be executed as root. You must verify
bellard41d03942005-11-15 23:02:53 +00001230that your host kernel supports the TAP network interfaces: the
bellard9d4fb822004-04-26 20:55:38 +00001231device @file{/dev/net/tun} must be present.
1232
bellardee0f4752006-08-19 16:56:18 +00001233See @ref{sec_invocation} to have examples of command lines using the
1234TAP network interfaces.
bellard9d4fb822004-04-26 20:55:38 +00001235
bellard8f40c382006-09-20 20:28:05 +00001236@subsubsection Windows host
1237
1238There is a virtual ethernet driver for Windows 2000/XP systems, called
1239TAP-Win32. But it is not included in standard QEMU for Windows,
1240so you will need to get it separately. It is part of OpenVPN package,
1241so download OpenVPN from : @url{http://openvpn.net/}.
1242
bellard9d4fb822004-04-26 20:55:38 +00001243@subsection Using the user mode network stack
1244
bellard41d03942005-11-15 23:02:53 +00001245By using the option @option{-net user} (default configuration if no
1246@option{-net} option is specified), QEMU uses a completely user mode
1247network stack (you don't need root priviledge to use the virtual
1248network). The virtual network configuration is the following:
bellard9d4fb822004-04-26 20:55:38 +00001249
1250@example
1251
bellard41d03942005-11-15 23:02:53 +00001252 QEMU VLAN <------> Firewall/DHCP server <-----> Internet
1253 | (10.0.2.2)
bellard9d4fb822004-04-26 20:55:38 +00001254 |
bellard2518bd02004-09-30 22:35:13 +00001255 ----> DNS server (10.0.2.3)
1256 |
1257 ----> SMB server (10.0.2.4)
bellard9d4fb822004-04-26 20:55:38 +00001258@end example
1259
1260The QEMU VM behaves as if it was behind a firewall which blocks all
1261incoming connections. You can use a DHCP client to automatically
bellard41d03942005-11-15 23:02:53 +00001262configure the network in the QEMU VM. The DHCP server assign addresses
1263to the hosts starting from 10.0.2.15.
bellard9d4fb822004-04-26 20:55:38 +00001264
1265In order to check that the user mode network is working, you can ping
1266the address 10.0.2.2 and verify that you got an address in the range
126710.0.2.x from the QEMU virtual DHCP server.
1268
bellardb415a402004-05-23 21:04:06 +00001269Note that @code{ping} is not supported reliably to the internet as it
1270would require root priviledges. It means you can only ping the local
1271router (10.0.2.2).
1272
bellard9bf05442004-08-25 22:12:49 +00001273When using the built-in TFTP server, the router is also the TFTP
1274server.
1275
1276When using the @option{-redir} option, TCP or UDP connections can be
1277redirected from the host to the guest. It allows for example to
1278redirect X11, telnet or SSH connections.
bellard443f1372004-06-04 11:13:20 +00001279
bellard41d03942005-11-15 23:02:53 +00001280@subsection Connecting VLANs between QEMU instances
1281
1282Using the @option{-net socket} option, it is possible to make VLANs
1283that span several QEMU instances. See @ref{sec_invocation} to have a
1284basic example.
1285
bellard9d4fb822004-04-26 20:55:38 +00001286@node direct_linux_boot
1287@section Direct Linux Boot
bellard0806e3f2003-10-01 00:15:32 +00001288
1289This section explains how to launch a Linux kernel inside QEMU without
1290having to make a full bootable image. It is very useful for fast Linux
bellardee0f4752006-08-19 16:56:18 +00001291kernel testing.
bellard1eb20522003-06-25 16:21:49 +00001292
bellardee0f4752006-08-19 16:56:18 +00001293The syntax is:
bellard1eb20522003-06-25 16:21:49 +00001294@example
bellardee0f4752006-08-19 16:56:18 +00001295qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
bellard1eb20522003-06-25 16:21:49 +00001296@end example
1297
bellardee0f4752006-08-19 16:56:18 +00001298Use @option{-kernel} to provide the Linux kernel image and
1299@option{-append} to give the kernel command line arguments. The
1300@option{-initrd} option can be used to provide an INITRD image.
1301
1302When using the direct Linux boot, a disk image for the first hard disk
1303@file{hda} is required because its boot sector is used to launch the
1304Linux kernel.
1305
1306If you do not need graphical output, you can disable it and redirect
1307the virtual serial port and the QEMU monitor to the console with the
1308@option{-nographic} option. The typical command line is:
bellard1eb20522003-06-25 16:21:49 +00001309@example
bellardee0f4752006-08-19 16:56:18 +00001310qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1311 -append "root=/dev/hda console=ttyS0" -nographic
bellard1eb20522003-06-25 16:21:49 +00001312@end example
1313
bellardee0f4752006-08-19 16:56:18 +00001314Use @key{Ctrl-a c} to switch between the serial console and the
1315monitor (@pxref{pcsys_keys}).
bellardd5a0b502003-06-27 12:02:03 +00001316
bellarddebc7062006-04-30 21:58:41 +00001317@node pcsys_usb
bellardb389dbf2005-11-06 16:49:55 +00001318@section USB emulation
1319
pbrook0aff66b2006-05-26 00:49:52 +00001320QEMU emulates a PCI UHCI USB controller. You can virtually plug
1321virtual USB devices or real host USB devices (experimental, works only
1322on Linux hosts). Qemu will automatically create and connect virtual USB hubs
bellardf5420862006-08-21 20:26:44 +00001323as necessary to connect multiple USB devices.
bellardb389dbf2005-11-06 16:49:55 +00001324
pbrook0aff66b2006-05-26 00:49:52 +00001325@menu
1326* usb_devices::
1327* host_usb_devices::
1328@end menu
1329@node usb_devices
1330@subsection Connecting USB devices
bellardb389dbf2005-11-06 16:49:55 +00001331
pbrook0aff66b2006-05-26 00:49:52 +00001332USB devices can be connected with the @option{-usbdevice} commandline option
1333or the @code{usb_add} monitor command. Available devices are:
bellardb389dbf2005-11-06 16:49:55 +00001334
pbrook0aff66b2006-05-26 00:49:52 +00001335@table @var
1336@item @code{mouse}
1337Virtual Mouse. This will override the PS/2 mouse emulation when activated.
1338@item @code{tablet}
bellardc6d46c22006-09-03 17:10:41 +00001339Pointer device that uses absolute coordinates (like a touchscreen).
pbrook0aff66b2006-05-26 00:49:52 +00001340This means qemu is able to report the mouse position without having
1341to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
1342@item @code{disk:file}
1343Mass storage device based on @var{file} (@pxref{disk_images})
1344@item @code{host:bus.addr}
1345Pass through the host device identified by @var{bus.addr}
1346(Linux only)
1347@item @code{host:vendor_id:product_id}
1348Pass through the host device identified by @var{vendor_id:product_id}
1349(Linux only)
1350@end table
bellardb389dbf2005-11-06 16:49:55 +00001351
pbrook0aff66b2006-05-26 00:49:52 +00001352@node host_usb_devices
bellardb389dbf2005-11-06 16:49:55 +00001353@subsection Using host USB devices on a Linux host
1354
1355WARNING: this is an experimental feature. QEMU will slow down when
1356using it. USB devices requiring real time streaming (i.e. USB Video
1357Cameras) are not supported yet.
1358
1359@enumerate
1360@item If you use an early Linux 2.4 kernel, verify that no Linux driver
1361is actually using the USB device. A simple way to do that is simply to
1362disable the corresponding kernel module by renaming it from @file{mydriver.o}
1363to @file{mydriver.o.disabled}.
1364
1365@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
1366@example
1367ls /proc/bus/usb
1368001 devices drivers
1369@end example
1370
1371@item Since only root can access to the USB devices directly, you can either launch QEMU as root or change the permissions of the USB devices you want to use. For testing, the following suffices:
1372@example
1373chown -R myuid /proc/bus/usb
1374@end example
1375
1376@item Launch QEMU and do in the monitor:
1377@example
1378info usbhost
1379 Device 1.2, speed 480 Mb/s
1380 Class 00: USB device 1234:5678, USB DISK
1381@end example
1382You should see the list of the devices you can use (Never try to use
1383hubs, it won't work).
1384
1385@item Add the device in QEMU by using:
1386@example
1387usb_add host:1234:5678
1388@end example
1389
1390Normally the guest OS should report that a new USB device is
1391plugged. You can use the option @option{-usbdevice} to do the same.
1392
1393@item Now you can try to use the host USB device in QEMU.
1394
1395@end enumerate
1396
1397When relaunching QEMU, you may have to unplug and plug again the USB
1398device to make it work again (this is a bug).
1399
bellard0806e3f2003-10-01 00:15:32 +00001400@node gdb_usage
bellardda415d52003-06-27 18:50:50 +00001401@section GDB usage
1402
1403QEMU has a primitive support to work with gdb, so that you can do
bellard0806e3f2003-10-01 00:15:32 +00001404'Ctrl-C' while the virtual machine is running and inspect its state.
bellardda415d52003-06-27 18:50:50 +00001405
bellard9d4520d2003-10-28 01:38:57 +00001406In order to use gdb, launch qemu with the '-s' option. It will wait for a
bellardda415d52003-06-27 18:50:50 +00001407gdb connection:
1408@example
bellarddebc7062006-04-30 21:58:41 +00001409> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1410 -append "root=/dev/hda"
bellardda415d52003-06-27 18:50:50 +00001411Connected to host network interface: tun0
1412Waiting gdb connection on port 1234
1413@end example
1414
1415Then launch gdb on the 'vmlinux' executable:
1416@example
1417> gdb vmlinux
1418@end example
1419
1420In gdb, connect to QEMU:
1421@example
bellard6c9bf892004-01-24 13:46:56 +00001422(gdb) target remote localhost:1234
bellardda415d52003-06-27 18:50:50 +00001423@end example
1424
1425Then you can use gdb normally. For example, type 'c' to launch the kernel:
1426@example
1427(gdb) c
1428@end example
1429
bellard0806e3f2003-10-01 00:15:32 +00001430Here are some useful tips in order to use gdb on system code:
1431
1432@enumerate
1433@item
1434Use @code{info reg} to display all the CPU registers.
1435@item
1436Use @code{x/10i $eip} to display the code at the PC position.
1437@item
1438Use @code{set architecture i8086} to dump 16 bit code. Then use
bellard294e8632006-05-06 14:23:06 +00001439@code{x/10i $cs*16+$eip} to dump the code at the PC position.
bellard0806e3f2003-10-01 00:15:32 +00001440@end enumerate
1441
bellarddebc7062006-04-30 21:58:41 +00001442@node pcsys_os_specific
bellard1a084f32004-05-13 22:34:49 +00001443@section Target OS specific information
1444
1445@subsection Linux
1446
bellard15a34c62004-07-08 21:26:26 +00001447To have access to SVGA graphic modes under X11, use the @code{vesa} or
1448the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1449color depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001450
bellarde3371e62004-07-10 16:26:02 +00001451When using a 2.6 guest Linux kernel, you should add the option
1452@code{clock=pit} on the kernel command line because the 2.6 Linux
1453kernels make very strict real time clock checks by default that QEMU
1454cannot simulate exactly.
1455
bellard7c3fc842005-02-10 21:46:47 +00001456When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1457not activated because QEMU is slower with this patch. The QEMU
1458Accelerator Module is also much slower in this case. Earlier Fedora
1459Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1460patch by default. Newer kernels don't have it.
1461
bellard1a084f32004-05-13 22:34:49 +00001462@subsection Windows
1463
1464If you have a slow host, using Windows 95 is better as it gives the
1465best speed. Windows 2000 is also a good choice.
1466
bellarde3371e62004-07-10 16:26:02 +00001467@subsubsection SVGA graphic modes support
1468
1469QEMU emulates a Cirrus Logic GD5446 Video
bellard15a34c62004-07-08 21:26:26 +00001470card. All Windows versions starting from Windows 95 should recognize
1471and use this graphic card. For optimal performances, use 16 bit color
1472depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001473
bellard3cb08532006-06-21 21:19:50 +00001474If you are using Windows XP as guest OS and if you want to use high
1475resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
14761280x1024x16), then you should use the VESA VBE virtual graphic card
1477(option @option{-std-vga}).
1478
bellarde3371e62004-07-10 16:26:02 +00001479@subsubsection CPU usage reduction
1480
1481Windows 9x does not correctly use the CPU HLT
bellard15a34c62004-07-08 21:26:26 +00001482instruction. The result is that it takes host CPU cycles even when
1483idle. You can install the utility from
1484@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1485problem. Note that no such tool is needed for NT, 2000 or XP.
bellard1a084f32004-05-13 22:34:49 +00001486
bellard9d0a8e62005-07-03 17:34:05 +00001487@subsubsection Windows 2000 disk full problem
bellarde3371e62004-07-10 16:26:02 +00001488
bellard9d0a8e62005-07-03 17:34:05 +00001489Windows 2000 has a bug which gives a disk full problem during its
1490installation. When installing it, use the @option{-win2k-hack} QEMU
1491option to enable a specific workaround. After Windows 2000 is
1492installed, you no longer need this option (this option slows down the
1493IDE transfers).
bellarde3371e62004-07-10 16:26:02 +00001494
bellard6cc721c2005-07-28 22:27:28 +00001495@subsubsection Windows 2000 shutdown
1496
1497Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1498can. It comes from the fact that Windows 2000 does not automatically
1499use the APM driver provided by the BIOS.
1500
1501In order to correct that, do the following (thanks to Struan
1502Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1503Add/Troubleshoot a device => Add a new device & Next => No, select the
1504hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1505(again) a few times. Now the driver is installed and Windows 2000 now
1506correctly instructs QEMU to shutdown at the appropriate moment.
1507
1508@subsubsection Share a directory between Unix and Windows
1509
1510See @ref{sec_invocation} about the help of the option @option{-smb}.
1511
bellard2192c332006-08-21 20:28:18 +00001512@subsubsection Windows XP security problem
bellarde3371e62004-07-10 16:26:02 +00001513
1514Some releases of Windows XP install correctly but give a security
1515error when booting:
1516@example
1517A problem is preventing Windows from accurately checking the
1518license for this computer. Error code: 0x800703e6.
1519@end example
bellarde3371e62004-07-10 16:26:02 +00001520
bellard2192c332006-08-21 20:28:18 +00001521The workaround is to install a service pack for XP after a boot in safe
1522mode. Then reboot, and the problem should go away. Since there is no
1523network while in safe mode, its recommended to download the full
1524installation of SP1 or SP2 and transfer that via an ISO or using the
1525vvfat block device ("-hdb fat:directory_which_holds_the_SP").
bellarde3371e62004-07-10 16:26:02 +00001526
bellarda0a821a2004-07-14 17:38:57 +00001527@subsection MS-DOS and FreeDOS
1528
1529@subsubsection CPU usage reduction
1530
1531DOS does not correctly use the CPU HLT instruction. The result is that
1532it takes host CPU cycles even when idle. You can install the utility
1533from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1534problem.
1535
bellarddebc7062006-04-30 21:58:41 +00001536@node QEMU System emulator for non PC targets
bellard3f9f3aa2005-12-18 20:11:37 +00001537@chapter QEMU System emulator for non PC targets
1538
1539QEMU is a generic emulator and it emulates many non PC
1540machines. Most of the options are similar to the PC emulator. The
1541differences are mentionned in the following sections.
1542
bellarddebc7062006-04-30 21:58:41 +00001543@menu
1544* QEMU PowerPC System emulator::
1545* Sparc32 System emulator invocation::
1546* Sparc64 System emulator invocation::
1547* MIPS System emulator invocation::
1548* ARM System emulator invocation::
1549@end menu
1550
1551@node QEMU PowerPC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +00001552@section QEMU PowerPC System emulator
bellard52c00a52004-04-25 21:27:03 +00001553
1554Use the executable @file{qemu-system-ppc} to simulate a complete PREP
bellard15a34c62004-07-08 21:26:26 +00001555or PowerMac PowerPC system.
1556
bellardb671f9e2005-04-30 15:08:33 +00001557QEMU emulates the following PowerMac peripherals:
bellard15a34c62004-07-08 21:26:26 +00001558
1559@itemize @minus
1560@item
1561UniNorth PCI Bridge
1562@item
1563PCI VGA compatible card with VESA Bochs Extensions
1564@item
15652 PMAC IDE interfaces with hard disk and CD-ROM support
1566@item
1567NE2000 PCI adapters
1568@item
1569Non Volatile RAM
1570@item
1571VIA-CUDA with ADB keyboard and mouse.
1572@end itemize
bellard52c00a52004-04-25 21:27:03 +00001573
bellardb671f9e2005-04-30 15:08:33 +00001574QEMU emulates the following PREP peripherals:
bellard52c00a52004-04-25 21:27:03 +00001575
1576@itemize @minus
1577@item
bellard15a34c62004-07-08 21:26:26 +00001578PCI Bridge
1579@item
1580PCI VGA compatible card with VESA Bochs Extensions
1581@item
bellard52c00a52004-04-25 21:27:03 +000015822 IDE interfaces with hard disk and CD-ROM support
1583@item
1584Floppy disk
1585@item
bellard15a34c62004-07-08 21:26:26 +00001586NE2000 network adapters
bellard52c00a52004-04-25 21:27:03 +00001587@item
1588Serial port
1589@item
1590PREP Non Volatile RAM
bellard15a34c62004-07-08 21:26:26 +00001591@item
1592PC compatible keyboard and mouse.
bellard52c00a52004-04-25 21:27:03 +00001593@end itemize
1594
bellard15a34c62004-07-08 21:26:26 +00001595QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
bellard3f9f3aa2005-12-18 20:11:37 +00001596@url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
bellard52c00a52004-04-25 21:27:03 +00001597
bellard15a34c62004-07-08 21:26:26 +00001598@c man begin OPTIONS
1599
1600The following options are specific to the PowerPC emulation:
1601
1602@table @option
1603
bellard15a34c62004-07-08 21:26:26 +00001604@item -g WxH[xDEPTH]
1605
1606Set the initial VGA graphic mode. The default is 800x600x15.
1607
1608@end table
1609
1610@c man end
1611
1612
bellard52c00a52004-04-25 21:27:03 +00001613More information is available at
bellard3f9f3aa2005-12-18 20:11:37 +00001614@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
bellard52c00a52004-04-25 21:27:03 +00001615
bellarddebc7062006-04-30 21:58:41 +00001616@node Sparc32 System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001617@section Sparc32 System emulator invocation
bellarde80cfcf2004-12-19 23:18:01 +00001618
bellard0986ac32006-06-14 12:36:32 +00001619Use the executable @file{qemu-system-sparc} to simulate a SparcStation 5
bellard34751872005-07-02 14:31:34 +00001620(sun4m architecture). The emulation is somewhat complete.
bellarde80cfcf2004-12-19 23:18:01 +00001621
bellardb671f9e2005-04-30 15:08:33 +00001622QEMU emulates the following sun4m peripherals:
bellarde80cfcf2004-12-19 23:18:01 +00001623
1624@itemize @minus
bellard34751872005-07-02 14:31:34 +00001625@item
bellarde80cfcf2004-12-19 23:18:01 +00001626IOMMU
1627@item
1628TCX Frame buffer
1629@item
1630Lance (Am7990) Ethernet
1631@item
1632Non Volatile RAM M48T08
1633@item
bellard34751872005-07-02 14:31:34 +00001634Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1635and power/reset logic
1636@item
1637ESP SCSI controller with hard disk and CD-ROM support
1638@item
1639Floppy drive
bellarde80cfcf2004-12-19 23:18:01 +00001640@end itemize
1641
bellard34751872005-07-02 14:31:34 +00001642The number of peripherals is fixed in the architecture.
bellarde80cfcf2004-12-19 23:18:01 +00001643
bellard30a604f2006-06-14 18:35:18 +00001644Since version 0.8.2, QEMU uses OpenBIOS
bellard0986ac32006-06-14 12:36:32 +00001645@url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
1646firmware implementation. The goal is to implement a 100% IEEE
16471275-1994 (referred to as Open Firmware) compliant firmware.
bellard34751872005-07-02 14:31:34 +00001648
1649A sample Linux 2.6 series kernel and ram disk image are available on
bellard0986ac32006-06-14 12:36:32 +00001650the QEMU web site. Please note that currently NetBSD, OpenBSD or
1651Solaris kernels don't work.
bellard34751872005-07-02 14:31:34 +00001652
1653@c man begin OPTIONS
1654
1655The following options are specific to the Sparc emulation:
1656
1657@table @option
1658
1659@item -g WxH
1660
1661Set the initial TCX graphic mode. The default is 1024x768.
1662
1663@end table
1664
1665@c man end
1666
bellarddebc7062006-04-30 21:58:41 +00001667@node Sparc64 System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001668@section Sparc64 System emulator invocation
bellard34751872005-07-02 14:31:34 +00001669
1670Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
1671The emulator is not usable for anything yet.
bellardb7569212005-03-13 09:43:05 +00001672
bellard83469012005-07-23 14:27:54 +00001673QEMU emulates the following sun4u peripherals:
1674
1675@itemize @minus
1676@item
1677UltraSparc IIi APB PCI Bridge
1678@item
1679PCI VGA compatible card with VESA Bochs Extensions
1680@item
1681Non Volatile RAM M48T59
1682@item
1683PC-compatible serial ports
1684@end itemize
1685
bellarddebc7062006-04-30 21:58:41 +00001686@node MIPS System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001687@section MIPS System emulator invocation
bellard9d0a8e62005-07-03 17:34:05 +00001688
1689Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
bellard3f9f3aa2005-12-18 20:11:37 +00001690The emulator is able to boot a Linux kernel and to run a Linux Debian
1691installation from NFS. The following devices are emulated:
bellard9d0a8e62005-07-03 17:34:05 +00001692
bellard3f9f3aa2005-12-18 20:11:37 +00001693@itemize @minus
1694@item
1695MIPS R4K CPU
1696@item
1697PC style serial port
1698@item
1699NE2000 network card
1700@end itemize
1701
1702More information is available in the QEMU mailing-list archive.
1703
bellarddebc7062006-04-30 21:58:41 +00001704@node ARM System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001705@section ARM System emulator invocation
1706
1707Use the executable @file{qemu-system-arm} to simulate a ARM
1708machine. The ARM Integrator/CP board is emulated with the following
1709devices:
1710
1711@itemize @minus
1712@item
pbrooked96ca32006-02-20 00:35:00 +00001713ARM926E or ARM1026E CPU
bellard3f9f3aa2005-12-18 20:11:37 +00001714@item
1715Two PL011 UARTs
1716@item
1717SMC 91c111 Ethernet adapter
pbrook00a9bf12006-05-13 16:55:46 +00001718@item
1719PL110 LCD controller
1720@item
1721PL050 KMI with PS/2 keyboard and mouse.
1722@end itemize
1723
1724The ARM Versatile baseboard is emulated with the following devices:
1725
1726@itemize @minus
1727@item
1728ARM926E CPU
1729@item
1730PL190 Vectored Interrupt Controller
1731@item
1732Four PL011 UARTs
1733@item
1734SMC 91c111 Ethernet adapter
1735@item
1736PL110 LCD controller
1737@item
1738PL050 KMI with PS/2 keyboard and mouse.
1739@item
1740PCI host bridge. Note the emulated PCI bridge only provides access to
1741PCI memory space. It does not provide access to PCI IO space.
1742This means some devices (eg. ne2k_pci NIC) are not useable, and others
1743(eg. rtl8139 NIC) are only useable when the guest drivers use the memory
1744mapped control registers.
pbrooke6de1ba2006-06-16 21:48:48 +00001745@item
1746PCI OHCI USB controller.
1747@item
1748LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
bellard3f9f3aa2005-12-18 20:11:37 +00001749@end itemize
1750
pbrookd7739d72007-02-28 16:25:17 +00001751The ARM RealView Emulation baseboard is emulated with the following devices:
1752
1753@itemize @minus
1754@item
1755ARM926E CPU
1756@item
1757ARM AMBA Generic/Distributed Interrupt Controller
1758@item
1759Four PL011 UARTs
1760@item
1761SMC 91c111 Ethernet adapter
1762@item
1763PL110 LCD controller
1764@item
1765PL050 KMI with PS/2 keyboard and mouse
1766@item
1767PCI host bridge
1768@item
1769PCI OHCI USB controller
1770@item
1771LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
1772@end itemize
1773
bellard3f9f3aa2005-12-18 20:11:37 +00001774A Linux 2.6 test image is available on the QEMU web site. More
1775information is available in the QEMU mailing-list archive.
1776
bellard83195232007-02-05 19:42:07 +00001777@node QEMU User space emulator
1778@chapter QEMU User space emulator
1779
1780@menu
1781* Supported Operating Systems ::
1782* Linux User space emulator::
1783* Mac OS X/Darwin User space emulator ::
1784@end menu
1785
1786@node Supported Operating Systems
1787@section Supported Operating Systems
1788
1789The following OS are supported in user space emulation:
1790
1791@itemize @minus
1792@item
1793Linux (refered as qemu-linux-user)
1794@item
1795Mac OS X/Darwin (refered as qemu-darwin-user)
1796@end itemize
1797
1798@node Linux User space emulator
1799@section Linux User space emulator
bellard386405f2003-03-23 21:28:45 +00001800
bellarddebc7062006-04-30 21:58:41 +00001801@menu
1802* Quick Start::
1803* Wine launch::
1804* Command line options::
pbrook79737e42006-06-11 16:28:41 +00001805* Other binaries::
bellarddebc7062006-04-30 21:58:41 +00001806@end menu
1807
1808@node Quick Start
bellard83195232007-02-05 19:42:07 +00001809@subsection Quick Start
bellard386405f2003-03-23 21:28:45 +00001810
bellard1f673132004-04-04 15:21:17 +00001811In order to launch a Linux process, QEMU needs the process executable
1812itself and all the target (x86) dynamic libraries used by it.
bellard386405f2003-03-23 21:28:45 +00001813
bellard1f673132004-04-04 15:21:17 +00001814@itemize
bellard386405f2003-03-23 21:28:45 +00001815
bellard1f673132004-04-04 15:21:17 +00001816@item On x86, you can just try to launch any process by using the native
1817libraries:
bellard386405f2003-03-23 21:28:45 +00001818
bellard1f673132004-04-04 15:21:17 +00001819@example
1820qemu-i386 -L / /bin/ls
1821@end example
bellardfd429f22003-03-30 20:59:46 +00001822
bellard1f673132004-04-04 15:21:17 +00001823@code{-L /} tells that the x86 dynamic linker must be searched with a
1824@file{/} prefix.
bellard1eb20522003-06-25 16:21:49 +00001825
thsdbcf5e82007-02-10 22:14:55 +00001826@item Since QEMU is also a linux process, you can launch qemu with
1827qemu (NOTE: you can only do that if you compiled QEMU from the sources):
bellard1eb20522003-06-25 16:21:49 +00001828
bellard1f673132004-04-04 15:21:17 +00001829@example
1830qemu-i386 -L / qemu-i386 -L / /bin/ls
1831@end example
bellard386405f2003-03-23 21:28:45 +00001832
bellard1f673132004-04-04 15:21:17 +00001833@item On non x86 CPUs, you need first to download at least an x86 glibc
1834(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1835@code{LD_LIBRARY_PATH} is not set:
bellard386405f2003-03-23 21:28:45 +00001836
bellard1f673132004-04-04 15:21:17 +00001837@example
1838unset LD_LIBRARY_PATH
1839@end example
bellard386405f2003-03-23 21:28:45 +00001840
bellard1f673132004-04-04 15:21:17 +00001841Then you can launch the precompiled @file{ls} x86 executable:
bellard386405f2003-03-23 21:28:45 +00001842
bellard1f673132004-04-04 15:21:17 +00001843@example
1844qemu-i386 tests/i386/ls
1845@end example
1846You can look at @file{qemu-binfmt-conf.sh} so that
1847QEMU is automatically launched by the Linux kernel when you try to
1848launch x86 executables. It requires the @code{binfmt_misc} module in the
1849Linux kernel.
bellard386405f2003-03-23 21:28:45 +00001850
bellard1f673132004-04-04 15:21:17 +00001851@item The x86 version of QEMU is also included. You can try weird things such as:
1852@example
bellarddebc7062006-04-30 21:58:41 +00001853qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
1854 /usr/local/qemu-i386/bin/ls-i386
bellard1f673132004-04-04 15:21:17 +00001855@end example
bellard386405f2003-03-23 21:28:45 +00001856
bellard1f673132004-04-04 15:21:17 +00001857@end itemize
bellard386405f2003-03-23 21:28:45 +00001858
bellarddebc7062006-04-30 21:58:41 +00001859@node Wine launch
bellard83195232007-02-05 19:42:07 +00001860@subsection Wine launch
bellard386405f2003-03-23 21:28:45 +00001861
bellard1f673132004-04-04 15:21:17 +00001862@itemize
bellard386405f2003-03-23 21:28:45 +00001863
bellard1f673132004-04-04 15:21:17 +00001864@item Ensure that you have a working QEMU with the x86 glibc
1865distribution (see previous section). In order to verify it, you must be
1866able to do:
bellard386405f2003-03-23 21:28:45 +00001867
bellard1f673132004-04-04 15:21:17 +00001868@example
1869qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1870@end example
bellard386405f2003-03-23 21:28:45 +00001871
bellard1f673132004-04-04 15:21:17 +00001872@item Download the binary x86 Wine install
1873(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
bellard386405f2003-03-23 21:28:45 +00001874
bellard1f673132004-04-04 15:21:17 +00001875@item Configure Wine on your account. Look at the provided script
bellarddebc7062006-04-30 21:58:41 +00001876@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
bellard1f673132004-04-04 15:21:17 +00001877@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
bellard386405f2003-03-23 21:28:45 +00001878
bellard1f673132004-04-04 15:21:17 +00001879@item Then you can try the example @file{putty.exe}:
bellard386405f2003-03-23 21:28:45 +00001880
bellard1f673132004-04-04 15:21:17 +00001881@example
bellarddebc7062006-04-30 21:58:41 +00001882qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
1883 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
bellard1f673132004-04-04 15:21:17 +00001884@end example
bellard386405f2003-03-23 21:28:45 +00001885
bellard1f673132004-04-04 15:21:17 +00001886@end itemize
bellard386405f2003-03-23 21:28:45 +00001887
bellarddebc7062006-04-30 21:58:41 +00001888@node Command line options
bellard83195232007-02-05 19:42:07 +00001889@subsection Command line options
bellard386405f2003-03-23 21:28:45 +00001890
bellard1f673132004-04-04 15:21:17 +00001891@example
1892usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1893@end example
bellard386405f2003-03-23 21:28:45 +00001894
bellard1f673132004-04-04 15:21:17 +00001895@table @option
1896@item -h
1897Print the help
1898@item -L path
1899Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1900@item -s size
1901Set the x86 stack size in bytes (default=524288)
bellard386405f2003-03-23 21:28:45 +00001902@end table
1903
bellard1f673132004-04-04 15:21:17 +00001904Debug options:
bellard386405f2003-03-23 21:28:45 +00001905
bellard1f673132004-04-04 15:21:17 +00001906@table @option
1907@item -d
1908Activate log (logfile=/tmp/qemu.log)
1909@item -p pagesize
1910Act as if the host page size was 'pagesize' bytes
1911@end table
bellard386405f2003-03-23 21:28:45 +00001912
pbrook79737e42006-06-11 16:28:41 +00001913@node Other binaries
bellard83195232007-02-05 19:42:07 +00001914@subsection Other binaries
pbrook79737e42006-06-11 16:28:41 +00001915
1916@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
1917binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
1918configurations), and arm-uclinux bFLT format binaries.
1919
pbrooke6e59062006-10-22 00:18:54 +00001920@command{qemu-m68k} is capable of running semihosted binaries using the BDM
1921(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
1922coldfire uClinux bFLT format binaries.
1923
pbrook79737e42006-06-11 16:28:41 +00001924The binary format is detected automatically.
1925
bellard83195232007-02-05 19:42:07 +00001926@node Mac OS X/Darwin User space emulator
1927@section Mac OS X/Darwin User space emulator
1928
1929@menu
1930* Mac OS X/Darwin Status::
1931* Mac OS X/Darwin Quick Start::
1932* Mac OS X/Darwin Command line options::
1933@end menu
1934
1935@node Mac OS X/Darwin Status
1936@subsection Mac OS X/Darwin Status
1937
1938@itemize @minus
1939@item
1940target x86 on x86: Most apps (Cocoa and Carbon too) works. [1]
1941@item
1942target PowerPC on x86: Not working as the ppc commpage can't be mapped (yet!)
1943@item
thsdbcf5e82007-02-10 22:14:55 +00001944target PowerPC on PowerPC: Most apps (Cocoa and Carbon too) works. [1]
bellard83195232007-02-05 19:42:07 +00001945@item
1946target x86 on PowerPC: most utilities work. Cocoa and Carbon apps are not yet supported.
1947@end itemize
1948
1949[1] If you're host commpage can be executed by qemu.
1950
1951@node Mac OS X/Darwin Quick Start
1952@subsection Quick Start
1953
1954In order to launch a Mac OS X/Darwin process, QEMU needs the process executable
1955itself and all the target dynamic libraries used by it. If you don't have the FAT
1956libraries (you're running Mac OS X/ppc) you'll need to obtain it from a Mac OS X
1957CD or compile them by hand.
1958
1959@itemize
1960
1961@item On x86, you can just try to launch any process by using the native
1962libraries:
1963
1964@example
thsdbcf5e82007-02-10 22:14:55 +00001965qemu-i386 /bin/ls
bellard83195232007-02-05 19:42:07 +00001966@end example
1967
1968or to run the ppc version of the executable:
1969
1970@example
thsdbcf5e82007-02-10 22:14:55 +00001971qemu-ppc /bin/ls
bellard83195232007-02-05 19:42:07 +00001972@end example
1973
1974@item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
1975are installed:
1976
1977@example
thsdbcf5e82007-02-10 22:14:55 +00001978qemu-i386 -L /opt/x86_root/ /bin/ls
bellard83195232007-02-05 19:42:07 +00001979@end example
1980
1981@code{-L /opt/x86_root/} tells that the dynamic linker (dyld) path is in
1982@file{/opt/x86_root/usr/bin/dyld}.
1983
1984@end itemize
1985
1986@node Mac OS X/Darwin Command line options
1987@subsection Command line options
1988
1989@example
thsdbcf5e82007-02-10 22:14:55 +00001990usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
bellard83195232007-02-05 19:42:07 +00001991@end example
1992
1993@table @option
1994@item -h
1995Print the help
1996@item -L path
1997Set the library root path (default=/)
1998@item -s size
1999Set the stack size in bytes (default=524288)
2000@end table
2001
2002Debug options:
2003
2004@table @option
2005@item -d
2006Activate log (logfile=/tmp/qemu.log)
2007@item -p pagesize
2008Act as if the host page size was 'pagesize' bytes
2009@end table
2010
bellard15a34c62004-07-08 21:26:26 +00002011@node compilation
2012@chapter Compilation from the sources
2013
bellarddebc7062006-04-30 21:58:41 +00002014@menu
2015* Linux/Unix::
2016* Windows::
2017* Cross compilation for Windows with Linux::
2018* Mac OS X::
2019@end menu
2020
2021@node Linux/Unix
bellard7c3fc842005-02-10 21:46:47 +00002022@section Linux/Unix
bellard15a34c62004-07-08 21:26:26 +00002023
bellard7c3fc842005-02-10 21:46:47 +00002024@subsection Compilation
2025
2026First you must decompress the sources:
2027@example
2028cd /tmp
2029tar zxvf qemu-x.y.z.tar.gz
2030cd qemu-x.y.z
2031@end example
2032
2033Then you configure QEMU and build it (usually no options are needed):
2034@example
2035./configure
2036make
2037@end example
2038
2039Then type as root user:
2040@example
2041make install
2042@end example
2043to install QEMU in @file{/usr/local}.
2044
bellard4fe8b872007-02-05 19:38:35 +00002045@subsection GCC version
bellard7c3fc842005-02-10 21:46:47 +00002046
ths366dfc52006-12-11 18:35:08 +00002047In order to compile QEMU successfully, it is very important that you
bellard4fe8b872007-02-05 19:38:35 +00002048have the right tools. The most important one is gcc. On most hosts and
2049in particular on x86 ones, @emph{gcc 4.x is not supported}. If your
2050Linux distribution includes a gcc 4.x compiler, you can usually
2051install an older version (it is invoked by @code{gcc32} or
2052@code{gcc34}). The QEMU configure script automatically probes for
2053these older versions so that usally you don't have to do anything.
bellard15a34c62004-07-08 21:26:26 +00002054
bellarddebc7062006-04-30 21:58:41 +00002055@node Windows
bellard15a34c62004-07-08 21:26:26 +00002056@section Windows
2057
2058@itemize
2059@item Install the current versions of MSYS and MinGW from
2060@url{http://www.mingw.org/}. You can find detailed installation
2061instructions in the download section and the FAQ.
2062
2063@item Download
2064the MinGW development library of SDL 1.2.x
bellarddebc7062006-04-30 21:58:41 +00002065(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
bellard15a34c62004-07-08 21:26:26 +00002066@url{http://www.libsdl.org}. Unpack it in a temporary place, and
2067unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
2068directory. Edit the @file{sdl-config} script so that it gives the
2069correct SDL directory when invoked.
2070
2071@item Extract the current version of QEMU.
2072
2073@item Start the MSYS shell (file @file{msys.bat}).
2074
2075@item Change to the QEMU directory. Launch @file{./configure} and
2076@file{make}. If you have problems using SDL, verify that
2077@file{sdl-config} can be launched from the MSYS command line.
2078
2079@item You can install QEMU in @file{Program Files/Qemu} by typing
2080@file{make install}. Don't forget to copy @file{SDL.dll} in
2081@file{Program Files/Qemu}.
2082
2083@end itemize
2084
bellarddebc7062006-04-30 21:58:41 +00002085@node Cross compilation for Windows with Linux
bellard15a34c62004-07-08 21:26:26 +00002086@section Cross compilation for Windows with Linux
2087
2088@itemize
2089@item
2090Install the MinGW cross compilation tools available at
2091@url{http://www.mingw.org/}.
2092
2093@item
2094Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
2095unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
2096variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
2097the QEMU configuration script.
2098
2099@item
2100Configure QEMU for Windows cross compilation:
2101@example
2102./configure --enable-mingw32
2103@end example
2104If necessary, you can change the cross-prefix according to the prefix
2105choosen for the MinGW tools with --cross-prefix. You can also use
2106--prefix to set the Win32 install path.
2107
2108@item You can install QEMU in the installation directory by typing
2109@file{make install}. Don't forget to copy @file{SDL.dll} in the
2110installation directory.
2111
2112@end itemize
2113
2114Note: Currently, Wine does not seem able to launch
2115QEMU for Win32.
2116
bellarddebc7062006-04-30 21:58:41 +00002117@node Mac OS X
bellard15a34c62004-07-08 21:26:26 +00002118@section Mac OS X
2119
2120The Mac OS X patches are not fully merged in QEMU, so you should look
2121at the QEMU mailing list archive to have all the necessary
2122information.
2123
bellarddebc7062006-04-30 21:58:41 +00002124@node Index
2125@chapter Index
2126@printindex cp
2127
2128@bye