blob: 544de3b009835c87e7701d835265e83c92839601 [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)
pbrookce819862007-05-08 02:30:40 +000080@item ARM Integrator/CP (ARM926E, 1026E or 946E 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)
balrogb00052e2007-04-30 02:22:06 +000083@item Spitz, Akita, Borzoi and Terrier PDAs (PXA270 processor)
pbrook209a4e62007-05-23 20:16:15 +000084@item Arnewsh MCF5206 evaluation board (ColdFire V2).
bellard52c00a52004-04-25 21:27:03 +000085@end itemize
bellard386405f2003-03-23 21:28:45 +000086
pbrooke6e59062006-10-22 00:18:54 +000087For user emulation, x86, PowerPC, ARM, MIPS, Sparc32/64 and ColdFire(m68k) CPUs are supported.
bellard0806e3f2003-10-01 00:15:32 +000088
bellarddebc7062006-04-30 21:58:41 +000089@node Installation
bellard5b9f4572003-10-28 00:49:54 +000090@chapter Installation
91
bellard15a34c62004-07-08 21:26:26 +000092If you want to compile QEMU yourself, see @ref{compilation}.
93
bellarddebc7062006-04-30 21:58:41 +000094@menu
95* install_linux:: Linux
96* install_windows:: Windows
97* install_mac:: Macintosh
98@end menu
99
100@node install_linux
bellard1f673132004-04-04 15:21:17 +0000101@section Linux
102
bellard7c3fc842005-02-10 21:46:47 +0000103If a precompiled package is available for your distribution - you just
104have to install it. Otherwise, see @ref{compilation}.
bellard5b9f4572003-10-28 00:49:54 +0000105
bellarddebc7062006-04-30 21:58:41 +0000106@node install_windows
bellard1f673132004-04-04 15:21:17 +0000107@section Windows
bellard8cd0ac22004-05-12 19:09:16 +0000108
bellard15a34c62004-07-08 21:26:26 +0000109Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000110@url{http://www.free.oszoo.org/@/download.html}.
bellardd691f662003-03-24 21:58:34 +0000111
bellarddebc7062006-04-30 21:58:41 +0000112@node install_mac
bellard1f673132004-04-04 15:21:17 +0000113@section Mac OS X
bellardd691f662003-03-24 21:58:34 +0000114
bellard15a34c62004-07-08 21:26:26 +0000115Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000116@url{http://www.free.oszoo.org/@/download.html}.
bellarddf0f11a2003-05-28 00:27:57 +0000117
bellarddebc7062006-04-30 21:58:41 +0000118@node QEMU PC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +0000119@chapter QEMU PC System emulator
bellard1eb20522003-06-25 16:21:49 +0000120
bellarddebc7062006-04-30 21:58:41 +0000121@menu
122* pcsys_introduction:: Introduction
123* pcsys_quickstart:: Quick Start
124* sec_invocation:: Invocation
125* pcsys_keys:: Keys
126* pcsys_monitor:: QEMU Monitor
127* disk_images:: Disk Images
128* pcsys_network:: Network emulation
129* direct_linux_boot:: Direct Linux Boot
130* pcsys_usb:: USB emulation
131* gdb_usage:: GDB usage
132* pcsys_os_specific:: Target OS specific information
133@end menu
134
135@node pcsys_introduction
bellard0806e3f2003-10-01 00:15:32 +0000136@section Introduction
137
138@c man begin DESCRIPTION
139
bellard3f9f3aa2005-12-18 20:11:37 +0000140The QEMU PC System emulator simulates the
141following peripherals:
bellard0806e3f2003-10-01 00:15:32 +0000142
143@itemize @minus
bellard15a34c62004-07-08 21:26:26 +0000144@item
145i440FX host PCI bridge and PIIX3 PCI to ISA bridge
bellard0806e3f2003-10-01 00:15:32 +0000146@item
bellard15a34c62004-07-08 21:26:26 +0000147Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
148extensions (hardware level, including all non standard modes).
bellard0806e3f2003-10-01 00:15:32 +0000149@item
150PS/2 mouse and keyboard
151@item
bellard15a34c62004-07-08 21:26:26 +00001522 PCI IDE interfaces with hard disk and CD-ROM support
bellard1f673132004-04-04 15:21:17 +0000153@item
154Floppy disk
bellard0806e3f2003-10-01 00:15:32 +0000155@item
bellard15a34c62004-07-08 21:26:26 +0000156NE2000 PCI network adapters
bellard0806e3f2003-10-01 00:15:32 +0000157@item
bellard05d58182004-08-24 21:12:04 +0000158Serial ports
159@item
bellardc0fe3822005-11-05 18:55:28 +0000160Creative SoundBlaster 16 sound card
161@item
162ENSONIQ AudioPCI ES1370 sound card
163@item
164Adlib(OPL2) - Yamaha YM3812 compatible chip
bellardb389dbf2005-11-06 16:49:55 +0000165@item
166PCI UHCI USB controller and a virtual USB hub.
bellard0806e3f2003-10-01 00:15:32 +0000167@end itemize
168
bellard3f9f3aa2005-12-18 20:11:37 +0000169SMP is supported with up to 255 CPUs.
170
bellardc0fe3822005-11-05 18:55:28 +0000171Note that adlib is only available when QEMU was configured with
172-enable-adlib
173
bellard15a34c62004-07-08 21:26:26 +0000174QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
175VGA BIOS.
176
bellardc0fe3822005-11-05 18:55:28 +0000177QEMU uses YM3812 emulation by Tatsuyuki Satoh.
178
bellard0806e3f2003-10-01 00:15:32 +0000179@c man end
180
bellarddebc7062006-04-30 21:58:41 +0000181@node pcsys_quickstart
bellard1eb20522003-06-25 16:21:49 +0000182@section Quick Start
183
bellard285dc332003-10-27 23:58:04 +0000184Download and uncompress the linux image (@file{linux.img}) and type:
bellard0806e3f2003-10-01 00:15:32 +0000185
186@example
bellard285dc332003-10-27 23:58:04 +0000187qemu linux.img
bellard0806e3f2003-10-01 00:15:32 +0000188@end example
189
190Linux should boot and give you a prompt.
191
bellard6cc721c2005-07-28 22:27:28 +0000192@node sec_invocation
bellard1f673132004-04-04 15:21:17 +0000193@section Invocation
194
195@example
196@c man begin SYNOPSIS
197usage: qemu [options] [disk_image]
198@c man end
199@end example
200
201@c man begin OPTIONS
202@var{disk_image} is a raw hard disk image for IDE hard disk 0.
203
204General options:
205@table @option
bellard3dbbdc22005-11-06 18:20:37 +0000206@item -M machine
207Select the emulated machine (@code{-M ?} for list)
208
bellard1f673132004-04-04 15:21:17 +0000209@item -fda file
210@item -fdb file
bellarddebc7062006-04-30 21:58:41 +0000211Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You can
bellard19cb3732006-08-19 11:45:59 +0000212use the host floppy by using @file{/dev/fd0} as filename (@pxref{host_drives}).
bellard1f673132004-04-04 15:21:17 +0000213
214@item -hda file
215@item -hdb file
216@item -hdc file
217@item -hdd file
bellarddebc7062006-04-30 21:58:41 +0000218Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
bellard1f673132004-04-04 15:21:17 +0000219
220@item -cdrom file
221Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
bellardbe3edd92004-06-03 12:48:45 +0000222@option{-cdrom} at the same time). You can use the host CD-ROM by
bellard19cb3732006-08-19 11:45:59 +0000223using @file{/dev/cdrom} as filename (@pxref{host_drives}).
bellard1f673132004-04-04 15:21:17 +0000224
thseec85c22007-01-05 17:41:07 +0000225@item -boot [a|c|d|n]
226Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot
227is the default.
bellard1f673132004-04-04 15:21:17 +0000228
229@item -snapshot
230Write to temporary files instead of disk image files. In this case,
231the raw disk image you use is not written back. You can however force
ths42550fd2006-12-22 16:34:12 +0000232the write back by pressing @key{C-a s} (@pxref{disk_images}).
bellard1f673132004-04-04 15:21:17 +0000233
bellard52ca8d62006-06-14 16:03:05 +0000234@item -no-fd-bootchk
235Disable boot signature checking for floppy disks in Bochs BIOS. It may
236be needed to boot from old floppy disks.
237
bellard1f673132004-04-04 15:21:17 +0000238@item -m megs
bellard15a34c62004-07-08 21:26:26 +0000239Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
bellard1f673132004-04-04 15:21:17 +0000240
bellard3f9f3aa2005-12-18 20:11:37 +0000241@item -smp n
242Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
243CPUs are supported.
244
bellard1f673132004-04-04 15:21:17 +0000245@item -nographic
246
247Normally, QEMU uses SDL to display the VGA output. With this option,
248you can totally disable graphical output so that QEMU is a simple
249command line application. The emulated serial port is redirected on
250the console. Therefore, you can still use QEMU to debug a Linux kernel
251with a serial console.
252
ths5f189492007-02-19 01:23:15 +0000253@item -no-frame
254
255Do not use decorations for SDL windows and start them using the whole
256available screen space. This makes the using QEMU in a dedicated desktop
257workspace more convenient.
258
ths73fc9742006-12-22 02:09:07 +0000259@item -vnc display
bellard24236862006-04-30 21:28:36 +0000260
261Normally, QEMU uses SDL to display the VGA output. With this option,
ths73fc9742006-12-22 02:09:07 +0000262you can have QEMU listen on VNC display @var{display} and redirect the VGA
bellard3c656342006-07-14 13:13:51 +0000263display over the VNC session. It is very useful to enable the usb
264tablet device when using this option (option @option{-usbdevice
265tablet}). When using the VNC display, you must use the @option{-k}
ths73fc9742006-12-22 02:09:07 +0000266option to set the keyboard layout if you are not using en-us.
267
268@var{display} may be in the form @var{interface:d}, in which case connections
269will only be allowed from @var{interface} on display @var{d}. Optionally,
270@var{interface} can be omitted. @var{display} can also be in the form
271@var{unix:path} where @var{path} is the location of a unix socket to listen for
272connections on.
273
bellard24236862006-04-30 21:28:36 +0000274
bellard3d11d0e2004-12-12 16:56:30 +0000275@item -k language
276
277Use keyboard layout @var{language} (for example @code{fr} for
278French). This option is only needed where it is not easy to get raw PC
bellard3c656342006-07-14 13:13:51 +0000279keycodes (e.g. on Macs, with some X11 servers or with a VNC
280display). You don't normally need to use it on PC/Linux or PC/Windows
281hosts.
bellard3d11d0e2004-12-12 16:56:30 +0000282
283The available layouts are:
284@example
285ar de-ch es fo fr-ca hu ja mk no pt-br sv
286da en-gb et fr fr-ch is lt nl pl ru th
287de en-us fi fr-be hr it lv nl-be pt sl tr
288@end example
289
290The default is @code{en-us}.
291
bellard1d14ffa2005-10-30 18:58:22 +0000292@item -audio-help
293
294Will show the audio subsystem help: list of drivers, tunable
295parameters.
296
bellard6a36d842005-12-18 20:34:32 +0000297@item -soundhw card1,card2,... or -soundhw all
bellard1d14ffa2005-10-30 18:58:22 +0000298
299Enable audio and selected sound hardware. Use ? to print all
300available sound hardware.
301
302@example
303qemu -soundhw sb16,adlib hda
304qemu -soundhw es1370 hda
bellard6a36d842005-12-18 20:34:32 +0000305qemu -soundhw all hda
bellard1d14ffa2005-10-30 18:58:22 +0000306qemu -soundhw ?
307@end example
bellarda8c490c2004-04-26 20:59:17 +0000308
bellard15a34c62004-07-08 21:26:26 +0000309@item -localtime
310Set the real time clock to local time (the default is to UTC
311time). This option is needed to have correct date in MS-DOS or
312Windows.
313
bellardd63d3072004-10-03 13:29:03 +0000314@item -full-screen
315Start in full screen.
316
bellardf7cce892004-12-08 22:21:25 +0000317@item -pidfile file
318Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
319from a script.
320
ths71e3ceb2006-12-22 02:11:31 +0000321@item -daemonize
322Daemonize the QEMU process after initialization. QEMU will not detach from
323standard IO until it is ready to receive connections on any of its devices.
324This option is a useful way for external programs to launch QEMU without having
325to cope with initialization race conditions.
326
bellard9d0a8e62005-07-03 17:34:05 +0000327@item -win2k-hack
328Use it when installing Windows 2000 to avoid a disk full bug. After
329Windows 2000 is installed, you no longer need this option (this option
330slows down the IDE transfers).
331
ths9ae02552007-01-05 17:39:04 +0000332@item -option-rom file
333Load the contents of file as an option ROM. This option is useful to load
334things like EtherBoot.
335
thsc35734b2007-03-19 15:17:08 +0000336@item -name string
337Sets the name of the guest. This name will be display in the SDL window
338caption. The name will also be used for the VNC server.
339
bellard1f673132004-04-04 15:21:17 +0000340@end table
341
bellardb389dbf2005-11-06 16:49:55 +0000342USB options:
343@table @option
344
345@item -usb
346Enable the USB driver (will be the default soon)
347
348@item -usbdevice devname
pbrook0aff66b2006-05-26 00:49:52 +0000349Add the USB device @var{devname}. @xref{usb_devices}.
bellardb389dbf2005-11-06 16:49:55 +0000350@end table
351
bellard1f673132004-04-04 15:21:17 +0000352Network options:
353
354@table @option
355
pbrooka41b2ff2006-02-05 04:14:41 +0000356@item -net nic[,vlan=n][,macaddr=addr][,model=type]
bellard41d03942005-11-15 23:02:53 +0000357Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
358= 0 is the default). The NIC is currently an NE2000 on the PC
359target. Optionally, the MAC address can be changed. If no
360@option{-net} option is specified, a single NIC is created.
balrog549444e2007-05-01 17:53:37 +0000361Qemu can emulate several different models of network card.
362Valid values for @var{type} are
363@code{i82551}, @code{i82557b}, @code{i82559er},
364@code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139},
365@code{smc91c111} and @code{lance}.
366Not all devices are supported on all targets.
bellard1f673132004-04-04 15:21:17 +0000367
pbrook115defd2006-04-16 11:06:58 +0000368@item -net user[,vlan=n][,hostname=name]
bellard7e894632005-11-19 17:42:52 +0000369Use the user mode network stack which requires no administrator
pbrooka03a6052006-04-16 18:46:12 +0000370priviledge to run. @option{hostname=name} can be used to specify the client
pbrook115defd2006-04-16 11:06:58 +0000371hostname reported by the builtin DHCP server.
bellard3f1a88f2005-06-05 16:48:41 +0000372
bellard41d03942005-11-15 23:02:53 +0000373@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
374Connect the host TAP network interface @var{name} to VLAN @var{n} and
375use the network script @var{file} to configure it. The default
ths6a1cbf62007-02-02 00:37:56 +0000376network script is @file{/etc/qemu-ifup}. Use @option{script=no} to
377disable script execution. If @var{name} is not
bellard41d03942005-11-15 23:02:53 +0000378provided, the OS automatically provides one. @option{fd=h} can be
379used to specify the handle of an already opened host TAP interface. Example:
bellard3f1a88f2005-06-05 16:48:41 +0000380
bellard41d03942005-11-15 23:02:53 +0000381@example
382qemu linux.img -net nic -net tap
383@end example
bellard1f673132004-04-04 15:21:17 +0000384
bellard41d03942005-11-15 23:02:53 +0000385More complicated example (two NICs, each one connected to a TAP device)
386@example
387qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
388 -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
389@end example
bellard1f673132004-04-04 15:21:17 +0000390
bellard52c00a52004-04-25 21:27:03 +0000391
bellard41d03942005-11-15 23:02:53 +0000392@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]
393
394Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual
395machine using a TCP socket connection. If @option{listen} is
396specified, QEMU waits for incoming connections on @var{port}
397(@var{host} is optional). @option{connect} is used to connect to
bellard3d830452005-12-18 16:36:49 +0000398another QEMU instance using the @option{listen} option. @option{fd=h}
399specifies an already opened TCP socket.
bellard41d03942005-11-15 23:02:53 +0000400
401Example:
402@example
403# launch a first QEMU instance
bellarddebc7062006-04-30 21:58:41 +0000404qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
405 -net socket,listen=:1234
406# connect the VLAN 0 of this instance to the VLAN 0
407# of the first instance
408qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
409 -net socket,connect=127.0.0.1:1234
bellard41d03942005-11-15 23:02:53 +0000410@end example
411
bellard3d830452005-12-18 16:36:49 +0000412@item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]
413
414Create a VLAN @var{n} shared with another QEMU virtual
415machines using a UDP multicast socket, effectively making a bus for
416every QEMU with same multicast address @var{maddr} and @var{port}.
417NOTES:
418@enumerate
419@item
420Several QEMU can be running on different hosts and share same bus (assuming
421correct multicast setup for these hosts).
422@item
423mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
424@url{http://user-mode-linux.sf.net}.
425@item Use @option{fd=h} to specify an already opened UDP multicast socket.
426@end enumerate
427
428Example:
429@example
430# launch one QEMU instance
bellarddebc7062006-04-30 21:58:41 +0000431qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
432 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000433# launch another QEMU instance on same "bus"
bellarddebc7062006-04-30 21:58:41 +0000434qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
435 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000436# launch yet another QEMU instance on same "bus"
bellarddebc7062006-04-30 21:58:41 +0000437qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
438 -net socket,mcast=230.0.0.1:1234
bellard3d830452005-12-18 16:36:49 +0000439@end example
440
441Example (User Mode Linux compat.):
442@example
bellarddebc7062006-04-30 21:58:41 +0000443# launch QEMU instance (note mcast address selected
444# is UML's default)
445qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
446 -net socket,mcast=239.192.168.1:1102
bellard3d830452005-12-18 16:36:49 +0000447# launch UML
448/path/to/linux ubd0=/path/to/root_fs eth0=mcast
449@end example
450
bellard41d03942005-11-15 23:02:53 +0000451@item -net none
452Indicate that no network devices should be configured. It is used to
bellard039af322006-02-01 21:30:55 +0000453override the default configuration (@option{-net nic -net user}) which
454is activated if no @option{-net} options are provided.
bellard52c00a52004-04-25 21:27:03 +0000455
ths0db11372007-02-20 00:12:07 +0000456@item -tftp dir
bellard9bf05442004-08-25 22:12:49 +0000457When using the user mode network stack, activate a built-in TFTP
ths0db11372007-02-20 00:12:07 +0000458server. The files in @var{dir} will be exposed as the root of a TFTP server.
459The TFTP client on the guest must be configured in binary mode (use the command
460@code{bin} of the Unix TFTP client). The host IP address on the guest is as
461usual 10.0.2.2.
bellard9bf05442004-08-25 22:12:49 +0000462
ths47d5d012007-02-20 00:05:08 +0000463@item -bootp file
464When using the user mode network stack, broadcast @var{file} as the BOOTP
465filename. In conjunction with @option{-tftp}, this can be used to network boot
466a guest from a local directory.
467
468Example (using pxelinux):
469@example
470qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
471@end example
472
bellard2518bd02004-09-30 22:35:13 +0000473@item -smb dir
474When using the user mode network stack, activate a built-in SMB
475server so that Windows OSes can access to the host files in @file{dir}
476transparently.
477
478In the guest Windows OS, the line:
479@example
48010.0.2.4 smbserver
481@end example
482must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
483or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
484
485Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
486
487Note that a SAMBA server must be installed on the host OS in
ths366dfc52006-12-11 18:35:08 +0000488@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version
bellard6cc721c2005-07-28 22:27:28 +00004892.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
bellard2518bd02004-09-30 22:35:13 +0000490
bellard9bf05442004-08-25 22:12:49 +0000491@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
492
493When using the user mode network stack, redirect incoming TCP or UDP
494connections to the host port @var{host-port} to the guest
495@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
496is not specified, its value is 10.0.2.15 (default address given by the
497built-in DHCP server).
498
499For example, to redirect host X11 connection from screen 1 to guest
500screen 0, use the following:
501
502@example
503# on the host
504qemu -redir tcp:6001::6000 [...]
505# this host xterm should open in the guest X11 server
506xterm -display :1
507@end example
508
509To redirect telnet connections from host port 5555 to telnet port on
510the guest, use the following:
511
512@example
513# on the host
514qemu -redir tcp:5555::23 [...]
515telnet localhost 5555
516@end example
517
518Then when you use on the host @code{telnet localhost 5555}, you
519connect to the guest telnet server.
520
bellard1f673132004-04-04 15:21:17 +0000521@end table
522
bellard41d03942005-11-15 23:02:53 +0000523Linux boot specific: When using these options, you can use a given
bellard1f673132004-04-04 15:21:17 +0000524Linux kernel without installing it in the disk image. It can be useful
525for easier testing of various kernels.
526
527@table @option
528
529@item -kernel bzImage
530Use @var{bzImage} as kernel image.
531
532@item -append cmdline
533Use @var{cmdline} as kernel command line
534
535@item -initrd file
536Use @var{file} as initial ram disk.
537
538@end table
539
bellard15a34c62004-07-08 21:26:26 +0000540Debug/Expert options:
bellard1f673132004-04-04 15:21:17 +0000541@table @option
bellarda0a821a2004-07-14 17:38:57 +0000542
543@item -serial dev
bellard0bab00f2006-06-25 14:49:44 +0000544Redirect the virtual serial port to host character device
545@var{dev}. The default device is @code{vc} in graphical mode and
546@code{stdio} in non graphical mode.
547
548This option can be used several times to simulate up to 4 serials
549ports.
550
bellardc03b0f02006-09-03 14:10:53 +0000551Use @code{-serial none} to disable all serial ports.
552
bellard0bab00f2006-06-25 14:49:44 +0000553Available character devices are:
bellarda0a821a2004-07-14 17:38:57 +0000554@table @code
555@item vc
556Virtual console
557@item pty
558[Linux only] Pseudo TTY (a new PTY is automatically allocated)
bellardc03b0f02006-09-03 14:10:53 +0000559@item none
560No device is allocated.
bellarda0a821a2004-07-14 17:38:57 +0000561@item null
562void device
bellardf8d179e2005-11-08 22:30:36 +0000563@item /dev/XXX
bellarde57a8c02005-11-10 23:58:52 +0000564[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
bellardf8d179e2005-11-08 22:30:36 +0000565parameters are set according to the emulated ones.
bellarde57a8c02005-11-10 23:58:52 +0000566@item /dev/parportN
567[Linux only, parallel port only] Use host parallel port
ths5867c882007-02-17 23:44:43 +0000568@var{N}. Currently SPP and EPP parallel port features can be used.
bellardf8d179e2005-11-08 22:30:36 +0000569@item file:filename
570Write output to filename. No character can be read.
bellarda0a821a2004-07-14 17:38:57 +0000571@item stdio
572[Unix only] standard input/output
bellardf8d179e2005-11-08 22:30:36 +0000573@item pipe:filename
bellard0bab00f2006-06-25 14:49:44 +0000574name pipe @var{filename}
575@item COMn
576[Windows only] Use host serial port @var{n}
bellard951f1352006-06-27 21:02:43 +0000577@item udp:[remote_host]:remote_port[@@[src_ip]:src_port]
578This 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 +0000579
bellard951f1352006-06-27 21:02:43 +0000580If you just want a simple readonly console you can use @code{netcat} or
581@code{nc}, by starting qemu with: @code{-serial udp::4555} and nc as:
582@code{nc -u -l -p 4555}. Any time qemu writes something to that port it
583will appear in the netconsole session.
bellard0bab00f2006-06-25 14:49:44 +0000584
585If you plan to send characters back via netconsole or you want to stop
586and start qemu a lot of times, you should have qemu use the same
587source port each time by using something like @code{-serial
bellard951f1352006-06-27 21:02:43 +0000588udp::4555@@:4556} to qemu. Another approach is to use a patched
bellard0bab00f2006-06-25 14:49:44 +0000589version of netcat which can listen to a TCP port and send and receive
590characters via udp. If you have a patched version of netcat which
591activates telnet remote echo and single char transfer, then you can
592use the following options to step up a netcat redirector to allow
593telnet on port 5555 to access the qemu port.
594@table @code
bellard951f1352006-06-27 21:02:43 +0000595@item Qemu Options:
596-serial udp::4555@@:4556
597@item netcat options:
598-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
599@item telnet options:
600localhost 5555
bellard0bab00f2006-06-25 14:49:44 +0000601@end table
602
603
pbrookf7499982007-01-28 00:10:01 +0000604@item tcp:[host]:port[,server][,nowait][,nodelay]
bellard951f1352006-06-27 21:02:43 +0000605The TCP Net Console has two modes of operation. It can send the serial
606I/O to a location or wait for a connection from a location. By default
607the TCP Net Console is sent to @var{host} at the @var{port}. If you use
bellardf5420862006-08-21 20:26:44 +0000608the @var{server} option QEMU will wait for a client socket application
609to connect to the port before continuing, unless the @code{nowait}
pbrookf7499982007-01-28 00:10:01 +0000610option was specified. The @code{nodelay} option disables the Nagle buffering
611algoritm. If @var{host} is omitted, 0.0.0.0 is assumed. Only
bellard951f1352006-06-27 21:02:43 +0000612one TCP connection at a time is accepted. You can use @code{telnet} to
613connect to the corresponding character device.
614@table @code
615@item Example to send tcp console to 192.168.0.2 port 4444
616-serial tcp:192.168.0.2:4444
617@item Example to listen and wait on port 4444 for connection
618-serial tcp::4444,server
619@item Example to not wait and listen on ip 192.168.0.100 port 4444
620-serial tcp:192.168.0.100:4444,server,nowait
621@end table
622
pbrookf7499982007-01-28 00:10:01 +0000623@item telnet:host:port[,server][,nowait][,nodelay]
bellard951f1352006-06-27 21:02:43 +0000624The telnet protocol is used instead of raw tcp sockets. The options
625work the same as if you had specified @code{-serial tcp}. The
626difference is that the port acts like a telnet server or client using
627telnet option negotiation. This will also allow you to send the
628MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
629sequence. Typically in unix telnet you do it with Control-] and then
630type "send break" followed by pressing the enter key.
631
thsffd843b2006-12-21 19:46:43 +0000632@item unix:path[,server][,nowait]
633A unix domain socket is used instead of a tcp socket. The option works the
634same as if you had specified @code{-serial tcp} except the unix domain socket
635@var{path} is used for connections.
636
ths20d8a3e2007-02-18 17:04:49 +0000637@item mon:dev_string
638This is a special option to allow the monitor to be multiplexed onto
639another serial port. The monitor is accessed with key sequence of
640@key{Control-a} and then pressing @key{c}. See monitor access
641@ref{pcsys_keys} in the -nographic section for more keys.
642@var{dev_string} should be any one of the serial devices specified
643above. An example to multiplex the monitor onto a telnet server
644listening on port 4444 would be:
645@table @code
646@item -serial mon:telnet::4444,server,nowait
647@end table
648
bellard0bab00f2006-06-25 14:49:44 +0000649@end table
bellard05d58182004-08-24 21:12:04 +0000650
bellarde57a8c02005-11-10 23:58:52 +0000651@item -parallel dev
652Redirect the virtual parallel port to host device @var{dev} (same
653devices as the serial port). On Linux hosts, @file{/dev/parportN} can
654be used to use hardware devices connected on the corresponding host
655parallel port.
656
657This option can be used several times to simulate up to 3 parallel
658ports.
659
bellardc03b0f02006-09-03 14:10:53 +0000660Use @code{-parallel none} to disable all parallel ports.
661
bellarda0a821a2004-07-14 17:38:57 +0000662@item -monitor dev
663Redirect the monitor to host device @var{dev} (same devices as the
664serial port).
665The default device is @code{vc} in graphical mode and @code{stdio} in
666non graphical mode.
667
ths20d8a3e2007-02-18 17:04:49 +0000668@item -echr numeric_ascii_value
669Change the escape character used for switching to the monitor when using
670monitor and serial sharing. The default is @code{0x01} when using the
671@code{-nographic} option. @code{0x01} is equal to pressing
672@code{Control-a}. You can select a different character from the ascii
673control keys where 1 through 26 map to Control-a through Control-z. For
674instance you could use the either of the following to change the escape
675character to Control-t.
676@table @code
677@item -echr 0x14
678@item -echr 20
679@end table
680
bellard1f673132004-04-04 15:21:17 +0000681@item -s
bellarddebc7062006-04-30 21:58:41 +0000682Wait gdb connection to port 1234 (@pxref{gdb_usage}).
bellard1f673132004-04-04 15:21:17 +0000683@item -p port
pbrook4046d912007-01-28 01:53:16 +0000684Change gdb connection port. @var{port} can be either a decimal number
685to specify a TCP port, or a host device (same devices as the serial port).
bellard52c00a52004-04-25 21:27:03 +0000686@item -S
687Do not start CPU at startup (you must type 'c' in the monitor).
bellard1f673132004-04-04 15:21:17 +0000688@item -d
689Output log in /tmp/qemu.log
bellard46d47672004-11-16 01:45:27 +0000690@item -hdachs c,h,s,[,t]
691Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
692@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
693translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
694all thoses parameters. This option is useful for old MS-DOS disk
695images.
bellard7c3fc842005-02-10 21:46:47 +0000696
bellard87b47352006-08-17 17:22:54 +0000697@item -L path
698Set the directory for the BIOS, VGA BIOS and keymaps.
699
bellard15a34c62004-07-08 21:26:26 +0000700@item -std-vga
701Simulate a standard VGA card with Bochs VBE extensions (default is
bellard3cb08532006-06-21 21:19:50 +0000702Cirrus Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0
703VBE extensions (e.g. Windows XP) and if you want to use high
704resolution modes (>= 1280x1024x16) then you should use this option.
705
bellard3c656342006-07-14 13:13:51 +0000706@item -no-acpi
707Disable ACPI (Advanced Configuration and Power Interface) support. Use
708it if your guest OS complains about ACPI problems (PC target machine
709only).
710
bellardd1beab82006-10-02 19:44:22 +0000711@item -no-reboot
712Exit instead of rebooting.
713
bellardd63d3072004-10-03 13:29:03 +0000714@item -loadvm file
715Start right away with a saved state (@code{loadvm} in monitor)
pbrook8e716212007-01-20 17:12:09 +0000716
717@item -semihosting
718Enable "Angel" semihosting interface (ARM target machines only).
719Note that this allows guest direct access to the host filesystem,
720so should only be used with trusted guest OS.
bellard1f673132004-04-04 15:21:17 +0000721@end table
722
bellard3e11db92004-07-14 17:47:14 +0000723@c man end
724
bellarddebc7062006-04-30 21:58:41 +0000725@node pcsys_keys
bellard3e11db92004-07-14 17:47:14 +0000726@section Keys
727
728@c man begin OPTIONS
729
bellarda1b74fe2004-05-08 13:26:35 +0000730During the graphical emulation, you can use the following keys:
731@table @key
bellardf9859312004-10-03 14:33:10 +0000732@item Ctrl-Alt-f
bellarda1b74fe2004-05-08 13:26:35 +0000733Toggle full screen
bellarda0a821a2004-07-14 17:38:57 +0000734
bellardf9859312004-10-03 14:33:10 +0000735@item Ctrl-Alt-n
bellarda0a821a2004-07-14 17:38:57 +0000736Switch to virtual console 'n'. Standard console mappings are:
737@table @emph
738@item 1
739Target system display
740@item 2
741Monitor
742@item 3
743Serial port
bellarda1b74fe2004-05-08 13:26:35 +0000744@end table
745
bellardf9859312004-10-03 14:33:10 +0000746@item Ctrl-Alt
bellarda0a821a2004-07-14 17:38:57 +0000747Toggle mouse and keyboard grab.
748@end table
749
bellard3e11db92004-07-14 17:47:14 +0000750In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
751@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
752
bellarda0a821a2004-07-14 17:38:57 +0000753During emulation, if you are using the @option{-nographic} option, use
754@key{Ctrl-a h} to get terminal commands:
bellard1f673132004-04-04 15:21:17 +0000755
756@table @key
bellarda1b74fe2004-05-08 13:26:35 +0000757@item Ctrl-a h
bellard1f673132004-04-04 15:21:17 +0000758Print this help
bellarda1b74fe2004-05-08 13:26:35 +0000759@item Ctrl-a x
ths366dfc52006-12-11 18:35:08 +0000760Exit emulator
bellarda1b74fe2004-05-08 13:26:35 +0000761@item Ctrl-a s
bellard1f673132004-04-04 15:21:17 +0000762Save disk data back to file (if -snapshot)
ths20d8a3e2007-02-18 17:04:49 +0000763@item Ctrl-a t
764toggle console timestamps
bellarda1b74fe2004-05-08 13:26:35 +0000765@item Ctrl-a b
bellard1f673132004-04-04 15:21:17 +0000766Send break (magic sysrq in Linux)
bellarda1b74fe2004-05-08 13:26:35 +0000767@item Ctrl-a c
bellard1f673132004-04-04 15:21:17 +0000768Switch between console and monitor
bellarda1b74fe2004-05-08 13:26:35 +0000769@item Ctrl-a Ctrl-a
770Send Ctrl-a
bellard1f673132004-04-04 15:21:17 +0000771@end table
772@c man end
773
774@ignore
775
bellard1f673132004-04-04 15:21:17 +0000776@c man begin SEEALSO
777The HTML documentation of QEMU for more precise information and Linux
778user mode emulator invocation.
779@c man end
780
781@c man begin AUTHOR
782Fabrice Bellard
783@c man end
784
785@end ignore
786
bellarddebc7062006-04-30 21:58:41 +0000787@node pcsys_monitor
bellard1f673132004-04-04 15:21:17 +0000788@section QEMU Monitor
789
790The QEMU monitor is used to give complex commands to the QEMU
791emulator. You can use it to:
792
793@itemize @minus
794
795@item
thse5987522007-03-30 18:58:01 +0000796Remove or insert removable media images
bellard1f673132004-04-04 15:21:17 +0000797(such as CD-ROM or floppies)
798
799@item
800Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
801from a disk file.
802
803@item Inspect the VM state without an external debugger.
804
805@end itemize
806
807@subsection Commands
808
809The following commands are available:
810
811@table @option
812
813@item help or ? [cmd]
814Show the help for all commands or just for command @var{cmd}.
815
816@item commit
817Commit changes to the disk images (if -snapshot is used)
818
819@item info subcommand
820show various information about the system state
821
822@table @option
823@item info network
bellard41d03942005-11-15 23:02:53 +0000824show the various VLANs and the associated devices
bellard1f673132004-04-04 15:21:17 +0000825@item info block
826show the block devices
827@item info registers
828show the cpu registers
829@item info history
830show the command line history
bellardb389dbf2005-11-06 16:49:55 +0000831@item info pci
832show emulated PCI device
833@item info usb
834show USB devices plugged on the virtual USB hub
835@item info usbhost
836show all USB host devices
bellarda3c25992006-07-18 21:09:59 +0000837@item info capture
838show information about active capturing
bellard13a2e802006-08-06 14:50:31 +0000839@item info snapshots
840show list of VM snapshots
ths455204e2007-01-05 16:42:13 +0000841@item info mice
842show which guest mouse is receiving events
bellard1f673132004-04-04 15:21:17 +0000843@end table
844
845@item q or quit
846Quit the emulator.
847
848@item eject [-f] device
thse5987522007-03-30 18:58:01 +0000849Eject a removable medium (use -f to force it).
bellard1f673132004-04-04 15:21:17 +0000850
851@item change device filename
thse5987522007-03-30 18:58:01 +0000852Change a removable medium.
bellard1f673132004-04-04 15:21:17 +0000853
854@item screendump filename
855Save screen into PPM image @var{filename}.
856
ths455204e2007-01-05 16:42:13 +0000857@item mouse_move dx dy [dz]
858Move the active mouse to the specified coordinates @var{dx} @var{dy}
859with optional scroll axis @var{dz}.
860
861@item mouse_button val
862Change the active mouse button state @var{val} (1=L, 2=M, 4=R).
863
864@item mouse_set index
865Set which mouse device receives events at given @var{index}, index
866can be obtained with
867@example
868info mice
869@end example
870
bellarda3c25992006-07-18 21:09:59 +0000871@item wavcapture filename [frequency [bits [channels]]]
872Capture audio into @var{filename}. Using sample rate @var{frequency}
873bits per sample @var{bits} and number of channels @var{channels}.
874
875Defaults:
876@itemize @minus
877@item Sample rate = 44100 Hz - CD quality
878@item Bits = 16
879@item Number of channels = 2 - Stereo
880@end itemize
881
882@item stopcapture index
883Stop capture with a given @var{index}, index can be obtained with
884@example
885info capture
886@end example
887
bellard1f673132004-04-04 15:21:17 +0000888@item log item1[,...]
889Activate logging of the specified items to @file{/tmp/qemu.log}.
890
bellard13a2e802006-08-06 14:50:31 +0000891@item savevm [tag|id]
892Create a snapshot of the whole virtual machine. If @var{tag} is
893provided, it is used as human readable identifier. If there is already
894a snapshot with the same tag or ID, it is replaced. More info at
895@ref{vm_snapshots}.
bellard1f673132004-04-04 15:21:17 +0000896
bellard13a2e802006-08-06 14:50:31 +0000897@item loadvm tag|id
898Set the whole virtual machine to the snapshot identified by the tag
899@var{tag} or the unique snapshot ID @var{id}.
900
901@item delvm tag|id
902Delete the snapshot identified by @var{tag} or @var{id}.
bellard1f673132004-04-04 15:21:17 +0000903
904@item stop
905Stop emulation.
906
907@item c or cont
908Resume emulation.
909
910@item gdbserver [port]
911Start gdbserver session (default port=1234)
912
913@item x/fmt addr
914Virtual memory dump starting at @var{addr}.
915
916@item xp /fmt addr
917Physical memory dump starting at @var{addr}.
918
919@var{fmt} is a format which tells the command how to format the
920data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
921
922@table @var
923@item count
924is the number of items to be dumped.
925
926@item format
927can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
928c (char) or i (asm instruction).
929
930@item size
bellard52c00a52004-04-25 21:27:03 +0000931can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
932@code{h} or @code{w} can be specified with the @code{i} format to
933respectively select 16 or 32 bit code instruction size.
bellard1f673132004-04-04 15:21:17 +0000934
935@end table
936
937Examples:
938@itemize
939@item
940Dump 10 instructions at the current instruction pointer:
941@example
942(qemu) x/10i $eip
9430x90107063: ret
9440x90107064: sti
9450x90107065: lea 0x0(%esi,1),%esi
9460x90107069: lea 0x0(%edi,1),%edi
9470x90107070: ret
9480x90107071: jmp 0x90107080
9490x90107073: nop
9500x90107074: nop
9510x90107075: nop
9520x90107076: nop
953@end example
954
955@item
956Dump 80 16 bit values at the start of the video memory.
bellarddebc7062006-04-30 21:58:41 +0000957@smallexample
bellard1f673132004-04-04 15:21:17 +0000958(qemu) xp/80hx 0xb8000
9590x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
9600x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
9610x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
9620x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
9630x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
9640x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
9650x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9660x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9670x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9680x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
bellarddebc7062006-04-30 21:58:41 +0000969@end smallexample
bellard1f673132004-04-04 15:21:17 +0000970@end itemize
971
972@item p or print/fmt expr
973
974Print expression value. Only the @var{format} part of @var{fmt} is
975used.
976
bellarda3a91a32004-06-04 11:06:21 +0000977@item sendkey keys
978
979Send @var{keys} to the emulator. Use @code{-} to press several keys
980simultaneously. Example:
981@example
982sendkey ctrl-alt-f1
983@end example
984
985This command is useful to send keys that your graphical user interface
986intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
987
bellard15a34c62004-07-08 21:26:26 +0000988@item system_reset
989
990Reset the system.
991
bellardb389dbf2005-11-06 16:49:55 +0000992@item usb_add devname
993
pbrook0aff66b2006-05-26 00:49:52 +0000994Add the USB device @var{devname}. For details of available devices see
995@ref{usb_devices}
bellardb389dbf2005-11-06 16:49:55 +0000996
997@item usb_del devname
998
999Remove the USB device @var{devname} from the QEMU virtual USB
1000hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
1001command @code{info usb} to see the devices you can remove.
1002
bellard1f673132004-04-04 15:21:17 +00001003@end table
1004
1005@subsection Integer expressions
1006
1007The monitor understands integers expressions for every integer
1008argument. You can use register names to get the value of specifics
1009CPU registers by prefixing them with @emph{$}.
1010
1011@node disk_images
1012@section Disk Images
1013
bellardacd935e2004-11-15 22:57:26 +00001014Since version 0.6.1, QEMU supports many disk image formats, including
1015growable disk images (their size increase as non empty sectors are
bellard13a2e802006-08-06 14:50:31 +00001016written), compressed and encrypted disk images. Version 0.8.3 added
1017the new qcow2 disk image format which is essential to support VM
1018snapshots.
bellard1f673132004-04-04 15:21:17 +00001019
bellarddebc7062006-04-30 21:58:41 +00001020@menu
1021* disk_images_quickstart:: Quick start for disk image creation
1022* disk_images_snapshot_mode:: Snapshot mode
bellard13a2e802006-08-06 14:50:31 +00001023* vm_snapshots:: VM snapshots
bellarddebc7062006-04-30 21:58:41 +00001024* qemu_img_invocation:: qemu-img Invocation
bellard19cb3732006-08-19 11:45:59 +00001025* host_drives:: Using host drives
bellarddebc7062006-04-30 21:58:41 +00001026* disk_images_fat_images:: Virtual FAT disk images
1027@end menu
1028
1029@node disk_images_quickstart
bellardacd935e2004-11-15 22:57:26 +00001030@subsection Quick start for disk image creation
1031
1032You can create a disk image with the command:
bellard1f673132004-04-04 15:21:17 +00001033@example
bellardacd935e2004-11-15 22:57:26 +00001034qemu-img create myimage.img mysize
bellard1f673132004-04-04 15:21:17 +00001035@end example
bellardacd935e2004-11-15 22:57:26 +00001036where @var{myimage.img} is the disk image filename and @var{mysize} is its
1037size in kilobytes. You can add an @code{M} suffix to give the size in
1038megabytes and a @code{G} suffix for gigabytes.
1039
bellarddebc7062006-04-30 21:58:41 +00001040See @ref{qemu_img_invocation} for more information.
bellard1f673132004-04-04 15:21:17 +00001041
bellarddebc7062006-04-30 21:58:41 +00001042@node disk_images_snapshot_mode
bellard1f673132004-04-04 15:21:17 +00001043@subsection Snapshot mode
1044
1045If you use the option @option{-snapshot}, all disk images are
1046considered as read only. When sectors in written, they are written in
1047a temporary file created in @file{/tmp}. You can however force the
bellardacd935e2004-11-15 22:57:26 +00001048write back to the raw disk images by using the @code{commit} monitor
1049command (or @key{C-a s} in the serial console).
bellard1f673132004-04-04 15:21:17 +00001050
bellard13a2e802006-08-06 14:50:31 +00001051@node vm_snapshots
1052@subsection VM snapshots
1053
1054VM snapshots are snapshots of the complete virtual machine including
1055CPU state, RAM, device state and the content of all the writable
1056disks. In order to use VM snapshots, you must have at least one non
1057removable and writable block device using the @code{qcow2} disk image
1058format. Normally this device is the first virtual hard drive.
1059
1060Use the monitor command @code{savevm} to create a new VM snapshot or
1061replace an existing one. A human readable name can be assigned to each
bellard19d36792006-08-07 21:34:34 +00001062snapshot in addition to its numerical ID.
bellard13a2e802006-08-06 14:50:31 +00001063
1064Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
1065a VM snapshot. @code{info snapshots} lists the available snapshots
1066with their associated information:
1067
1068@example
1069(qemu) info snapshots
1070Snapshot devices: hda
1071Snapshot list (from hda):
1072ID TAG VM SIZE DATE VM CLOCK
10731 start 41M 2006-08-06 12:38:02 00:00:14.954
10742 40M 2006-08-06 12:43:29 00:00:18.633
10753 msys 40M 2006-08-06 12:44:04 00:00:23.514
1076@end example
1077
1078A VM snapshot is made of a VM state info (its size is shown in
1079@code{info snapshots}) and a snapshot of every writable disk image.
1080The VM state info is stored in the first @code{qcow2} non removable
1081and writable block device. The disk image snapshots are stored in
1082every disk image. The size of a snapshot in a disk image is difficult
1083to evaluate and is not shown by @code{info snapshots} because the
1084associated disk sectors are shared among all the snapshots to save
bellard19d36792006-08-07 21:34:34 +00001085disk space (otherwise each snapshot would need a full copy of all the
1086disk images).
bellard13a2e802006-08-06 14:50:31 +00001087
1088When using the (unrelated) @code{-snapshot} option
1089(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
1090but they are deleted as soon as you exit QEMU.
1091
1092VM snapshots currently have the following known limitations:
1093@itemize
1094@item
1095They cannot cope with removable devices if they are removed or
1096inserted after a snapshot is done.
1097@item
1098A few device drivers still have incomplete snapshot support so their
1099state is not saved or restored properly (in particular USB).
1100@end itemize
1101
bellardacd935e2004-11-15 22:57:26 +00001102@node qemu_img_invocation
1103@subsection @code{qemu-img} Invocation
bellard1f673132004-04-04 15:21:17 +00001104
bellardacd935e2004-11-15 22:57:26 +00001105@include qemu-img.texi
bellard05efe462004-06-16 20:34:33 +00001106
bellard19cb3732006-08-19 11:45:59 +00001107@node host_drives
1108@subsection Using host drives
1109
1110In addition to disk image files, QEMU can directly access host
1111devices. We describe here the usage for QEMU version >= 0.8.3.
1112
1113@subsubsection Linux
1114
1115On Linux, you can directly use the host device filename instead of a
1116disk image filename provided you have enough proviledge to access
1117it. For example, use @file{/dev/cdrom} to access to the CDROM or
1118@file{/dev/fd0} for the floppy.
1119
bellardf5420862006-08-21 20:26:44 +00001120@table @code
bellard19cb3732006-08-19 11:45:59 +00001121@item CD
1122You can specify a CDROM device even if no CDROM is loaded. QEMU has
1123specific code to detect CDROM insertion or removal. CDROM ejection by
1124the guest OS is supported. Currently only data CDs are supported.
1125@item Floppy
1126You can specify a floppy device even if no floppy is loaded. Floppy
1127removal is currently not detected accurately (if you change floppy
1128without doing floppy access while the floppy is not loaded, the guest
1129OS will think that the same floppy is loaded).
1130@item Hard disks
1131Hard disks can be used. Normally you must specify the whole disk
1132(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
1133see it as a partitioned disk. WARNING: unless you know what you do, it
1134is better to only make READ-ONLY accesses to the hard disk otherwise
1135you may corrupt your host data (use the @option{-snapshot} command
1136line option or modify the device permissions accordingly).
1137@end table
1138
1139@subsubsection Windows
1140
bellard01781962007-01-07 22:43:30 +00001141@table @code
1142@item CD
1143The prefered syntax is the drive letter (e.g. @file{d:}). The
1144alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
1145supported as an alias to the first CDROM drive.
bellard19cb3732006-08-19 11:45:59 +00001146
thse5987522007-03-30 18:58:01 +00001147Currently there is no specific code to handle removable media, so it
bellard19cb3732006-08-19 11:45:59 +00001148is better to use the @code{change} or @code{eject} monitor commands to
1149change or eject media.
bellard01781962007-01-07 22:43:30 +00001150@item Hard disks
1151Hard disks can be used with the syntax: @file{\\.\PhysicalDriveN}
1152where @var{N} is the drive number (0 is the first hard disk).
1153
1154WARNING: unless you know what you do, it is better to only make
1155READ-ONLY accesses to the hard disk otherwise you may corrupt your
1156host data (use the @option{-snapshot} command line so that the
1157modifications are written in a temporary file).
1158@end table
1159
bellard19cb3732006-08-19 11:45:59 +00001160
1161@subsubsection Mac OS X
1162
1163@file{/dev/cdrom} is an alias to the first CDROM.
1164
thse5987522007-03-30 18:58:01 +00001165Currently there is no specific code to handle removable media, so it
bellard19cb3732006-08-19 11:45:59 +00001166is better to use the @code{change} or @code{eject} monitor commands to
1167change or eject media.
1168
bellarddebc7062006-04-30 21:58:41 +00001169@node disk_images_fat_images
bellard2c6cadd2005-12-18 18:31:45 +00001170@subsection Virtual FAT disk images
1171
1172QEMU can automatically create a virtual FAT disk image from a
1173directory tree. In order to use it, just type:
1174
1175@example
1176qemu linux.img -hdb fat:/my_directory
1177@end example
1178
1179Then you access access to all the files in the @file{/my_directory}
1180directory without having to copy them in a disk image or to export
1181them via SAMBA or NFS. The default access is @emph{read-only}.
1182
1183Floppies can be emulated with the @code{:floppy:} option:
1184
1185@example
1186qemu linux.img -fda fat:floppy:/my_directory
1187@end example
1188
1189A read/write support is available for testing (beta stage) with the
1190@code{:rw:} option:
1191
1192@example
1193qemu linux.img -fda fat:floppy:rw:/my_directory
1194@end example
1195
1196What you should @emph{never} do:
1197@itemize
1198@item use non-ASCII filenames ;
1199@item use "-snapshot" together with ":rw:" ;
bellard85b2c682005-12-19 22:12:34 +00001200@item expect it to work when loadvm'ing ;
1201@item write to the FAT directory on the host system while accessing it with the guest system.
bellard2c6cadd2005-12-18 18:31:45 +00001202@end itemize
1203
bellarddebc7062006-04-30 21:58:41 +00001204@node pcsys_network
bellard9d4fb822004-04-26 20:55:38 +00001205@section Network emulation
1206
bellard41d03942005-11-15 23:02:53 +00001207QEMU can simulate several networks cards (NE2000 boards on the PC
1208target) and can connect them to an arbitrary number of Virtual Local
1209Area Networks (VLANs). Host TAP devices can be connected to any QEMU
1210VLAN. VLAN can be connected between separate instances of QEMU to
1211simulate large networks. For simpler usage, a non priviledged user mode
1212network stack can replace the TAP device to have a basic network
1213connection.
bellard9d4fb822004-04-26 20:55:38 +00001214
bellard41d03942005-11-15 23:02:53 +00001215@subsection VLANs
bellard9d4fb822004-04-26 20:55:38 +00001216
bellard41d03942005-11-15 23:02:53 +00001217QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
1218connection between several network devices. These devices can be for
1219example QEMU virtual Ethernet cards or virtual Host ethernet devices
1220(TAP devices).
1221
1222@subsection Using TAP network interfaces
1223
1224This is the standard way to connect QEMU to a real network. QEMU adds
1225a virtual network device on your host (called @code{tapN}), and you
1226can then configure it as if it was a real ethernet card.
bellard9d4fb822004-04-26 20:55:38 +00001227
bellard8f40c382006-09-20 20:28:05 +00001228@subsubsection Linux host
1229
bellard9d4fb822004-04-26 20:55:38 +00001230As an example, you can download the @file{linux-test-xxx.tar.gz}
1231archive and copy the script @file{qemu-ifup} in @file{/etc} and
1232configure properly @code{sudo} so that the command @code{ifconfig}
1233contained in @file{qemu-ifup} can be executed as root. You must verify
bellard41d03942005-11-15 23:02:53 +00001234that your host kernel supports the TAP network interfaces: the
bellard9d4fb822004-04-26 20:55:38 +00001235device @file{/dev/net/tun} must be present.
1236
bellardee0f4752006-08-19 16:56:18 +00001237See @ref{sec_invocation} to have examples of command lines using the
1238TAP network interfaces.
bellard9d4fb822004-04-26 20:55:38 +00001239
bellard8f40c382006-09-20 20:28:05 +00001240@subsubsection Windows host
1241
1242There is a virtual ethernet driver for Windows 2000/XP systems, called
1243TAP-Win32. But it is not included in standard QEMU for Windows,
1244so you will need to get it separately. It is part of OpenVPN package,
1245so download OpenVPN from : @url{http://openvpn.net/}.
1246
bellard9d4fb822004-04-26 20:55:38 +00001247@subsection Using the user mode network stack
1248
bellard41d03942005-11-15 23:02:53 +00001249By using the option @option{-net user} (default configuration if no
1250@option{-net} option is specified), QEMU uses a completely user mode
1251network stack (you don't need root priviledge to use the virtual
1252network). The virtual network configuration is the following:
bellard9d4fb822004-04-26 20:55:38 +00001253
1254@example
1255
bellard41d03942005-11-15 23:02:53 +00001256 QEMU VLAN <------> Firewall/DHCP server <-----> Internet
1257 | (10.0.2.2)
bellard9d4fb822004-04-26 20:55:38 +00001258 |
bellard2518bd02004-09-30 22:35:13 +00001259 ----> DNS server (10.0.2.3)
1260 |
1261 ----> SMB server (10.0.2.4)
bellard9d4fb822004-04-26 20:55:38 +00001262@end example
1263
1264The QEMU VM behaves as if it was behind a firewall which blocks all
1265incoming connections. You can use a DHCP client to automatically
bellard41d03942005-11-15 23:02:53 +00001266configure the network in the QEMU VM. The DHCP server assign addresses
1267to the hosts starting from 10.0.2.15.
bellard9d4fb822004-04-26 20:55:38 +00001268
1269In order to check that the user mode network is working, you can ping
1270the address 10.0.2.2 and verify that you got an address in the range
127110.0.2.x from the QEMU virtual DHCP server.
1272
bellardb415a402004-05-23 21:04:06 +00001273Note that @code{ping} is not supported reliably to the internet as it
1274would require root priviledges. It means you can only ping the local
1275router (10.0.2.2).
1276
bellard9bf05442004-08-25 22:12:49 +00001277When using the built-in TFTP server, the router is also the TFTP
1278server.
1279
1280When using the @option{-redir} option, TCP or UDP connections can be
1281redirected from the host to the guest. It allows for example to
1282redirect X11, telnet or SSH connections.
bellard443f1372004-06-04 11:13:20 +00001283
bellard41d03942005-11-15 23:02:53 +00001284@subsection Connecting VLANs between QEMU instances
1285
1286Using the @option{-net socket} option, it is possible to make VLANs
1287that span several QEMU instances. See @ref{sec_invocation} to have a
1288basic example.
1289
bellard9d4fb822004-04-26 20:55:38 +00001290@node direct_linux_boot
1291@section Direct Linux Boot
bellard0806e3f2003-10-01 00:15:32 +00001292
1293This section explains how to launch a Linux kernel inside QEMU without
1294having to make a full bootable image. It is very useful for fast Linux
bellardee0f4752006-08-19 16:56:18 +00001295kernel testing.
bellard1eb20522003-06-25 16:21:49 +00001296
bellardee0f4752006-08-19 16:56:18 +00001297The syntax is:
bellard1eb20522003-06-25 16:21:49 +00001298@example
bellardee0f4752006-08-19 16:56:18 +00001299qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
bellard1eb20522003-06-25 16:21:49 +00001300@end example
1301
bellardee0f4752006-08-19 16:56:18 +00001302Use @option{-kernel} to provide the Linux kernel image and
1303@option{-append} to give the kernel command line arguments. The
1304@option{-initrd} option can be used to provide an INITRD image.
1305
1306When using the direct Linux boot, a disk image for the first hard disk
1307@file{hda} is required because its boot sector is used to launch the
1308Linux kernel.
1309
1310If you do not need graphical output, you can disable it and redirect
1311the virtual serial port and the QEMU monitor to the console with the
1312@option{-nographic} option. The typical command line is:
bellard1eb20522003-06-25 16:21:49 +00001313@example
bellardee0f4752006-08-19 16:56:18 +00001314qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1315 -append "root=/dev/hda console=ttyS0" -nographic
bellard1eb20522003-06-25 16:21:49 +00001316@end example
1317
bellardee0f4752006-08-19 16:56:18 +00001318Use @key{Ctrl-a c} to switch between the serial console and the
1319monitor (@pxref{pcsys_keys}).
bellardd5a0b502003-06-27 12:02:03 +00001320
bellarddebc7062006-04-30 21:58:41 +00001321@node pcsys_usb
bellardb389dbf2005-11-06 16:49:55 +00001322@section USB emulation
1323
pbrook0aff66b2006-05-26 00:49:52 +00001324QEMU emulates a PCI UHCI USB controller. You can virtually plug
1325virtual USB devices or real host USB devices (experimental, works only
1326on Linux hosts). Qemu will automatically create and connect virtual USB hubs
bellardf5420862006-08-21 20:26:44 +00001327as necessary to connect multiple USB devices.
bellardb389dbf2005-11-06 16:49:55 +00001328
pbrook0aff66b2006-05-26 00:49:52 +00001329@menu
1330* usb_devices::
1331* host_usb_devices::
1332@end menu
1333@node usb_devices
1334@subsection Connecting USB devices
bellardb389dbf2005-11-06 16:49:55 +00001335
pbrook0aff66b2006-05-26 00:49:52 +00001336USB devices can be connected with the @option{-usbdevice} commandline option
1337or the @code{usb_add} monitor command. Available devices are:
bellardb389dbf2005-11-06 16:49:55 +00001338
pbrook0aff66b2006-05-26 00:49:52 +00001339@table @var
1340@item @code{mouse}
1341Virtual Mouse. This will override the PS/2 mouse emulation when activated.
1342@item @code{tablet}
bellardc6d46c22006-09-03 17:10:41 +00001343Pointer device that uses absolute coordinates (like a touchscreen).
pbrook0aff66b2006-05-26 00:49:52 +00001344This means qemu is able to report the mouse position without having
1345to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
1346@item @code{disk:file}
1347Mass storage device based on @var{file} (@pxref{disk_images})
1348@item @code{host:bus.addr}
1349Pass through the host device identified by @var{bus.addr}
1350(Linux only)
1351@item @code{host:vendor_id:product_id}
1352Pass through the host device identified by @var{vendor_id:product_id}
1353(Linux only)
1354@end table
bellardb389dbf2005-11-06 16:49:55 +00001355
pbrook0aff66b2006-05-26 00:49:52 +00001356@node host_usb_devices
bellardb389dbf2005-11-06 16:49:55 +00001357@subsection Using host USB devices on a Linux host
1358
1359WARNING: this is an experimental feature. QEMU will slow down when
1360using it. USB devices requiring real time streaming (i.e. USB Video
1361Cameras) are not supported yet.
1362
1363@enumerate
1364@item If you use an early Linux 2.4 kernel, verify that no Linux driver
1365is actually using the USB device. A simple way to do that is simply to
1366disable the corresponding kernel module by renaming it from @file{mydriver.o}
1367to @file{mydriver.o.disabled}.
1368
1369@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
1370@example
1371ls /proc/bus/usb
1372001 devices drivers
1373@end example
1374
1375@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:
1376@example
1377chown -R myuid /proc/bus/usb
1378@end example
1379
1380@item Launch QEMU and do in the monitor:
1381@example
1382info usbhost
1383 Device 1.2, speed 480 Mb/s
1384 Class 00: USB device 1234:5678, USB DISK
1385@end example
1386You should see the list of the devices you can use (Never try to use
1387hubs, it won't work).
1388
1389@item Add the device in QEMU by using:
1390@example
1391usb_add host:1234:5678
1392@end example
1393
1394Normally the guest OS should report that a new USB device is
1395plugged. You can use the option @option{-usbdevice} to do the same.
1396
1397@item Now you can try to use the host USB device in QEMU.
1398
1399@end enumerate
1400
1401When relaunching QEMU, you may have to unplug and plug again the USB
1402device to make it work again (this is a bug).
1403
bellard0806e3f2003-10-01 00:15:32 +00001404@node gdb_usage
bellardda415d52003-06-27 18:50:50 +00001405@section GDB usage
1406
1407QEMU has a primitive support to work with gdb, so that you can do
bellard0806e3f2003-10-01 00:15:32 +00001408'Ctrl-C' while the virtual machine is running and inspect its state.
bellardda415d52003-06-27 18:50:50 +00001409
bellard9d4520d2003-10-28 01:38:57 +00001410In order to use gdb, launch qemu with the '-s' option. It will wait for a
bellardda415d52003-06-27 18:50:50 +00001411gdb connection:
1412@example
bellarddebc7062006-04-30 21:58:41 +00001413> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1414 -append "root=/dev/hda"
bellardda415d52003-06-27 18:50:50 +00001415Connected to host network interface: tun0
1416Waiting gdb connection on port 1234
1417@end example
1418
1419Then launch gdb on the 'vmlinux' executable:
1420@example
1421> gdb vmlinux
1422@end example
1423
1424In gdb, connect to QEMU:
1425@example
bellard6c9bf892004-01-24 13:46:56 +00001426(gdb) target remote localhost:1234
bellardda415d52003-06-27 18:50:50 +00001427@end example
1428
1429Then you can use gdb normally. For example, type 'c' to launch the kernel:
1430@example
1431(gdb) c
1432@end example
1433
bellard0806e3f2003-10-01 00:15:32 +00001434Here are some useful tips in order to use gdb on system code:
1435
1436@enumerate
1437@item
1438Use @code{info reg} to display all the CPU registers.
1439@item
1440Use @code{x/10i $eip} to display the code at the PC position.
1441@item
1442Use @code{set architecture i8086} to dump 16 bit code. Then use
bellard294e8632006-05-06 14:23:06 +00001443@code{x/10i $cs*16+$eip} to dump the code at the PC position.
bellard0806e3f2003-10-01 00:15:32 +00001444@end enumerate
1445
bellarddebc7062006-04-30 21:58:41 +00001446@node pcsys_os_specific
bellard1a084f32004-05-13 22:34:49 +00001447@section Target OS specific information
1448
1449@subsection Linux
1450
bellard15a34c62004-07-08 21:26:26 +00001451To have access to SVGA graphic modes under X11, use the @code{vesa} or
1452the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1453color depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001454
bellarde3371e62004-07-10 16:26:02 +00001455When using a 2.6 guest Linux kernel, you should add the option
1456@code{clock=pit} on the kernel command line because the 2.6 Linux
1457kernels make very strict real time clock checks by default that QEMU
1458cannot simulate exactly.
1459
bellard7c3fc842005-02-10 21:46:47 +00001460When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1461not activated because QEMU is slower with this patch. The QEMU
1462Accelerator Module is also much slower in this case. Earlier Fedora
1463Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1464patch by default. Newer kernels don't have it.
1465
bellard1a084f32004-05-13 22:34:49 +00001466@subsection Windows
1467
1468If you have a slow host, using Windows 95 is better as it gives the
1469best speed. Windows 2000 is also a good choice.
1470
bellarde3371e62004-07-10 16:26:02 +00001471@subsubsection SVGA graphic modes support
1472
1473QEMU emulates a Cirrus Logic GD5446 Video
bellard15a34c62004-07-08 21:26:26 +00001474card. All Windows versions starting from Windows 95 should recognize
1475and use this graphic card. For optimal performances, use 16 bit color
1476depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001477
bellard3cb08532006-06-21 21:19:50 +00001478If you are using Windows XP as guest OS and if you want to use high
1479resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
14801280x1024x16), then you should use the VESA VBE virtual graphic card
1481(option @option{-std-vga}).
1482
bellarde3371e62004-07-10 16:26:02 +00001483@subsubsection CPU usage reduction
1484
1485Windows 9x does not correctly use the CPU HLT
bellard15a34c62004-07-08 21:26:26 +00001486instruction. The result is that it takes host CPU cycles even when
1487idle. You can install the utility from
1488@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1489problem. Note that no such tool is needed for NT, 2000 or XP.
bellard1a084f32004-05-13 22:34:49 +00001490
bellard9d0a8e62005-07-03 17:34:05 +00001491@subsubsection Windows 2000 disk full problem
bellarde3371e62004-07-10 16:26:02 +00001492
bellard9d0a8e62005-07-03 17:34:05 +00001493Windows 2000 has a bug which gives a disk full problem during its
1494installation. When installing it, use the @option{-win2k-hack} QEMU
1495option to enable a specific workaround. After Windows 2000 is
1496installed, you no longer need this option (this option slows down the
1497IDE transfers).
bellarde3371e62004-07-10 16:26:02 +00001498
bellard6cc721c2005-07-28 22:27:28 +00001499@subsubsection Windows 2000 shutdown
1500
1501Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1502can. It comes from the fact that Windows 2000 does not automatically
1503use the APM driver provided by the BIOS.
1504
1505In order to correct that, do the following (thanks to Struan
1506Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1507Add/Troubleshoot a device => Add a new device & Next => No, select the
1508hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1509(again) a few times. Now the driver is installed and Windows 2000 now
1510correctly instructs QEMU to shutdown at the appropriate moment.
1511
1512@subsubsection Share a directory between Unix and Windows
1513
1514See @ref{sec_invocation} about the help of the option @option{-smb}.
1515
bellard2192c332006-08-21 20:28:18 +00001516@subsubsection Windows XP security problem
bellarde3371e62004-07-10 16:26:02 +00001517
1518Some releases of Windows XP install correctly but give a security
1519error when booting:
1520@example
1521A problem is preventing Windows from accurately checking the
1522license for this computer. Error code: 0x800703e6.
1523@end example
bellarde3371e62004-07-10 16:26:02 +00001524
bellard2192c332006-08-21 20:28:18 +00001525The workaround is to install a service pack for XP after a boot in safe
1526mode. Then reboot, and the problem should go away. Since there is no
1527network while in safe mode, its recommended to download the full
1528installation of SP1 or SP2 and transfer that via an ISO or using the
1529vvfat block device ("-hdb fat:directory_which_holds_the_SP").
bellarde3371e62004-07-10 16:26:02 +00001530
bellarda0a821a2004-07-14 17:38:57 +00001531@subsection MS-DOS and FreeDOS
1532
1533@subsubsection CPU usage reduction
1534
1535DOS does not correctly use the CPU HLT instruction. The result is that
1536it takes host CPU cycles even when idle. You can install the utility
1537from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1538problem.
1539
bellarddebc7062006-04-30 21:58:41 +00001540@node QEMU System emulator for non PC targets
bellard3f9f3aa2005-12-18 20:11:37 +00001541@chapter QEMU System emulator for non PC targets
1542
1543QEMU is a generic emulator and it emulates many non PC
1544machines. Most of the options are similar to the PC emulator. The
1545differences are mentionned in the following sections.
1546
bellarddebc7062006-04-30 21:58:41 +00001547@menu
1548* QEMU PowerPC System emulator::
1549* Sparc32 System emulator invocation::
1550* Sparc64 System emulator invocation::
1551* MIPS System emulator invocation::
1552* ARM System emulator invocation::
pbrook209a4e62007-05-23 20:16:15 +00001553* ColdFire System emulator invocation::
bellarddebc7062006-04-30 21:58:41 +00001554@end menu
1555
1556@node QEMU PowerPC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +00001557@section QEMU PowerPC System emulator
bellard52c00a52004-04-25 21:27:03 +00001558
1559Use the executable @file{qemu-system-ppc} to simulate a complete PREP
bellard15a34c62004-07-08 21:26:26 +00001560or PowerMac PowerPC system.
1561
bellardb671f9e2005-04-30 15:08:33 +00001562QEMU emulates the following PowerMac peripherals:
bellard15a34c62004-07-08 21:26:26 +00001563
1564@itemize @minus
1565@item
1566UniNorth PCI Bridge
1567@item
1568PCI VGA compatible card with VESA Bochs Extensions
1569@item
15702 PMAC IDE interfaces with hard disk and CD-ROM support
1571@item
1572NE2000 PCI adapters
1573@item
1574Non Volatile RAM
1575@item
1576VIA-CUDA with ADB keyboard and mouse.
1577@end itemize
bellard52c00a52004-04-25 21:27:03 +00001578
bellardb671f9e2005-04-30 15:08:33 +00001579QEMU emulates the following PREP peripherals:
bellard52c00a52004-04-25 21:27:03 +00001580
1581@itemize @minus
1582@item
bellard15a34c62004-07-08 21:26:26 +00001583PCI Bridge
1584@item
1585PCI VGA compatible card with VESA Bochs Extensions
1586@item
bellard52c00a52004-04-25 21:27:03 +000015872 IDE interfaces with hard disk and CD-ROM support
1588@item
1589Floppy disk
1590@item
bellard15a34c62004-07-08 21:26:26 +00001591NE2000 network adapters
bellard52c00a52004-04-25 21:27:03 +00001592@item
1593Serial port
1594@item
1595PREP Non Volatile RAM
bellard15a34c62004-07-08 21:26:26 +00001596@item
1597PC compatible keyboard and mouse.
bellard52c00a52004-04-25 21:27:03 +00001598@end itemize
1599
bellard15a34c62004-07-08 21:26:26 +00001600QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
bellard3f9f3aa2005-12-18 20:11:37 +00001601@url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
bellard52c00a52004-04-25 21:27:03 +00001602
bellard15a34c62004-07-08 21:26:26 +00001603@c man begin OPTIONS
1604
1605The following options are specific to the PowerPC emulation:
1606
1607@table @option
1608
bellard15a34c62004-07-08 21:26:26 +00001609@item -g WxH[xDEPTH]
1610
1611Set the initial VGA graphic mode. The default is 800x600x15.
1612
1613@end table
1614
1615@c man end
1616
1617
bellard52c00a52004-04-25 21:27:03 +00001618More information is available at
bellard3f9f3aa2005-12-18 20:11:37 +00001619@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
bellard52c00a52004-04-25 21:27:03 +00001620
bellarddebc7062006-04-30 21:58:41 +00001621@node Sparc32 System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001622@section Sparc32 System emulator invocation
bellarde80cfcf2004-12-19 23:18:01 +00001623
bellard0986ac32006-06-14 12:36:32 +00001624Use the executable @file{qemu-system-sparc} to simulate a SparcStation 5
bellard34751872005-07-02 14:31:34 +00001625(sun4m architecture). The emulation is somewhat complete.
bellarde80cfcf2004-12-19 23:18:01 +00001626
bellardb671f9e2005-04-30 15:08:33 +00001627QEMU emulates the following sun4m peripherals:
bellarde80cfcf2004-12-19 23:18:01 +00001628
1629@itemize @minus
bellard34751872005-07-02 14:31:34 +00001630@item
bellarde80cfcf2004-12-19 23:18:01 +00001631IOMMU
1632@item
1633TCX Frame buffer
1634@item
1635Lance (Am7990) Ethernet
1636@item
1637Non Volatile RAM M48T08
1638@item
bellard34751872005-07-02 14:31:34 +00001639Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1640and power/reset logic
1641@item
1642ESP SCSI controller with hard disk and CD-ROM support
1643@item
1644Floppy drive
bellarde80cfcf2004-12-19 23:18:01 +00001645@end itemize
1646
bellard34751872005-07-02 14:31:34 +00001647The number of peripherals is fixed in the architecture.
bellarde80cfcf2004-12-19 23:18:01 +00001648
bellard30a604f2006-06-14 18:35:18 +00001649Since version 0.8.2, QEMU uses OpenBIOS
bellard0986ac32006-06-14 12:36:32 +00001650@url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
1651firmware implementation. The goal is to implement a 100% IEEE
16521275-1994 (referred to as Open Firmware) compliant firmware.
bellard34751872005-07-02 14:31:34 +00001653
1654A sample Linux 2.6 series kernel and ram disk image are available on
bellard0986ac32006-06-14 12:36:32 +00001655the QEMU web site. Please note that currently NetBSD, OpenBSD or
1656Solaris kernels don't work.
bellard34751872005-07-02 14:31:34 +00001657
1658@c man begin OPTIONS
1659
1660The following options are specific to the Sparc emulation:
1661
1662@table @option
1663
1664@item -g WxH
1665
1666Set the initial TCX graphic mode. The default is 1024x768.
1667
blueswir166508602007-05-01 14:16:52 +00001668@item -prom-env string
1669
1670Set OpenBIOS variables in NVRAM, for example:
1671
1672@example
1673qemu-system-sparc -prom-env 'auto-boot?=false' \
1674 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
1675@end example
1676
bellard34751872005-07-02 14:31:34 +00001677@end table
1678
1679@c man end
1680
bellarddebc7062006-04-30 21:58:41 +00001681@node Sparc64 System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001682@section Sparc64 System emulator invocation
bellard34751872005-07-02 14:31:34 +00001683
1684Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
1685The emulator is not usable for anything yet.
bellardb7569212005-03-13 09:43:05 +00001686
bellard83469012005-07-23 14:27:54 +00001687QEMU emulates the following sun4u peripherals:
1688
1689@itemize @minus
1690@item
1691UltraSparc IIi APB PCI Bridge
1692@item
1693PCI VGA compatible card with VESA Bochs Extensions
1694@item
1695Non Volatile RAM M48T59
1696@item
1697PC-compatible serial ports
1698@end itemize
1699
bellarddebc7062006-04-30 21:58:41 +00001700@node MIPS System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001701@section MIPS System emulator invocation
bellard9d0a8e62005-07-03 17:34:05 +00001702
1703Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
bellard3f9f3aa2005-12-18 20:11:37 +00001704The emulator is able to boot a Linux kernel and to run a Linux Debian
1705installation from NFS. The following devices are emulated:
bellard9d0a8e62005-07-03 17:34:05 +00001706
bellard3f9f3aa2005-12-18 20:11:37 +00001707@itemize @minus
1708@item
1709MIPS R4K CPU
1710@item
1711PC style serial port
1712@item
1713NE2000 network card
1714@end itemize
1715
1716More information is available in the QEMU mailing-list archive.
1717
bellarddebc7062006-04-30 21:58:41 +00001718@node ARM System emulator invocation
bellard3f9f3aa2005-12-18 20:11:37 +00001719@section ARM System emulator invocation
1720
1721Use the executable @file{qemu-system-arm} to simulate a ARM
1722machine. The ARM Integrator/CP board is emulated with the following
1723devices:
1724
1725@itemize @minus
1726@item
pbrookce819862007-05-08 02:30:40 +00001727ARM926E, ARM1026E or ARM946E CPU
bellard3f9f3aa2005-12-18 20:11:37 +00001728@item
1729Two PL011 UARTs
1730@item
1731SMC 91c111 Ethernet adapter
pbrook00a9bf12006-05-13 16:55:46 +00001732@item
1733PL110 LCD controller
1734@item
1735PL050 KMI with PS/2 keyboard and mouse.
pbrooka1bb27b2007-04-06 16:49:48 +00001736@item
1737PL181 MultiMedia Card Interface with SD card.
pbrook00a9bf12006-05-13 16:55:46 +00001738@end itemize
1739
1740The ARM Versatile baseboard is emulated with the following devices:
1741
1742@itemize @minus
1743@item
1744ARM926E CPU
1745@item
1746PL190 Vectored Interrupt Controller
1747@item
1748Four PL011 UARTs
1749@item
1750SMC 91c111 Ethernet adapter
1751@item
1752PL110 LCD controller
1753@item
1754PL050 KMI with PS/2 keyboard and mouse.
1755@item
1756PCI host bridge. Note the emulated PCI bridge only provides access to
1757PCI memory space. It does not provide access to PCI IO space.
1758This means some devices (eg. ne2k_pci NIC) are not useable, and others
1759(eg. rtl8139 NIC) are only useable when the guest drivers use the memory
1760mapped control registers.
pbrooke6de1ba2006-06-16 21:48:48 +00001761@item
1762PCI OHCI USB controller.
1763@item
1764LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
pbrooka1bb27b2007-04-06 16:49:48 +00001765@item
1766PL181 MultiMedia Card Interface with SD card.
bellard3f9f3aa2005-12-18 20:11:37 +00001767@end itemize
1768
pbrookd7739d72007-02-28 16:25:17 +00001769The ARM RealView Emulation baseboard is emulated with the following devices:
1770
1771@itemize @minus
1772@item
1773ARM926E CPU
1774@item
1775ARM AMBA Generic/Distributed Interrupt Controller
1776@item
1777Four PL011 UARTs
1778@item
1779SMC 91c111 Ethernet adapter
1780@item
1781PL110 LCD controller
1782@item
1783PL050 KMI with PS/2 keyboard and mouse
1784@item
1785PCI host bridge
1786@item
1787PCI OHCI USB controller
1788@item
1789LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
pbrooka1bb27b2007-04-06 16:49:48 +00001790@item
1791PL181 MultiMedia Card Interface with SD card.
pbrookd7739d72007-02-28 16:25:17 +00001792@end itemize
1793
balrogb00052e2007-04-30 02:22:06 +00001794The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
1795and "Terrier") emulation includes the following peripherals:
1796
1797@itemize @minus
1798@item
1799Intel PXA270 System-on-chip (ARM V5TE core)
1800@item
1801NAND Flash memory
1802@item
1803IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
1804@item
1805On-chip OHCI USB controller
1806@item
1807On-chip LCD controller
1808@item
1809On-chip Real Time Clock
1810@item
1811TI ADS7846 touchscreen controller on SSP bus
1812@item
1813Maxim MAX1111 analog-digital converter on I@math{^2}C bus
1814@item
1815GPIO-connected keyboard controller and LEDs
1816@item
balrog549444e2007-05-01 17:53:37 +00001817Secure Digital card connected to PXA MMC/SD host
balrogb00052e2007-04-30 02:22:06 +00001818@item
1819Three on-chip UARTs
1820@item
1821WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
1822@end itemize
1823
bellard3f9f3aa2005-12-18 20:11:37 +00001824A Linux 2.6 test image is available on the QEMU web site. More
1825information is available in the QEMU mailing-list archive.
1826
pbrook209a4e62007-05-23 20:16:15 +00001827@node ColdFire System emulator invocation
1828@section ColdFire System emulator invocation
1829
1830Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
1831The emulator is able to boot a uClinux kernel.
1832The following devices are emulated:
1833
1834@itemize @minus
1835@item
1836MCF5206 ColdFire V2 Microprocessor.
1837@item
1838Two on-chip UARTs.
1839@end itemize
1840
bellard83195232007-02-05 19:42:07 +00001841@node QEMU User space emulator
1842@chapter QEMU User space emulator
1843
1844@menu
1845* Supported Operating Systems ::
1846* Linux User space emulator::
1847* Mac OS X/Darwin User space emulator ::
1848@end menu
1849
1850@node Supported Operating Systems
1851@section Supported Operating Systems
1852
1853The following OS are supported in user space emulation:
1854
1855@itemize @minus
1856@item
1857Linux (refered as qemu-linux-user)
1858@item
1859Mac OS X/Darwin (refered as qemu-darwin-user)
1860@end itemize
1861
1862@node Linux User space emulator
1863@section Linux User space emulator
bellard386405f2003-03-23 21:28:45 +00001864
bellarddebc7062006-04-30 21:58:41 +00001865@menu
1866* Quick Start::
1867* Wine launch::
1868* Command line options::
pbrook79737e42006-06-11 16:28:41 +00001869* Other binaries::
bellarddebc7062006-04-30 21:58:41 +00001870@end menu
1871
1872@node Quick Start
bellard83195232007-02-05 19:42:07 +00001873@subsection Quick Start
bellard386405f2003-03-23 21:28:45 +00001874
bellard1f673132004-04-04 15:21:17 +00001875In order to launch a Linux process, QEMU needs the process executable
1876itself and all the target (x86) dynamic libraries used by it.
bellard386405f2003-03-23 21:28:45 +00001877
bellard1f673132004-04-04 15:21:17 +00001878@itemize
bellard386405f2003-03-23 21:28:45 +00001879
bellard1f673132004-04-04 15:21:17 +00001880@item On x86, you can just try to launch any process by using the native
1881libraries:
bellard386405f2003-03-23 21:28:45 +00001882
bellard1f673132004-04-04 15:21:17 +00001883@example
1884qemu-i386 -L / /bin/ls
1885@end example
bellardfd429f22003-03-30 20:59:46 +00001886
bellard1f673132004-04-04 15:21:17 +00001887@code{-L /} tells that the x86 dynamic linker must be searched with a
1888@file{/} prefix.
bellard1eb20522003-06-25 16:21:49 +00001889
thsdbcf5e82007-02-10 22:14:55 +00001890@item Since QEMU is also a linux process, you can launch qemu with
1891qemu (NOTE: you can only do that if you compiled QEMU from the sources):
bellard1eb20522003-06-25 16:21:49 +00001892
bellard1f673132004-04-04 15:21:17 +00001893@example
1894qemu-i386 -L / qemu-i386 -L / /bin/ls
1895@end example
bellard386405f2003-03-23 21:28:45 +00001896
bellard1f673132004-04-04 15:21:17 +00001897@item On non x86 CPUs, you need first to download at least an x86 glibc
1898(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1899@code{LD_LIBRARY_PATH} is not set:
bellard386405f2003-03-23 21:28:45 +00001900
bellard1f673132004-04-04 15:21:17 +00001901@example
1902unset LD_LIBRARY_PATH
1903@end example
bellard386405f2003-03-23 21:28:45 +00001904
bellard1f673132004-04-04 15:21:17 +00001905Then you can launch the precompiled @file{ls} x86 executable:
bellard386405f2003-03-23 21:28:45 +00001906
bellard1f673132004-04-04 15:21:17 +00001907@example
1908qemu-i386 tests/i386/ls
1909@end example
1910You can look at @file{qemu-binfmt-conf.sh} so that
1911QEMU is automatically launched by the Linux kernel when you try to
1912launch x86 executables. It requires the @code{binfmt_misc} module in the
1913Linux kernel.
bellard386405f2003-03-23 21:28:45 +00001914
bellard1f673132004-04-04 15:21:17 +00001915@item The x86 version of QEMU is also included. You can try weird things such as:
1916@example
bellarddebc7062006-04-30 21:58:41 +00001917qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
1918 /usr/local/qemu-i386/bin/ls-i386
bellard1f673132004-04-04 15:21:17 +00001919@end example
bellard386405f2003-03-23 21:28:45 +00001920
bellard1f673132004-04-04 15:21:17 +00001921@end itemize
bellard386405f2003-03-23 21:28:45 +00001922
bellarddebc7062006-04-30 21:58:41 +00001923@node Wine launch
bellard83195232007-02-05 19:42:07 +00001924@subsection Wine launch
bellard386405f2003-03-23 21:28:45 +00001925
bellard1f673132004-04-04 15:21:17 +00001926@itemize
bellard386405f2003-03-23 21:28:45 +00001927
bellard1f673132004-04-04 15:21:17 +00001928@item Ensure that you have a working QEMU with the x86 glibc
1929distribution (see previous section). In order to verify it, you must be
1930able to do:
bellard386405f2003-03-23 21:28:45 +00001931
bellard1f673132004-04-04 15:21:17 +00001932@example
1933qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1934@end example
bellard386405f2003-03-23 21:28:45 +00001935
bellard1f673132004-04-04 15:21:17 +00001936@item Download the binary x86 Wine install
1937(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
bellard386405f2003-03-23 21:28:45 +00001938
bellard1f673132004-04-04 15:21:17 +00001939@item Configure Wine on your account. Look at the provided script
bellarddebc7062006-04-30 21:58:41 +00001940@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
bellard1f673132004-04-04 15:21:17 +00001941@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
bellard386405f2003-03-23 21:28:45 +00001942
bellard1f673132004-04-04 15:21:17 +00001943@item Then you can try the example @file{putty.exe}:
bellard386405f2003-03-23 21:28:45 +00001944
bellard1f673132004-04-04 15:21:17 +00001945@example
bellarddebc7062006-04-30 21:58:41 +00001946qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
1947 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
bellard1f673132004-04-04 15:21:17 +00001948@end example
bellard386405f2003-03-23 21:28:45 +00001949
bellard1f673132004-04-04 15:21:17 +00001950@end itemize
bellard386405f2003-03-23 21:28:45 +00001951
bellarddebc7062006-04-30 21:58:41 +00001952@node Command line options
bellard83195232007-02-05 19:42:07 +00001953@subsection Command line options
bellard386405f2003-03-23 21:28:45 +00001954
bellard1f673132004-04-04 15:21:17 +00001955@example
1956usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1957@end example
bellard386405f2003-03-23 21:28:45 +00001958
bellard1f673132004-04-04 15:21:17 +00001959@table @option
1960@item -h
1961Print the help
1962@item -L path
1963Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1964@item -s size
1965Set the x86 stack size in bytes (default=524288)
bellard386405f2003-03-23 21:28:45 +00001966@end table
1967
bellard1f673132004-04-04 15:21:17 +00001968Debug options:
bellard386405f2003-03-23 21:28:45 +00001969
bellard1f673132004-04-04 15:21:17 +00001970@table @option
1971@item -d
1972Activate log (logfile=/tmp/qemu.log)
1973@item -p pagesize
1974Act as if the host page size was 'pagesize' bytes
1975@end table
bellard386405f2003-03-23 21:28:45 +00001976
pbrook79737e42006-06-11 16:28:41 +00001977@node Other binaries
bellard83195232007-02-05 19:42:07 +00001978@subsection Other binaries
pbrook79737e42006-06-11 16:28:41 +00001979
1980@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
1981binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
1982configurations), and arm-uclinux bFLT format binaries.
1983
pbrooke6e59062006-10-22 00:18:54 +00001984@command{qemu-m68k} is capable of running semihosted binaries using the BDM
1985(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
1986coldfire uClinux bFLT format binaries.
1987
pbrook79737e42006-06-11 16:28:41 +00001988The binary format is detected automatically.
1989
bellard83195232007-02-05 19:42:07 +00001990@node Mac OS X/Darwin User space emulator
1991@section Mac OS X/Darwin User space emulator
1992
1993@menu
1994* Mac OS X/Darwin Status::
1995* Mac OS X/Darwin Quick Start::
1996* Mac OS X/Darwin Command line options::
1997@end menu
1998
1999@node Mac OS X/Darwin Status
2000@subsection Mac OS X/Darwin Status
2001
2002@itemize @minus
2003@item
2004target x86 on x86: Most apps (Cocoa and Carbon too) works. [1]
2005@item
2006target PowerPC on x86: Not working as the ppc commpage can't be mapped (yet!)
2007@item
thsdbcf5e82007-02-10 22:14:55 +00002008target PowerPC on PowerPC: Most apps (Cocoa and Carbon too) works. [1]
bellard83195232007-02-05 19:42:07 +00002009@item
2010target x86 on PowerPC: most utilities work. Cocoa and Carbon apps are not yet supported.
2011@end itemize
2012
2013[1] If you're host commpage can be executed by qemu.
2014
2015@node Mac OS X/Darwin Quick Start
2016@subsection Quick Start
2017
2018In order to launch a Mac OS X/Darwin process, QEMU needs the process executable
2019itself and all the target dynamic libraries used by it. If you don't have the FAT
2020libraries (you're running Mac OS X/ppc) you'll need to obtain it from a Mac OS X
2021CD or compile them by hand.
2022
2023@itemize
2024
2025@item On x86, you can just try to launch any process by using the native
2026libraries:
2027
2028@example
thsdbcf5e82007-02-10 22:14:55 +00002029qemu-i386 /bin/ls
bellard83195232007-02-05 19:42:07 +00002030@end example
2031
2032or to run the ppc version of the executable:
2033
2034@example
thsdbcf5e82007-02-10 22:14:55 +00002035qemu-ppc /bin/ls
bellard83195232007-02-05 19:42:07 +00002036@end example
2037
2038@item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
2039are installed:
2040
2041@example
thsdbcf5e82007-02-10 22:14:55 +00002042qemu-i386 -L /opt/x86_root/ /bin/ls
bellard83195232007-02-05 19:42:07 +00002043@end example
2044
2045@code{-L /opt/x86_root/} tells that the dynamic linker (dyld) path is in
2046@file{/opt/x86_root/usr/bin/dyld}.
2047
2048@end itemize
2049
2050@node Mac OS X/Darwin Command line options
2051@subsection Command line options
2052
2053@example
thsdbcf5e82007-02-10 22:14:55 +00002054usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
bellard83195232007-02-05 19:42:07 +00002055@end example
2056
2057@table @option
2058@item -h
2059Print the help
2060@item -L path
2061Set the library root path (default=/)
2062@item -s size
2063Set the stack size in bytes (default=524288)
2064@end table
2065
2066Debug options:
2067
2068@table @option
2069@item -d
2070Activate log (logfile=/tmp/qemu.log)
2071@item -p pagesize
2072Act as if the host page size was 'pagesize' bytes
2073@end table
2074
bellard15a34c62004-07-08 21:26:26 +00002075@node compilation
2076@chapter Compilation from the sources
2077
bellarddebc7062006-04-30 21:58:41 +00002078@menu
2079* Linux/Unix::
2080* Windows::
2081* Cross compilation for Windows with Linux::
2082* Mac OS X::
2083@end menu
2084
2085@node Linux/Unix
bellard7c3fc842005-02-10 21:46:47 +00002086@section Linux/Unix
bellard15a34c62004-07-08 21:26:26 +00002087
bellard7c3fc842005-02-10 21:46:47 +00002088@subsection Compilation
2089
2090First you must decompress the sources:
2091@example
2092cd /tmp
2093tar zxvf qemu-x.y.z.tar.gz
2094cd qemu-x.y.z
2095@end example
2096
2097Then you configure QEMU and build it (usually no options are needed):
2098@example
2099./configure
2100make
2101@end example
2102
2103Then type as root user:
2104@example
2105make install
2106@end example
2107to install QEMU in @file{/usr/local}.
2108
bellard4fe8b872007-02-05 19:38:35 +00002109@subsection GCC version
bellard7c3fc842005-02-10 21:46:47 +00002110
ths366dfc52006-12-11 18:35:08 +00002111In order to compile QEMU successfully, it is very important that you
bellard4fe8b872007-02-05 19:38:35 +00002112have the right tools. The most important one is gcc. On most hosts and
2113in particular on x86 ones, @emph{gcc 4.x is not supported}. If your
2114Linux distribution includes a gcc 4.x compiler, you can usually
2115install an older version (it is invoked by @code{gcc32} or
2116@code{gcc34}). The QEMU configure script automatically probes for
2117these older versions so that usally you don't have to do anything.
bellard15a34c62004-07-08 21:26:26 +00002118
bellarddebc7062006-04-30 21:58:41 +00002119@node Windows
bellard15a34c62004-07-08 21:26:26 +00002120@section Windows
2121
2122@itemize
2123@item Install the current versions of MSYS and MinGW from
2124@url{http://www.mingw.org/}. You can find detailed installation
2125instructions in the download section and the FAQ.
2126
2127@item Download
2128the MinGW development library of SDL 1.2.x
bellarddebc7062006-04-30 21:58:41 +00002129(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
bellard15a34c62004-07-08 21:26:26 +00002130@url{http://www.libsdl.org}. Unpack it in a temporary place, and
2131unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
2132directory. Edit the @file{sdl-config} script so that it gives the
2133correct SDL directory when invoked.
2134
2135@item Extract the current version of QEMU.
2136
2137@item Start the MSYS shell (file @file{msys.bat}).
2138
2139@item Change to the QEMU directory. Launch @file{./configure} and
2140@file{make}. If you have problems using SDL, verify that
2141@file{sdl-config} can be launched from the MSYS command line.
2142
2143@item You can install QEMU in @file{Program Files/Qemu} by typing
2144@file{make install}. Don't forget to copy @file{SDL.dll} in
2145@file{Program Files/Qemu}.
2146
2147@end itemize
2148
bellarddebc7062006-04-30 21:58:41 +00002149@node Cross compilation for Windows with Linux
bellard15a34c62004-07-08 21:26:26 +00002150@section Cross compilation for Windows with Linux
2151
2152@itemize
2153@item
2154Install the MinGW cross compilation tools available at
2155@url{http://www.mingw.org/}.
2156
2157@item
2158Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
2159unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
2160variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
2161the QEMU configuration script.
2162
2163@item
2164Configure QEMU for Windows cross compilation:
2165@example
2166./configure --enable-mingw32
2167@end example
2168If necessary, you can change the cross-prefix according to the prefix
2169choosen for the MinGW tools with --cross-prefix. You can also use
2170--prefix to set the Win32 install path.
2171
2172@item You can install QEMU in the installation directory by typing
2173@file{make install}. Don't forget to copy @file{SDL.dll} in the
2174installation directory.
2175
2176@end itemize
2177
2178Note: Currently, Wine does not seem able to launch
2179QEMU for Win32.
2180
bellarddebc7062006-04-30 21:58:41 +00002181@node Mac OS X
bellard15a34c62004-07-08 21:26:26 +00002182@section Mac OS X
2183
2184The Mac OS X patches are not fully merged in QEMU, so you should look
2185at the QEMU mailing list archive to have all the necessary
2186information.
2187
bellarddebc7062006-04-30 21:58:41 +00002188@node Index
2189@chapter Index
2190@printindex cp
2191
2192@bye