blob: 99d7f0db5ab8d51a389bad0f40e61fa370727c78 [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
ths5fafdf22007-09-16 21:08:06 +000053@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
ths5fafdf22007-09-16 21:08:06 +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
ths5fafdf22007-09-16 21:08:06 +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)
aurel32d45952a2009-01-08 16:01:13 +000075@item G3 Beige PowerMac (PowerPC processor)
bellard9d0a8e62005-07-03 17:34:05 +000076@item Mac99 PowerMac (PowerPC processor, in progress)
blueswir1ee76f822007-12-28 20:59:23 +000077@item Sun4m/Sun4c/Sun4d (32-bit Sparc processor)
blueswir1c7ba2182008-07-22 07:07:34 +000078@item Sun4u/Sun4v (64-bit Sparc processor, in progress)
thsd9aedc32007-12-17 03:47:55 +000079@item Malta board (32-bit and 64-bit MIPS processors)
aurel3288cb0a02008-04-08 05:57:37 +000080@item MIPS Magnum (64-bit MIPS processor)
pbrook9ee6e8b2007-11-11 00:04:49 +000081@item ARM Integrator/CP (ARM)
82@item ARM Versatile baseboard (ARM)
83@item ARM RealView Emulation baseboard (ARM)
balrogef4c3852008-12-15 02:12:20 +000084@item Spitz, Akita, Borzoi, Terrier and Tosa PDAs (PXA270 processor)
pbrook9ee6e8b2007-11-11 00:04:49 +000085@item Luminary Micro LM3S811EVB (ARM Cortex-M3)
86@item Luminary Micro LM3S6965EVB (ARM Cortex-M3)
pbrook707e0112007-06-04 00:50:06 +000087@item Freescale MCF5208EVB (ColdFire V2).
pbrook209a4e62007-05-23 20:16:15 +000088@item Arnewsh MCF5206 evaluation board (ColdFire V2).
balrog02645922007-11-03 12:50:46 +000089@item Palm Tungsten|E PDA (OMAP310 processor)
balrogc30bb262008-05-18 13:01:40 +000090@item N800 and N810 tablets (OMAP2420 processor)
balrog57cd6e92008-05-07 12:23:32 +000091@item MusicPal (MV88W8618 ARM processor)
balrogef4c3852008-12-15 02:12:20 +000092@item Gumstix "Connex" and "Verdex" motherboards (PXA255/270).
93@item Siemens SX1 smartphone (OMAP310 processor)
Paul Brook4af39612009-05-14 23:11:09 +010094@item Syborg SVP base model (ARM Cortex-A8).
Edgar E. Iglesias48c50a62009-05-27 01:34:02 +020095@item AXIS-Devboard88 (CRISv32 ETRAX-FS).
96@item Petalogix Spartan 3aDSP1800 MMU ref design (MicroBlaze).
bellard52c00a52004-04-25 21:27:03 +000097@end itemize
bellard386405f2003-03-23 21:28:45 +000098
Edgar E. Iglesias48c50a62009-05-27 01:34:02 +020099For user emulation, x86, PowerPC, ARM, 32-bit MIPS, Sparc32/64, ColdFire(m68k), CRISv32 and MicroBlaze CPUs are supported.
bellard0806e3f2003-10-01 00:15:32 +0000100
bellarddebc7062006-04-30 21:58:41 +0000101@node Installation
bellard5b9f4572003-10-28 00:49:54 +0000102@chapter Installation
103
bellard15a34c62004-07-08 21:26:26 +0000104If you want to compile QEMU yourself, see @ref{compilation}.
105
bellarddebc7062006-04-30 21:58:41 +0000106@menu
107* install_linux:: Linux
108* install_windows:: Windows
109* install_mac:: Macintosh
110@end menu
111
112@node install_linux
bellard1f673132004-04-04 15:21:17 +0000113@section Linux
114
bellard7c3fc842005-02-10 21:46:47 +0000115If a precompiled package is available for your distribution - you just
116have to install it. Otherwise, see @ref{compilation}.
bellard5b9f4572003-10-28 00:49:54 +0000117
bellarddebc7062006-04-30 21:58:41 +0000118@node install_windows
bellard1f673132004-04-04 15:21:17 +0000119@section Windows
bellard8cd0ac22004-05-12 19:09:16 +0000120
bellard15a34c62004-07-08 21:26:26 +0000121Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000122@url{http://www.free.oszoo.org/@/download.html}.
bellardd691f662003-03-24 21:58:34 +0000123
bellarddebc7062006-04-30 21:58:41 +0000124@node install_mac
bellard1f673132004-04-04 15:21:17 +0000125@section Mac OS X
bellardd691f662003-03-24 21:58:34 +0000126
bellard15a34c62004-07-08 21:26:26 +0000127Download the experimental binary installer at
bellarddebc7062006-04-30 21:58:41 +0000128@url{http://www.free.oszoo.org/@/download.html}.
bellarddf0f11a2003-05-28 00:27:57 +0000129
bellarddebc7062006-04-30 21:58:41 +0000130@node QEMU PC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +0000131@chapter QEMU PC System emulator
bellard1eb20522003-06-25 16:21:49 +0000132
bellarddebc7062006-04-30 21:58:41 +0000133@menu
134* pcsys_introduction:: Introduction
135* pcsys_quickstart:: Quick Start
136* sec_invocation:: Invocation
137* pcsys_keys:: Keys
138* pcsys_monitor:: QEMU Monitor
139* disk_images:: Disk Images
140* pcsys_network:: Network emulation
141* direct_linux_boot:: Direct Linux Boot
142* pcsys_usb:: USB emulation
thsf858dca2007-08-25 01:40:37 +0000143* vnc_security:: VNC security
bellarddebc7062006-04-30 21:58:41 +0000144* gdb_usage:: GDB usage
145* pcsys_os_specific:: Target OS specific information
146@end menu
147
148@node pcsys_introduction
bellard0806e3f2003-10-01 00:15:32 +0000149@section Introduction
150
151@c man begin DESCRIPTION
152
bellard3f9f3aa2005-12-18 20:11:37 +0000153The QEMU PC System emulator simulates the
154following peripherals:
bellard0806e3f2003-10-01 00:15:32 +0000155
156@itemize @minus
ths5fafdf22007-09-16 21:08:06 +0000157@item
bellard15a34c62004-07-08 21:26:26 +0000158i440FX host PCI bridge and PIIX3 PCI to ISA bridge
bellard0806e3f2003-10-01 00:15:32 +0000159@item
bellard15a34c62004-07-08 21:26:26 +0000160Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
161extensions (hardware level, including all non standard modes).
bellard0806e3f2003-10-01 00:15:32 +0000162@item
163PS/2 mouse and keyboard
ths5fafdf22007-09-16 21:08:06 +0000164@item
bellard15a34c62004-07-08 21:26:26 +00001652 PCI IDE interfaces with hard disk and CD-ROM support
bellard1f673132004-04-04 15:21:17 +0000166@item
167Floppy disk
ths5fafdf22007-09-16 21:08:06 +0000168@item
Stefan Weil3a2eeac2009-06-06 18:05:58 +0200169PCI and ISA network adapters
bellard0806e3f2003-10-01 00:15:32 +0000170@item
bellard05d58182004-08-24 21:12:04 +0000171Serial ports
172@item
bellardc0fe3822005-11-05 18:55:28 +0000173Creative SoundBlaster 16 sound card
174@item
175ENSONIQ AudioPCI ES1370 sound card
176@item
balroge5c9a132008-01-14 04:27:55 +0000177Intel 82801AA AC97 Audio compatible sound card
178@item
bellardc0fe3822005-11-05 18:55:28 +0000179Adlib(OPL2) - Yamaha YM3812 compatible chip
bellardb389dbf2005-11-06 16:49:55 +0000180@item
balrog26463db2008-01-17 21:47:25 +0000181Gravis Ultrasound GF1 sound card
182@item
malccc53d262008-06-13 10:48:22 +0000183CS4231A compatible sound card
184@item
bellardb389dbf2005-11-06 16:49:55 +0000185PCI UHCI USB controller and a virtual USB hub.
bellard0806e3f2003-10-01 00:15:32 +0000186@end itemize
187
bellard3f9f3aa2005-12-18 20:11:37 +0000188SMP is supported with up to 255 CPUs.
189
malc1d1f8c32009-01-09 10:46:37 +0000190Note that adlib, gus and cs4231a are only available when QEMU was
191configured with --audio-card-list option containing the name(s) of
malce5178e82008-06-28 19:13:02 +0000192required card(s).
bellardc0fe3822005-11-05 18:55:28 +0000193
bellard15a34c62004-07-08 21:26:26 +0000194QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
195VGA BIOS.
196
bellardc0fe3822005-11-05 18:55:28 +0000197QEMU uses YM3812 emulation by Tatsuyuki Satoh.
198
balrog26463db2008-01-17 21:47:25 +0000199QEMU uses GUS emulation(GUSEMU32 @url{http://www.deinmeister.de/gusemu/})
200by Tibor "TS" Schütz.
balrog423d65f2008-01-14 22:09:11 +0000201
malc720036a2009-09-10 20:05:59 +0400202Not that, by default, GUS shares IRQ(7) with parallel ports and so
203qemu must be told to not have parallel ports to have working GUS
204
205@example
206qemu dos.img -soundhw gus -parallel none
207@end example
208
209Alternatively:
210@example
211qemu dos.img -device gus,irq=5
212@end example
213
214Or some other unclaimed IRQ.
215
malccc53d262008-06-13 10:48:22 +0000216CS4231A is the chip used in Windows Sound System and GUSMAX products
217
bellard0806e3f2003-10-01 00:15:32 +0000218@c man end
219
bellarddebc7062006-04-30 21:58:41 +0000220@node pcsys_quickstart
bellard1eb20522003-06-25 16:21:49 +0000221@section Quick Start
222
bellard285dc332003-10-27 23:58:04 +0000223Download and uncompress the linux image (@file{linux.img}) and type:
bellard0806e3f2003-10-01 00:15:32 +0000224
225@example
bellard285dc332003-10-27 23:58:04 +0000226qemu linux.img
bellard0806e3f2003-10-01 00:15:32 +0000227@end example
228
229Linux should boot and give you a prompt.
230
bellard6cc721c2005-07-28 22:27:28 +0000231@node sec_invocation
bellard1f673132004-04-04 15:21:17 +0000232@section Invocation
233
234@example
235@c man begin SYNOPSIS
ths89dfe892007-11-21 22:38:37 +0000236usage: qemu [options] [@var{disk_image}]
bellard1f673132004-04-04 15:21:17 +0000237@c man end
238@end example
239
240@c man begin OPTIONS
blueswir1d2c639d2009-01-24 18:19:25 +0000241@var{disk_image} is a raw hard disk image for IDE hard disk 0. Some
242targets do not need a disk image.
bellard1f673132004-04-04 15:21:17 +0000243
blueswir15824d652009-03-28 06:44:27 +0000244@include qemu-options.texi
bellard1f673132004-04-04 15:21:17 +0000245
bellard3e11db92004-07-14 17:47:14 +0000246@c man end
247
bellarddebc7062006-04-30 21:58:41 +0000248@node pcsys_keys
bellard3e11db92004-07-14 17:47:14 +0000249@section Keys
250
251@c man begin OPTIONS
252
bellarda1b74fe2004-05-08 13:26:35 +0000253During the graphical emulation, you can use the following keys:
254@table @key
bellardf9859312004-10-03 14:33:10 +0000255@item Ctrl-Alt-f
bellarda1b74fe2004-05-08 13:26:35 +0000256Toggle full screen
bellarda0a821a2004-07-14 17:38:57 +0000257
malcc4a735f2009-09-10 05:15:07 +0400258@item Ctrl-Alt-u
259Restore the screen's un-scaled dimensions
260
bellardf9859312004-10-03 14:33:10 +0000261@item Ctrl-Alt-n
bellarda0a821a2004-07-14 17:38:57 +0000262Switch to virtual console 'n'. Standard console mappings are:
263@table @emph
264@item 1
265Target system display
266@item 2
267Monitor
268@item 3
269Serial port
bellarda1b74fe2004-05-08 13:26:35 +0000270@end table
271
bellardf9859312004-10-03 14:33:10 +0000272@item Ctrl-Alt
bellarda0a821a2004-07-14 17:38:57 +0000273Toggle mouse and keyboard grab.
274@end table
275
bellard3e11db92004-07-14 17:47:14 +0000276In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
277@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
278
bellarda0a821a2004-07-14 17:38:57 +0000279During emulation, if you are using the @option{-nographic} option, use
280@key{Ctrl-a h} to get terminal commands:
bellard1f673132004-04-04 15:21:17 +0000281
282@table @key
bellarda1b74fe2004-05-08 13:26:35 +0000283@item Ctrl-a h
blueswir1d2c639d2009-01-24 18:19:25 +0000284@item Ctrl-a ?
bellard1f673132004-04-04 15:21:17 +0000285Print this help
ths3b46e622007-09-17 08:09:54 +0000286@item Ctrl-a x
ths366dfc52006-12-11 18:35:08 +0000287Exit emulator
ths3b46e622007-09-17 08:09:54 +0000288@item Ctrl-a s
bellard1f673132004-04-04 15:21:17 +0000289Save disk data back to file (if -snapshot)
ths20d8a3e2007-02-18 17:04:49 +0000290@item Ctrl-a t
blueswir1d2c639d2009-01-24 18:19:25 +0000291Toggle console timestamps
bellarda1b74fe2004-05-08 13:26:35 +0000292@item Ctrl-a b
bellard1f673132004-04-04 15:21:17 +0000293Send break (magic sysrq in Linux)
bellarda1b74fe2004-05-08 13:26:35 +0000294@item Ctrl-a c
bellard1f673132004-04-04 15:21:17 +0000295Switch between console and monitor
bellarda1b74fe2004-05-08 13:26:35 +0000296@item Ctrl-a Ctrl-a
297Send Ctrl-a
bellard1f673132004-04-04 15:21:17 +0000298@end table
299@c man end
300
301@ignore
302
bellard1f673132004-04-04 15:21:17 +0000303@c man begin SEEALSO
304The HTML documentation of QEMU for more precise information and Linux
305user mode emulator invocation.
306@c man end
307
308@c man begin AUTHOR
309Fabrice Bellard
310@c man end
311
312@end ignore
313
bellarddebc7062006-04-30 21:58:41 +0000314@node pcsys_monitor
bellard1f673132004-04-04 15:21:17 +0000315@section QEMU Monitor
316
317The QEMU monitor is used to give complex commands to the QEMU
318emulator. You can use it to:
319
320@itemize @minus
321
322@item
thse5987522007-03-30 18:58:01 +0000323Remove or insert removable media images
ths89dfe892007-11-21 22:38:37 +0000324(such as CD-ROM or floppies).
bellard1f673132004-04-04 15:21:17 +0000325
ths5fafdf22007-09-16 21:08:06 +0000326@item
bellard1f673132004-04-04 15:21:17 +0000327Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
328from a disk file.
329
330@item Inspect the VM state without an external debugger.
331
332@end itemize
333
334@subsection Commands
335
336The following commands are available:
337
Blue Swirl23130862009-06-06 08:22:04 +0000338@include qemu-monitor.texi
bellard1f673132004-04-04 15:21:17 +0000339
340@subsection Integer expressions
341
342The monitor understands integers expressions for every integer
343argument. You can use register names to get the value of specifics
344CPU registers by prefixing them with @emph{$}.
345
346@node disk_images
347@section Disk Images
348
bellardacd935e2004-11-15 22:57:26 +0000349Since version 0.6.1, QEMU supports many disk image formats, including
350growable disk images (their size increase as non empty sectors are
bellard13a2e802006-08-06 14:50:31 +0000351written), compressed and encrypted disk images. Version 0.8.3 added
352the new qcow2 disk image format which is essential to support VM
353snapshots.
bellard1f673132004-04-04 15:21:17 +0000354
bellarddebc7062006-04-30 21:58:41 +0000355@menu
356* disk_images_quickstart:: Quick start for disk image creation
357* disk_images_snapshot_mode:: Snapshot mode
bellard13a2e802006-08-06 14:50:31 +0000358* vm_snapshots:: VM snapshots
bellarddebc7062006-04-30 21:58:41 +0000359* qemu_img_invocation:: qemu-img Invocation
ths975b0922008-07-02 21:18:00 +0000360* qemu_nbd_invocation:: qemu-nbd Invocation
bellard19cb3732006-08-19 11:45:59 +0000361* host_drives:: Using host drives
bellarddebc7062006-04-30 21:58:41 +0000362* disk_images_fat_images:: Virtual FAT disk images
ths75818252008-07-03 13:41:03 +0000363* disk_images_nbd:: NBD access
bellarddebc7062006-04-30 21:58:41 +0000364@end menu
365
366@node disk_images_quickstart
bellardacd935e2004-11-15 22:57:26 +0000367@subsection Quick start for disk image creation
368
369You can create a disk image with the command:
bellard1f673132004-04-04 15:21:17 +0000370@example
bellardacd935e2004-11-15 22:57:26 +0000371qemu-img create myimage.img mysize
bellard1f673132004-04-04 15:21:17 +0000372@end example
bellardacd935e2004-11-15 22:57:26 +0000373where @var{myimage.img} is the disk image filename and @var{mysize} is its
374size in kilobytes. You can add an @code{M} suffix to give the size in
375megabytes and a @code{G} suffix for gigabytes.
376
bellarddebc7062006-04-30 21:58:41 +0000377See @ref{qemu_img_invocation} for more information.
bellard1f673132004-04-04 15:21:17 +0000378
bellarddebc7062006-04-30 21:58:41 +0000379@node disk_images_snapshot_mode
bellard1f673132004-04-04 15:21:17 +0000380@subsection Snapshot mode
381
382If you use the option @option{-snapshot}, all disk images are
383considered as read only. When sectors in written, they are written in
384a temporary file created in @file{/tmp}. You can however force the
bellardacd935e2004-11-15 22:57:26 +0000385write back to the raw disk images by using the @code{commit} monitor
386command (or @key{C-a s} in the serial console).
bellard1f673132004-04-04 15:21:17 +0000387
bellard13a2e802006-08-06 14:50:31 +0000388@node vm_snapshots
389@subsection VM snapshots
390
391VM snapshots are snapshots of the complete virtual machine including
392CPU state, RAM, device state and the content of all the writable
393disks. In order to use VM snapshots, you must have at least one non
394removable and writable block device using the @code{qcow2} disk image
395format. Normally this device is the first virtual hard drive.
396
397Use the monitor command @code{savevm} to create a new VM snapshot or
398replace an existing one. A human readable name can be assigned to each
bellard19d36792006-08-07 21:34:34 +0000399snapshot in addition to its numerical ID.
bellard13a2e802006-08-06 14:50:31 +0000400
401Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
402a VM snapshot. @code{info snapshots} lists the available snapshots
403with their associated information:
404
405@example
406(qemu) info snapshots
407Snapshot devices: hda
408Snapshot list (from hda):
409ID TAG VM SIZE DATE VM CLOCK
4101 start 41M 2006-08-06 12:38:02 00:00:14.954
4112 40M 2006-08-06 12:43:29 00:00:18.633
4123 msys 40M 2006-08-06 12:44:04 00:00:23.514
413@end example
414
415A VM snapshot is made of a VM state info (its size is shown in
416@code{info snapshots}) and a snapshot of every writable disk image.
417The VM state info is stored in the first @code{qcow2} non removable
418and writable block device. The disk image snapshots are stored in
419every disk image. The size of a snapshot in a disk image is difficult
420to evaluate and is not shown by @code{info snapshots} because the
421associated disk sectors are shared among all the snapshots to save
bellard19d36792006-08-07 21:34:34 +0000422disk space (otherwise each snapshot would need a full copy of all the
423disk images).
bellard13a2e802006-08-06 14:50:31 +0000424
425When using the (unrelated) @code{-snapshot} option
426(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
427but they are deleted as soon as you exit QEMU.
428
429VM snapshots currently have the following known limitations:
430@itemize
ths5fafdf22007-09-16 21:08:06 +0000431@item
bellard13a2e802006-08-06 14:50:31 +0000432They cannot cope with removable devices if they are removed or
433inserted after a snapshot is done.
ths5fafdf22007-09-16 21:08:06 +0000434@item
bellard13a2e802006-08-06 14:50:31 +0000435A few device drivers still have incomplete snapshot support so their
436state is not saved or restored properly (in particular USB).
437@end itemize
438
bellardacd935e2004-11-15 22:57:26 +0000439@node qemu_img_invocation
440@subsection @code{qemu-img} Invocation
bellard1f673132004-04-04 15:21:17 +0000441
bellardacd935e2004-11-15 22:57:26 +0000442@include qemu-img.texi
bellard05efe462004-06-16 20:34:33 +0000443
ths975b0922008-07-02 21:18:00 +0000444@node qemu_nbd_invocation
445@subsection @code{qemu-nbd} Invocation
446
447@include qemu-nbd.texi
448
bellard19cb3732006-08-19 11:45:59 +0000449@node host_drives
450@subsection Using host drives
451
452In addition to disk image files, QEMU can directly access host
453devices. We describe here the usage for QEMU version >= 0.8.3.
454
455@subsubsection Linux
456
457On Linux, you can directly use the host device filename instead of a
ths4be456f2007-06-03 13:41:28 +0000458disk image filename provided you have enough privileges to access
bellard19cb3732006-08-19 11:45:59 +0000459it. For example, use @file{/dev/cdrom} to access to the CDROM or
460@file{/dev/fd0} for the floppy.
461
bellardf5420862006-08-21 20:26:44 +0000462@table @code
bellard19cb3732006-08-19 11:45:59 +0000463@item CD
464You can specify a CDROM device even if no CDROM is loaded. QEMU has
465specific code to detect CDROM insertion or removal. CDROM ejection by
466the guest OS is supported. Currently only data CDs are supported.
467@item Floppy
468You can specify a floppy device even if no floppy is loaded. Floppy
469removal is currently not detected accurately (if you change floppy
470without doing floppy access while the floppy is not loaded, the guest
471OS will think that the same floppy is loaded).
472@item Hard disks
473Hard disks can be used. Normally you must specify the whole disk
474(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
475see it as a partitioned disk. WARNING: unless you know what you do, it
476is better to only make READ-ONLY accesses to the hard disk otherwise
477you may corrupt your host data (use the @option{-snapshot} command
478line option or modify the device permissions accordingly).
479@end table
480
481@subsubsection Windows
482
bellard01781962007-01-07 22:43:30 +0000483@table @code
484@item CD
ths4be456f2007-06-03 13:41:28 +0000485The preferred syntax is the drive letter (e.g. @file{d:}). The
bellard01781962007-01-07 22:43:30 +0000486alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
487supported as an alias to the first CDROM drive.
bellard19cb3732006-08-19 11:45:59 +0000488
thse5987522007-03-30 18:58:01 +0000489Currently there is no specific code to handle removable media, so it
bellard19cb3732006-08-19 11:45:59 +0000490is better to use the @code{change} or @code{eject} monitor commands to
491change or eject media.
bellard01781962007-01-07 22:43:30 +0000492@item Hard disks
ths89dfe892007-11-21 22:38:37 +0000493Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
bellard01781962007-01-07 22:43:30 +0000494where @var{N} is the drive number (0 is the first hard disk).
495
496WARNING: unless you know what you do, it is better to only make
497READ-ONLY accesses to the hard disk otherwise you may corrupt your
498host data (use the @option{-snapshot} command line so that the
499modifications are written in a temporary file).
500@end table
501
bellard19cb3732006-08-19 11:45:59 +0000502
503@subsubsection Mac OS X
504
ths5fafdf22007-09-16 21:08:06 +0000505@file{/dev/cdrom} is an alias to the first CDROM.
bellard19cb3732006-08-19 11:45:59 +0000506
thse5987522007-03-30 18:58:01 +0000507Currently there is no specific code to handle removable media, so it
bellard19cb3732006-08-19 11:45:59 +0000508is better to use the @code{change} or @code{eject} monitor commands to
509change or eject media.
510
bellarddebc7062006-04-30 21:58:41 +0000511@node disk_images_fat_images
bellard2c6cadd2005-12-18 18:31:45 +0000512@subsection Virtual FAT disk images
513
514QEMU can automatically create a virtual FAT disk image from a
515directory tree. In order to use it, just type:
516
ths5fafdf22007-09-16 21:08:06 +0000517@example
bellard2c6cadd2005-12-18 18:31:45 +0000518qemu linux.img -hdb fat:/my_directory
519@end example
520
521Then you access access to all the files in the @file{/my_directory}
522directory without having to copy them in a disk image or to export
523them via SAMBA or NFS. The default access is @emph{read-only}.
524
525Floppies can be emulated with the @code{:floppy:} option:
526
ths5fafdf22007-09-16 21:08:06 +0000527@example
bellard2c6cadd2005-12-18 18:31:45 +0000528qemu linux.img -fda fat:floppy:/my_directory
529@end example
530
531A read/write support is available for testing (beta stage) with the
532@code{:rw:} option:
533
ths5fafdf22007-09-16 21:08:06 +0000534@example
bellard2c6cadd2005-12-18 18:31:45 +0000535qemu linux.img -fda fat:floppy:rw:/my_directory
536@end example
537
538What you should @emph{never} do:
539@itemize
540@item use non-ASCII filenames ;
541@item use "-snapshot" together with ":rw:" ;
bellard85b2c682005-12-19 22:12:34 +0000542@item expect it to work when loadvm'ing ;
543@item write to the FAT directory on the host system while accessing it with the guest system.
bellard2c6cadd2005-12-18 18:31:45 +0000544@end itemize
545
ths75818252008-07-03 13:41:03 +0000546@node disk_images_nbd
547@subsection NBD access
548
549QEMU can access directly to block device exported using the Network Block Device
550protocol.
551
552@example
553qemu linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
554@end example
555
556If the NBD server is located on the same host, you can use an unix socket instead
557of an inet socket:
558
559@example
560qemu linux.img -hdb nbd:unix:/tmp/my_socket
561@end example
562
563In this case, the block device must be exported using qemu-nbd:
564
565@example
566qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
567@end example
568
569The use of qemu-nbd allows to share a disk between several guests:
570@example
571qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
572@end example
573
574and then you can use it with two guests:
575@example
576qemu linux1.img -hdb nbd:unix:/tmp/my_socket
577qemu linux2.img -hdb nbd:unix:/tmp/my_socket
578@end example
579
bellarddebc7062006-04-30 21:58:41 +0000580@node pcsys_network
bellard9d4fb822004-04-26 20:55:38 +0000581@section Network emulation
582
ths4be456f2007-06-03 13:41:28 +0000583QEMU can simulate several network cards (PCI or ISA cards on the PC
bellard41d03942005-11-15 23:02:53 +0000584target) and can connect them to an arbitrary number of Virtual Local
585Area Networks (VLANs). Host TAP devices can be connected to any QEMU
586VLAN. VLAN can be connected between separate instances of QEMU to
ths4be456f2007-06-03 13:41:28 +0000587simulate large networks. For simpler usage, a non privileged user mode
bellard41d03942005-11-15 23:02:53 +0000588network stack can replace the TAP device to have a basic network
589connection.
bellard9d4fb822004-04-26 20:55:38 +0000590
bellard41d03942005-11-15 23:02:53 +0000591@subsection VLANs
bellard9d4fb822004-04-26 20:55:38 +0000592
bellard41d03942005-11-15 23:02:53 +0000593QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
594connection between several network devices. These devices can be for
595example QEMU virtual Ethernet cards or virtual Host ethernet devices
596(TAP devices).
597
598@subsection Using TAP network interfaces
599
600This is the standard way to connect QEMU to a real network. QEMU adds
601a virtual network device on your host (called @code{tapN}), and you
602can then configure it as if it was a real ethernet card.
bellard9d4fb822004-04-26 20:55:38 +0000603
bellard8f40c382006-09-20 20:28:05 +0000604@subsubsection Linux host
605
bellard9d4fb822004-04-26 20:55:38 +0000606As an example, you can download the @file{linux-test-xxx.tar.gz}
607archive and copy the script @file{qemu-ifup} in @file{/etc} and
608configure properly @code{sudo} so that the command @code{ifconfig}
609contained in @file{qemu-ifup} can be executed as root. You must verify
bellard41d03942005-11-15 23:02:53 +0000610that your host kernel supports the TAP network interfaces: the
bellard9d4fb822004-04-26 20:55:38 +0000611device @file{/dev/net/tun} must be present.
612
bellardee0f4752006-08-19 16:56:18 +0000613See @ref{sec_invocation} to have examples of command lines using the
614TAP network interfaces.
bellard9d4fb822004-04-26 20:55:38 +0000615
bellard8f40c382006-09-20 20:28:05 +0000616@subsubsection Windows host
617
618There is a virtual ethernet driver for Windows 2000/XP systems, called
619TAP-Win32. But it is not included in standard QEMU for Windows,
620so you will need to get it separately. It is part of OpenVPN package,
621so download OpenVPN from : @url{http://openvpn.net/}.
622
bellard9d4fb822004-04-26 20:55:38 +0000623@subsection Using the user mode network stack
624
bellard41d03942005-11-15 23:02:53 +0000625By using the option @option{-net user} (default configuration if no
626@option{-net} option is specified), QEMU uses a completely user mode
ths4be456f2007-06-03 13:41:28 +0000627network stack (you don't need root privilege to use the virtual
bellard41d03942005-11-15 23:02:53 +0000628network). The virtual network configuration is the following:
bellard9d4fb822004-04-26 20:55:38 +0000629
630@example
631
bellard41d03942005-11-15 23:02:53 +0000632 QEMU VLAN <------> Firewall/DHCP server <-----> Internet
633 | (10.0.2.2)
bellard9d4fb822004-04-26 20:55:38 +0000634 |
bellard2518bd02004-09-30 22:35:13 +0000635 ----> DNS server (10.0.2.3)
ths3b46e622007-09-17 08:09:54 +0000636 |
bellard2518bd02004-09-30 22:35:13 +0000637 ----> SMB server (10.0.2.4)
bellard9d4fb822004-04-26 20:55:38 +0000638@end example
639
640The QEMU VM behaves as if it was behind a firewall which blocks all
641incoming connections. You can use a DHCP client to automatically
bellard41d03942005-11-15 23:02:53 +0000642configure the network in the QEMU VM. The DHCP server assign addresses
643to the hosts starting from 10.0.2.15.
bellard9d4fb822004-04-26 20:55:38 +0000644
645In order to check that the user mode network is working, you can ping
646the address 10.0.2.2 and verify that you got an address in the range
64710.0.2.x from the QEMU virtual DHCP server.
648
bellardb415a402004-05-23 21:04:06 +0000649Note that @code{ping} is not supported reliably to the internet as it
ths4be456f2007-06-03 13:41:28 +0000650would require root privileges. It means you can only ping the local
bellardb415a402004-05-23 21:04:06 +0000651router (10.0.2.2).
652
bellard9bf05442004-08-25 22:12:49 +0000653When using the built-in TFTP server, the router is also the TFTP
654server.
655
656When using the @option{-redir} option, TCP or UDP connections can be
657redirected from the host to the guest. It allows for example to
658redirect X11, telnet or SSH connections.
bellard443f1372004-06-04 11:13:20 +0000659
bellard41d03942005-11-15 23:02:53 +0000660@subsection Connecting VLANs between QEMU instances
661
662Using the @option{-net socket} option, it is possible to make VLANs
663that span several QEMU instances. See @ref{sec_invocation} to have a
664basic example.
665
bellard9d4fb822004-04-26 20:55:38 +0000666@node direct_linux_boot
667@section Direct Linux Boot
bellard0806e3f2003-10-01 00:15:32 +0000668
669This section explains how to launch a Linux kernel inside QEMU without
670having to make a full bootable image. It is very useful for fast Linux
bellardee0f4752006-08-19 16:56:18 +0000671kernel testing.
bellard1eb20522003-06-25 16:21:49 +0000672
bellardee0f4752006-08-19 16:56:18 +0000673The syntax is:
bellard1eb20522003-06-25 16:21:49 +0000674@example
bellardee0f4752006-08-19 16:56:18 +0000675qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
bellard1eb20522003-06-25 16:21:49 +0000676@end example
677
bellardee0f4752006-08-19 16:56:18 +0000678Use @option{-kernel} to provide the Linux kernel image and
679@option{-append} to give the kernel command line arguments. The
680@option{-initrd} option can be used to provide an INITRD image.
681
682When using the direct Linux boot, a disk image for the first hard disk
683@file{hda} is required because its boot sector is used to launch the
684Linux kernel.
685
686If you do not need graphical output, you can disable it and redirect
687the virtual serial port and the QEMU monitor to the console with the
688@option{-nographic} option. The typical command line is:
bellard1eb20522003-06-25 16:21:49 +0000689@example
bellardee0f4752006-08-19 16:56:18 +0000690qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
691 -append "root=/dev/hda console=ttyS0" -nographic
bellard1eb20522003-06-25 16:21:49 +0000692@end example
693
bellardee0f4752006-08-19 16:56:18 +0000694Use @key{Ctrl-a c} to switch between the serial console and the
695monitor (@pxref{pcsys_keys}).
bellardd5a0b502003-06-27 12:02:03 +0000696
bellarddebc7062006-04-30 21:58:41 +0000697@node pcsys_usb
bellardb389dbf2005-11-06 16:49:55 +0000698@section USB emulation
699
pbrook0aff66b2006-05-26 00:49:52 +0000700QEMU emulates a PCI UHCI USB controller. You can virtually plug
701virtual USB devices or real host USB devices (experimental, works only
702on Linux hosts). Qemu will automatically create and connect virtual USB hubs
bellardf5420862006-08-21 20:26:44 +0000703as necessary to connect multiple USB devices.
bellardb389dbf2005-11-06 16:49:55 +0000704
pbrook0aff66b2006-05-26 00:49:52 +0000705@menu
706* usb_devices::
707* host_usb_devices::
708@end menu
709@node usb_devices
710@subsection Connecting USB devices
bellardb389dbf2005-11-06 16:49:55 +0000711
pbrook0aff66b2006-05-26 00:49:52 +0000712USB devices can be connected with the @option{-usbdevice} commandline option
713or the @code{usb_add} monitor command. Available devices are:
bellardb389dbf2005-11-06 16:49:55 +0000714
balrogdb380c02008-01-17 22:22:45 +0000715@table @code
716@item mouse
pbrook0aff66b2006-05-26 00:49:52 +0000717Virtual Mouse. This will override the PS/2 mouse emulation when activated.
balrogdb380c02008-01-17 22:22:45 +0000718@item tablet
bellardc6d46c22006-09-03 17:10:41 +0000719Pointer device that uses absolute coordinates (like a touchscreen).
pbrook0aff66b2006-05-26 00:49:52 +0000720This means qemu is able to report the mouse position without having
721to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
balrogdb380c02008-01-17 22:22:45 +0000722@item disk:@var{file}
pbrook0aff66b2006-05-26 00:49:52 +0000723Mass storage device based on @var{file} (@pxref{disk_images})
balrogdb380c02008-01-17 22:22:45 +0000724@item host:@var{bus.addr}
pbrook0aff66b2006-05-26 00:49:52 +0000725Pass through the host device identified by @var{bus.addr}
726(Linux only)
balrogdb380c02008-01-17 22:22:45 +0000727@item host:@var{vendor_id:product_id}
pbrook0aff66b2006-05-26 00:49:52 +0000728Pass through the host device identified by @var{vendor_id:product_id}
729(Linux only)
balrogdb380c02008-01-17 22:22:45 +0000730@item wacom-tablet
balrogf6d2a312007-06-10 19:21:04 +0000731Virtual Wacom PenPartner tablet. This device is similar to the @code{tablet}
732above but it can be used with the tslib library because in addition to touch
733coordinates it reports touch pressure.
balrogdb380c02008-01-17 22:22:45 +0000734@item keyboard
balrog47b2d332007-06-22 08:16:00 +0000735Standard USB keyboard. Will override the PS/2 keyboard (if present).
balrogdb380c02008-01-17 22:22:45 +0000736@item serial:[vendorid=@var{vendor_id}][,product_id=@var{product_id}]:@var{dev}
737Serial converter. This emulates an FTDI FT232BM chip connected to host character
738device @var{dev}. The available character devices are the same as for the
739@code{-serial} option. The @code{vendorid} and @code{productid} options can be
balroga11d0702008-01-19 13:00:43 +0000740used to override the default 0403:6001. For instance,
balrogdb380c02008-01-17 22:22:45 +0000741@example
742usb_add serial:productid=FA00:tcp:192.168.0.2:4444
743@end example
744will connect to tcp port 4444 of ip 192.168.0.2, and plug that to the virtual
745serial converter, faking a Matrix Orbital LCD Display (USB ID 0403:FA00).
aurel322e4d9fb2008-04-08 06:01:02 +0000746@item braille
747Braille device. This will use BrlAPI to display the braille output on a real
748or fake device.
balrog9ad97e62008-07-29 13:16:31 +0000749@item net:@var{options}
750Network adapter that supports CDC ethernet and RNDIS protocols. @var{options}
751specifies NIC options as with @code{-net nic,}@var{options} (see description).
752For instance, user-mode networking can be used with
balrog6c9f8862008-07-17 20:47:13 +0000753@example
balrog9ad97e62008-07-29 13:16:31 +0000754qemu [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0
balrog6c9f8862008-07-17 20:47:13 +0000755@end example
756Currently this cannot be used in machines that support PCI NICs.
balrog2d564692008-11-09 02:24:54 +0000757@item bt[:@var{hci-type}]
758Bluetooth dongle whose type is specified in the same format as with
759the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If
760no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
761This USB device implements the USB Transport Layer of HCI. Example
762usage:
763@example
764qemu [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3
765@end example
pbrook0aff66b2006-05-26 00:49:52 +0000766@end table
bellardb389dbf2005-11-06 16:49:55 +0000767
pbrook0aff66b2006-05-26 00:49:52 +0000768@node host_usb_devices
bellardb389dbf2005-11-06 16:49:55 +0000769@subsection Using host USB devices on a Linux host
770
771WARNING: this is an experimental feature. QEMU will slow down when
772using it. USB devices requiring real time streaming (i.e. USB Video
773Cameras) are not supported yet.
774
775@enumerate
ths5fafdf22007-09-16 21:08:06 +0000776@item If you use an early Linux 2.4 kernel, verify that no Linux driver
bellardb389dbf2005-11-06 16:49:55 +0000777is actually using the USB device. A simple way to do that is simply to
778disable the corresponding kernel module by renaming it from @file{mydriver.o}
779to @file{mydriver.o.disabled}.
780
781@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
782@example
783ls /proc/bus/usb
784001 devices drivers
785@end example
786
787@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:
788@example
789chown -R myuid /proc/bus/usb
790@end example
791
792@item Launch QEMU and do in the monitor:
ths5fafdf22007-09-16 21:08:06 +0000793@example
bellardb389dbf2005-11-06 16:49:55 +0000794info usbhost
795 Device 1.2, speed 480 Mb/s
796 Class 00: USB device 1234:5678, USB DISK
797@end example
798You should see the list of the devices you can use (Never try to use
799hubs, it won't work).
800
801@item Add the device in QEMU by using:
ths5fafdf22007-09-16 21:08:06 +0000802@example
bellardb389dbf2005-11-06 16:49:55 +0000803usb_add host:1234:5678
804@end example
805
806Normally the guest OS should report that a new USB device is
807plugged. You can use the option @option{-usbdevice} to do the same.
808
809@item Now you can try to use the host USB device in QEMU.
810
811@end enumerate
812
813When relaunching QEMU, you may have to unplug and plug again the USB
814device to make it work again (this is a bug).
815
thsf858dca2007-08-25 01:40:37 +0000816@node vnc_security
817@section VNC security
818
819The VNC server capability provides access to the graphical console
820of the guest VM across the network. This has a number of security
821considerations depending on the deployment scenarios.
822
823@menu
824* vnc_sec_none::
825* vnc_sec_password::
826* vnc_sec_certificate::
827* vnc_sec_certificate_verify::
828* vnc_sec_certificate_pw::
aliguori2f9606b2009-03-06 20:27:28 +0000829* vnc_sec_sasl::
830* vnc_sec_certificate_sasl::
thsf858dca2007-08-25 01:40:37 +0000831* vnc_generate_cert::
aliguori2f9606b2009-03-06 20:27:28 +0000832* vnc_setup_sasl::
thsf858dca2007-08-25 01:40:37 +0000833@end menu
834@node vnc_sec_none
835@subsection Without passwords
836
837The simplest VNC server setup does not include any form of authentication.
838For this setup it is recommended to restrict it to listen on a UNIX domain
839socket only. For example
840
841@example
842qemu [...OPTIONS...] -vnc unix:/home/joebloggs/.qemu-myvm-vnc
843@end example
844
845This ensures that only users on local box with read/write access to that
846path can access the VNC server. To securely access the VNC server from a
847remote machine, a combination of netcat+ssh can be used to provide a secure
848tunnel.
849
850@node vnc_sec_password
851@subsection With passwords
852
853The VNC protocol has limited support for password based authentication. Since
854the protocol limits passwords to 8 characters it should not be considered
855to provide high security. The password can be fairly easily brute-forced by
856a client making repeat connections. For this reason, a VNC server using password
857authentication should be restricted to only listen on the loopback interface
blueswir134a3d232008-10-04 20:43:39 +0000858or UNIX domain sockets. Password authentication is requested with the @code{password}
thsf858dca2007-08-25 01:40:37 +0000859option, and then once QEMU is running the password is set with the monitor. Until
860the monitor is used to set the password all clients will be rejected.
861
862@example
863qemu [...OPTIONS...] -vnc :1,password -monitor stdio
864(qemu) change vnc password
865Password: ********
866(qemu)
867@end example
868
869@node vnc_sec_certificate
870@subsection With x509 certificates
871
872The QEMU VNC server also implements the VeNCrypt extension allowing use of
873TLS for encryption of the session, and x509 certificates for authentication.
874The use of x509 certificates is strongly recommended, because TLS on its
875own is susceptible to man-in-the-middle attacks. Basic x509 certificate
876support provides a secure session, but no authentication. This allows any
877client to connect, and provides an encrypted session.
878
879@example
880qemu [...OPTIONS...] -vnc :1,tls,x509=/etc/pki/qemu -monitor stdio
881@end example
882
883In the above example @code{/etc/pki/qemu} should contain at least three files,
884@code{ca-cert.pem}, @code{server-cert.pem} and @code{server-key.pem}. Unprivileged
885users will want to use a private directory, for example @code{$HOME/.pki/qemu}.
886NB the @code{server-key.pem} file should be protected with file mode 0600 to
887only be readable by the user owning it.
888
889@node vnc_sec_certificate_verify
890@subsection With x509 certificates and client verification
891
892Certificates can also provide a means to authenticate the client connecting.
893The server will request that the client provide a certificate, which it will
894then validate against the CA certificate. This is a good choice if deploying
895in an environment with a private internal certificate authority.
896
897@example
898qemu [...OPTIONS...] -vnc :1,tls,x509verify=/etc/pki/qemu -monitor stdio
899@end example
900
901
902@node vnc_sec_certificate_pw
903@subsection With x509 certificates, client verification and passwords
904
905Finally, the previous method can be combined with VNC password authentication
906to provide two layers of authentication for clients.
907
908@example
909qemu [...OPTIONS...] -vnc :1,password,tls,x509verify=/etc/pki/qemu -monitor stdio
910(qemu) change vnc password
911Password: ********
912(qemu)
913@end example
914
aliguori2f9606b2009-03-06 20:27:28 +0000915
916@node vnc_sec_sasl
917@subsection With SASL authentication
918
919The SASL authentication method is a VNC extension, that provides an
920easily extendable, pluggable authentication method. This allows for
921integration with a wide range of authentication mechanisms, such as
922PAM, GSSAPI/Kerberos, LDAP, SQL databases, one-time keys and more.
923The strength of the authentication depends on the exact mechanism
924configured. If the chosen mechanism also provides a SSF layer, then
925it will encrypt the datastream as well.
926
927Refer to the later docs on how to choose the exact SASL mechanism
928used for authentication, but assuming use of one supporting SSF,
929then QEMU can be launched with:
930
931@example
932qemu [...OPTIONS...] -vnc :1,sasl -monitor stdio
933@end example
934
935@node vnc_sec_certificate_sasl
936@subsection With x509 certificates and SASL authentication
937
938If the desired SASL authentication mechanism does not supported
939SSF layers, then it is strongly advised to run it in combination
940with TLS and x509 certificates. This provides securely encrypted
941data stream, avoiding risk of compromising of the security
942credentials. This can be enabled, by combining the 'sasl' option
943with the aforementioned TLS + x509 options:
944
945@example
946qemu [...OPTIONS...] -vnc :1,tls,x509,sasl -monitor stdio
947@end example
948
949
thsf858dca2007-08-25 01:40:37 +0000950@node vnc_generate_cert
951@subsection Generating certificates for VNC
952
953The GNU TLS packages provides a command called @code{certtool} which can
954be used to generate certificates and keys in PEM format. At a minimum it
955is neccessary to setup a certificate authority, and issue certificates to
956each server. If using certificates for authentication, then each client
957will also need to be issued a certificate. The recommendation is for the
958server to keep its certificates in either @code{/etc/pki/qemu} or for
959unprivileged users in @code{$HOME/.pki/qemu}.
960
961@menu
962* vnc_generate_ca::
963* vnc_generate_server::
964* vnc_generate_client::
965@end menu
966@node vnc_generate_ca
967@subsubsection Setup the Certificate Authority
968
969This step only needs to be performed once per organization / organizational
970unit. First the CA needs a private key. This key must be kept VERY secret
971and secure. If this key is compromised the entire trust chain of the certificates
972issued with it is lost.
973
974@example
975# certtool --generate-privkey > ca-key.pem
976@end example
977
978A CA needs to have a public certificate. For simplicity it can be a self-signed
979certificate, or one issue by a commercial certificate issuing authority. To
980generate a self-signed certificate requires one core piece of information, the
981name of the organization.
982
983@example
984# cat > ca.info <<EOF
985cn = Name of your organization
986ca
987cert_signing_key
988EOF
989# certtool --generate-self-signed \
990 --load-privkey ca-key.pem
991 --template ca.info \
992 --outfile ca-cert.pem
993@end example
994
995The @code{ca-cert.pem} file should be copied to all servers and clients wishing to utilize
996TLS support in the VNC server. The @code{ca-key.pem} must not be disclosed/copied at all.
997
998@node vnc_generate_server
999@subsubsection Issuing server certificates
1000
1001Each server (or host) needs to be issued with a key and certificate. When connecting
1002the certificate is sent to the client which validates it against the CA certificate.
1003The core piece of information for a server certificate is the hostname. This should
1004be the fully qualified hostname that the client will connect with, since the client
1005will typically also verify the hostname in the certificate. On the host holding the
1006secure CA private key:
1007
1008@example
1009# cat > server.info <<EOF
1010organization = Name of your organization
1011cn = server.foo.example.com
1012tls_www_server
1013encryption_key
1014signing_key
1015EOF
1016# certtool --generate-privkey > server-key.pem
1017# certtool --generate-certificate \
1018 --load-ca-certificate ca-cert.pem \
1019 --load-ca-privkey ca-key.pem \
1020 --load-privkey server server-key.pem \
1021 --template server.info \
1022 --outfile server-cert.pem
1023@end example
1024
1025The @code{server-key.pem} and @code{server-cert.pem} files should now be securely copied
1026to the server for which they were generated. The @code{server-key.pem} is security
1027sensitive and should be kept protected with file mode 0600 to prevent disclosure.
1028
1029@node vnc_generate_client
1030@subsubsection Issuing client certificates
1031
1032If the QEMU VNC server is to use the @code{x509verify} option to validate client
1033certificates as its authentication mechanism, each client also needs to be issued
1034a certificate. The client certificate contains enough metadata to uniquely identify
1035the client, typically organization, state, city, building, etc. On the host holding
1036the secure CA private key:
1037
1038@example
1039# cat > client.info <<EOF
1040country = GB
1041state = London
1042locality = London
1043organiazation = Name of your organization
1044cn = client.foo.example.com
1045tls_www_client
1046encryption_key
1047signing_key
1048EOF
1049# certtool --generate-privkey > client-key.pem
1050# certtool --generate-certificate \
1051 --load-ca-certificate ca-cert.pem \
1052 --load-ca-privkey ca-key.pem \
1053 --load-privkey client-key.pem \
1054 --template client.info \
1055 --outfile client-cert.pem
1056@end example
1057
1058The @code{client-key.pem} and @code{client-cert.pem} files should now be securely
1059copied to the client for which they were generated.
1060
aliguori2f9606b2009-03-06 20:27:28 +00001061
1062@node vnc_setup_sasl
1063
1064@subsection Configuring SASL mechanisms
1065
1066The following documentation assumes use of the Cyrus SASL implementation on a
1067Linux host, but the principals should apply to any other SASL impl. When SASL
1068is enabled, the mechanism configuration will be loaded from system default
1069SASL service config /etc/sasl2/qemu.conf. If running QEMU as an
1070unprivileged user, an environment variable SASL_CONF_PATH can be used
1071to make it search alternate locations for the service config.
1072
1073The default configuration might contain
1074
1075@example
1076mech_list: digest-md5
1077sasldb_path: /etc/qemu/passwd.db
1078@end example
1079
1080This says to use the 'Digest MD5' mechanism, which is similar to the HTTP
1081Digest-MD5 mechanism. The list of valid usernames & passwords is maintained
1082in the /etc/qemu/passwd.db file, and can be updated using the saslpasswd2
1083command. While this mechanism is easy to configure and use, it is not
1084considered secure by modern standards, so only suitable for developers /
1085ad-hoc testing.
1086
1087A more serious deployment might use Kerberos, which is done with the 'gssapi'
1088mechanism
1089
1090@example
1091mech_list: gssapi
1092keytab: /etc/qemu/krb5.tab
1093@end example
1094
1095For this to work the administrator of your KDC must generate a Kerberos
1096principal for the server, with a name of 'qemu/somehost.example.com@@EXAMPLE.COM'
1097replacing 'somehost.example.com' with the fully qualified host name of the
1098machine running QEMU, and 'EXAMPLE.COM' with the Keberos Realm.
1099
1100Other configurations will be left as an exercise for the reader. It should
1101be noted that only Digest-MD5 and GSSAPI provides a SSF layer for data
1102encryption. For all other mechanisms, VNC should always be configured to
1103use TLS and x509 certificates to protect security credentials from snooping.
1104
bellard0806e3f2003-10-01 00:15:32 +00001105@node gdb_usage
bellardda415d52003-06-27 18:50:50 +00001106@section GDB usage
1107
1108QEMU has a primitive support to work with gdb, so that you can do
bellard0806e3f2003-10-01 00:15:32 +00001109'Ctrl-C' while the virtual machine is running and inspect its state.
bellardda415d52003-06-27 18:50:50 +00001110
bellard9d4520d2003-10-28 01:38:57 +00001111In order to use gdb, launch qemu with the '-s' option. It will wait for a
bellardda415d52003-06-27 18:50:50 +00001112gdb connection:
1113@example
bellarddebc7062006-04-30 21:58:41 +00001114> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1115 -append "root=/dev/hda"
bellardda415d52003-06-27 18:50:50 +00001116Connected to host network interface: tun0
1117Waiting gdb connection on port 1234
1118@end example
1119
1120Then launch gdb on the 'vmlinux' executable:
1121@example
1122> gdb vmlinux
1123@end example
1124
1125In gdb, connect to QEMU:
1126@example
bellard6c9bf892004-01-24 13:46:56 +00001127(gdb) target remote localhost:1234
bellardda415d52003-06-27 18:50:50 +00001128@end example
1129
1130Then you can use gdb normally. For example, type 'c' to launch the kernel:
1131@example
1132(gdb) c
1133@end example
1134
bellard0806e3f2003-10-01 00:15:32 +00001135Here are some useful tips in order to use gdb on system code:
1136
1137@enumerate
1138@item
1139Use @code{info reg} to display all the CPU registers.
1140@item
1141Use @code{x/10i $eip} to display the code at the PC position.
1142@item
1143Use @code{set architecture i8086} to dump 16 bit code. Then use
bellard294e8632006-05-06 14:23:06 +00001144@code{x/10i $cs*16+$eip} to dump the code at the PC position.
bellard0806e3f2003-10-01 00:15:32 +00001145@end enumerate
1146
edgar_igl60897d32008-05-09 08:25:14 +00001147Advanced debugging options:
1148
1149The default single stepping behavior is step with the IRQs and timer service routines off. It is set this way because when gdb executes a single step it expects to advance beyond the current instruction. With the IRQs and and timer service routines on, a single step might jump into the one of the interrupt or exception vectors instead of executing the current instruction. This means you may hit the same breakpoint a number of times before executing the instruction gdb wants to have executed. Because there are rare circumstances where you want to single step into an interrupt vector the behavior can be controlled from GDB. There are three commands you can query and set the single step behavior:
edgar_igl94d45e42008-05-10 19:37:44 +00001150@table @code
edgar_igl60897d32008-05-09 08:25:14 +00001151@item maintenance packet qqemu.sstepbits
1152
1153This will display the MASK bits used to control the single stepping IE:
1154@example
1155(gdb) maintenance packet qqemu.sstepbits
1156sending: "qqemu.sstepbits"
1157received: "ENABLE=1,NOIRQ=2,NOTIMER=4"
1158@end example
1159@item maintenance packet qqemu.sstep
1160
1161This will display the current value of the mask used when single stepping IE:
1162@example
1163(gdb) maintenance packet qqemu.sstep
1164sending: "qqemu.sstep"
1165received: "0x7"
1166@end example
1167@item maintenance packet Qqemu.sstep=HEX_VALUE
1168
1169This will change the single step mask, so if wanted to enable IRQs on the single step, but not timers, you would use:
1170@example
1171(gdb) maintenance packet Qqemu.sstep=0x5
1172sending: "qemu.sstep=0x5"
1173received: "OK"
1174@end example
edgar_igl94d45e42008-05-10 19:37:44 +00001175@end table
edgar_igl60897d32008-05-09 08:25:14 +00001176
bellarddebc7062006-04-30 21:58:41 +00001177@node pcsys_os_specific
bellard1a084f32004-05-13 22:34:49 +00001178@section Target OS specific information
1179
1180@subsection Linux
1181
bellard15a34c62004-07-08 21:26:26 +00001182To have access to SVGA graphic modes under X11, use the @code{vesa} or
1183the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1184color depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001185
bellarde3371e62004-07-10 16:26:02 +00001186When using a 2.6 guest Linux kernel, you should add the option
1187@code{clock=pit} on the kernel command line because the 2.6 Linux
1188kernels make very strict real time clock checks by default that QEMU
1189cannot simulate exactly.
1190
bellard7c3fc842005-02-10 21:46:47 +00001191When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1192not activated because QEMU is slower with this patch. The QEMU
1193Accelerator Module is also much slower in this case. Earlier Fedora
ths4be456f2007-06-03 13:41:28 +00001194Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporate this
bellard7c3fc842005-02-10 21:46:47 +00001195patch by default. Newer kernels don't have it.
1196
bellard1a084f32004-05-13 22:34:49 +00001197@subsection Windows
1198
1199If you have a slow host, using Windows 95 is better as it gives the
1200best speed. Windows 2000 is also a good choice.
1201
bellarde3371e62004-07-10 16:26:02 +00001202@subsubsection SVGA graphic modes support
1203
1204QEMU emulates a Cirrus Logic GD5446 Video
bellard15a34c62004-07-08 21:26:26 +00001205card. All Windows versions starting from Windows 95 should recognize
1206and use this graphic card. For optimal performances, use 16 bit color
1207depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001208
bellard3cb08532006-06-21 21:19:50 +00001209If you are using Windows XP as guest OS and if you want to use high
1210resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
12111280x1024x16), then you should use the VESA VBE virtual graphic card
1212(option @option{-std-vga}).
1213
bellarde3371e62004-07-10 16:26:02 +00001214@subsubsection CPU usage reduction
1215
1216Windows 9x does not correctly use the CPU HLT
bellard15a34c62004-07-08 21:26:26 +00001217instruction. The result is that it takes host CPU cycles even when
1218idle. You can install the utility from
1219@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1220problem. Note that no such tool is needed for NT, 2000 or XP.
bellard1a084f32004-05-13 22:34:49 +00001221
bellard9d0a8e62005-07-03 17:34:05 +00001222@subsubsection Windows 2000 disk full problem
bellarde3371e62004-07-10 16:26:02 +00001223
bellard9d0a8e62005-07-03 17:34:05 +00001224Windows 2000 has a bug which gives a disk full problem during its
1225installation. When installing it, use the @option{-win2k-hack} QEMU
1226option to enable a specific workaround. After Windows 2000 is
1227installed, you no longer need this option (this option slows down the
1228IDE transfers).
bellarde3371e62004-07-10 16:26:02 +00001229
bellard6cc721c2005-07-28 22:27:28 +00001230@subsubsection Windows 2000 shutdown
1231
1232Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1233can. It comes from the fact that Windows 2000 does not automatically
1234use the APM driver provided by the BIOS.
1235
1236In order to correct that, do the following (thanks to Struan
1237Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1238Add/Troubleshoot a device => Add a new device & Next => No, select the
1239hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1240(again) a few times. Now the driver is installed and Windows 2000 now
ths5fafdf22007-09-16 21:08:06 +00001241correctly instructs QEMU to shutdown at the appropriate moment.
bellard6cc721c2005-07-28 22:27:28 +00001242
1243@subsubsection Share a directory between Unix and Windows
1244
1245See @ref{sec_invocation} about the help of the option @option{-smb}.
1246
bellard2192c332006-08-21 20:28:18 +00001247@subsubsection Windows XP security problem
bellarde3371e62004-07-10 16:26:02 +00001248
1249Some releases of Windows XP install correctly but give a security
1250error when booting:
1251@example
1252A problem is preventing Windows from accurately checking the
1253license for this computer. Error code: 0x800703e6.
1254@end example
bellarde3371e62004-07-10 16:26:02 +00001255
bellard2192c332006-08-21 20:28:18 +00001256The workaround is to install a service pack for XP after a boot in safe
1257mode. Then reboot, and the problem should go away. Since there is no
1258network while in safe mode, its recommended to download the full
1259installation of SP1 or SP2 and transfer that via an ISO or using the
1260vvfat block device ("-hdb fat:directory_which_holds_the_SP").
bellarde3371e62004-07-10 16:26:02 +00001261
bellarda0a821a2004-07-14 17:38:57 +00001262@subsection MS-DOS and FreeDOS
1263
1264@subsubsection CPU usage reduction
1265
1266DOS does not correctly use the CPU HLT instruction. The result is that
1267it takes host CPU cycles even when idle. You can install the utility
1268from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1269problem.
1270
bellarddebc7062006-04-30 21:58:41 +00001271@node QEMU System emulator for non PC targets
bellard3f9f3aa2005-12-18 20:11:37 +00001272@chapter QEMU System emulator for non PC targets
1273
1274QEMU is a generic emulator and it emulates many non PC
1275machines. Most of the options are similar to the PC emulator. The
ths4be456f2007-06-03 13:41:28 +00001276differences are mentioned in the following sections.
bellard3f9f3aa2005-12-18 20:11:37 +00001277
bellarddebc7062006-04-30 21:58:41 +00001278@menu
1279* QEMU PowerPC System emulator::
ths24d4de42007-07-11 10:24:28 +00001280* Sparc32 System emulator::
1281* Sparc64 System emulator::
1282* MIPS System emulator::
1283* ARM System emulator::
1284* ColdFire System emulator::
bellarddebc7062006-04-30 21:58:41 +00001285@end menu
1286
1287@node QEMU PowerPC System emulator
bellard3f9f3aa2005-12-18 20:11:37 +00001288@section QEMU PowerPC System emulator
bellard52c00a52004-04-25 21:27:03 +00001289
1290Use the executable @file{qemu-system-ppc} to simulate a complete PREP
bellard15a34c62004-07-08 21:26:26 +00001291or PowerMac PowerPC system.
1292
bellardb671f9e2005-04-30 15:08:33 +00001293QEMU emulates the following PowerMac peripherals:
bellard15a34c62004-07-08 21:26:26 +00001294
1295@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001296@item
blueswir1006f3a42009-02-08 15:59:36 +00001297UniNorth or Grackle PCI Bridge
bellard15a34c62004-07-08 21:26:26 +00001298@item
1299PCI VGA compatible card with VESA Bochs Extensions
ths5fafdf22007-09-16 21:08:06 +00001300@item
bellard15a34c62004-07-08 21:26:26 +000013012 PMAC IDE interfaces with hard disk and CD-ROM support
ths5fafdf22007-09-16 21:08:06 +00001302@item
bellard15a34c62004-07-08 21:26:26 +00001303NE2000 PCI adapters
1304@item
1305Non Volatile RAM
1306@item
1307VIA-CUDA with ADB keyboard and mouse.
1308@end itemize
bellard52c00a52004-04-25 21:27:03 +00001309
bellardb671f9e2005-04-30 15:08:33 +00001310QEMU emulates the following PREP peripherals:
bellard52c00a52004-04-25 21:27:03 +00001311
1312@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001313@item
bellard15a34c62004-07-08 21:26:26 +00001314PCI Bridge
1315@item
1316PCI VGA compatible card with VESA Bochs Extensions
ths5fafdf22007-09-16 21:08:06 +00001317@item
bellard52c00a52004-04-25 21:27:03 +000013182 IDE interfaces with hard disk and CD-ROM support
1319@item
1320Floppy disk
ths5fafdf22007-09-16 21:08:06 +00001321@item
bellard15a34c62004-07-08 21:26:26 +00001322NE2000 network adapters
bellard52c00a52004-04-25 21:27:03 +00001323@item
1324Serial port
1325@item
1326PREP Non Volatile RAM
bellard15a34c62004-07-08 21:26:26 +00001327@item
1328PC compatible keyboard and mouse.
bellard52c00a52004-04-25 21:27:03 +00001329@end itemize
1330
bellard15a34c62004-07-08 21:26:26 +00001331QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
bellard3f9f3aa2005-12-18 20:11:37 +00001332@url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
bellard52c00a52004-04-25 21:27:03 +00001333
blueswir1992e5ac2008-12-24 20:23:51 +00001334Since version 0.9.1, QEMU uses OpenBIOS @url{http://www.openbios.org/}
blueswir1006f3a42009-02-08 15:59:36 +00001335for the g3beige and mac99 PowerMac machines. OpenBIOS is a free (GPL
1336v2) portable firmware implementation. The goal is to implement a 100%
1337IEEE 1275-1994 (referred to as Open Firmware) compliant firmware.
blueswir1992e5ac2008-12-24 20:23:51 +00001338
bellard15a34c62004-07-08 21:26:26 +00001339@c man begin OPTIONS
1340
1341The following options are specific to the PowerPC emulation:
1342
1343@table @option
1344
ths3b46e622007-09-17 08:09:54 +00001345@item -g WxH[xDEPTH]
bellard15a34c62004-07-08 21:26:26 +00001346
1347Set the initial VGA graphic mode. The default is 800x600x15.
1348
blueswir195efd112008-12-24 20:26:14 +00001349@item -prom-env string
1350
1351Set OpenBIOS variables in NVRAM, for example:
1352
1353@example
1354qemu-system-ppc -prom-env 'auto-boot?=false' \
1355 -prom-env 'boot-device=hd:2,\yaboot' \
1356 -prom-env 'boot-args=conf=hd:2,\yaboot.conf'
1357@end example
1358
1359These variables are not used by Open Hack'Ware.
1360
bellard15a34c62004-07-08 21:26:26 +00001361@end table
1362
ths5fafdf22007-09-16 21:08:06 +00001363@c man end
bellard15a34c62004-07-08 21:26:26 +00001364
1365
bellard52c00a52004-04-25 21:27:03 +00001366More information is available at
bellard3f9f3aa2005-12-18 20:11:37 +00001367@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
bellard52c00a52004-04-25 21:27:03 +00001368
ths24d4de42007-07-11 10:24:28 +00001369@node Sparc32 System emulator
1370@section Sparc32 System emulator
bellarde80cfcf2004-12-19 23:18:01 +00001371
blueswir134a3d232008-10-04 20:43:39 +00001372Use the executable @file{qemu-system-sparc} to simulate the following
1373Sun4m architecture machines:
1374@itemize @minus
1375@item
1376SPARCstation 4
1377@item
1378SPARCstation 5
1379@item
1380SPARCstation 10
1381@item
1382SPARCstation 20
1383@item
1384SPARCserver 600MP
1385@item
1386SPARCstation LX
1387@item
1388SPARCstation Voyager
1389@item
1390SPARCclassic
1391@item
1392SPARCbook
1393@end itemize
bellarde80cfcf2004-12-19 23:18:01 +00001394
blueswir134a3d232008-10-04 20:43:39 +00001395The emulation is somewhat complete. SMP up to 16 CPUs is supported,
1396but Linux limits the number of usable CPUs to 4.
1397
1398It's also possible to simulate a SPARCstation 2 (sun4c architecture),
1399SPARCserver 1000, or SPARCcenter 2000 (sun4d architecture), but these
1400emulators are not usable yet.
1401
1402QEMU emulates the following sun4m/sun4c/sun4d peripherals:
bellarde80cfcf2004-12-19 23:18:01 +00001403
1404@itemize @minus
bellard34751872005-07-02 14:31:34 +00001405@item
blueswir17d858922007-12-28 20:57:43 +00001406IOMMU or IO-UNITs
bellarde80cfcf2004-12-19 23:18:01 +00001407@item
1408TCX Frame buffer
ths5fafdf22007-09-16 21:08:06 +00001409@item
bellarde80cfcf2004-12-19 23:18:01 +00001410Lance (Am7990) Ethernet
1411@item
blueswir134a3d232008-10-04 20:43:39 +00001412Non Volatile RAM M48T02/M48T08
bellarde80cfcf2004-12-19 23:18:01 +00001413@item
bellard34751872005-07-02 14:31:34 +00001414Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1415and power/reset logic
1416@item
1417ESP SCSI controller with hard disk and CD-ROM support
1418@item
blueswir16a3b9cc2007-11-11 17:56:38 +00001419Floppy drive (not on SS-600MP)
blueswir1a2502b52007-06-10 17:01:00 +00001420@item
1421CS4231 sound device (only on SS-5, not working yet)
bellarde80cfcf2004-12-19 23:18:01 +00001422@end itemize
1423
blueswir16a3b9cc2007-11-11 17:56:38 +00001424The number of peripherals is fixed in the architecture. Maximum
1425memory size depends on the machine type, for SS-5 it is 256MB and for
blueswir17d858922007-12-28 20:57:43 +00001426others 2047MB.
bellarde80cfcf2004-12-19 23:18:01 +00001427
bellard30a604f2006-06-14 18:35:18 +00001428Since version 0.8.2, QEMU uses OpenBIOS
bellard0986ac32006-06-14 12:36:32 +00001429@url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
1430firmware implementation. The goal is to implement a 100% IEEE
14311275-1994 (referred to as Open Firmware) compliant firmware.
bellard34751872005-07-02 14:31:34 +00001432
1433A sample Linux 2.6 series kernel and ram disk image are available on
blueswir134a3d232008-10-04 20:43:39 +00001434the QEMU web site. There are still issues with NetBSD and OpenBSD, but
1435some kernel versions work. Please note that currently Solaris kernels
1436don't work probably due to interface issues between OpenBIOS and
1437Solaris.
bellard34751872005-07-02 14:31:34 +00001438
1439@c man begin OPTIONS
1440
blueswir1a2502b52007-06-10 17:01:00 +00001441The following options are specific to the Sparc32 emulation:
bellard34751872005-07-02 14:31:34 +00001442
1443@table @option
1444
blueswir1a2502b52007-06-10 17:01:00 +00001445@item -g WxHx[xDEPTH]
bellard34751872005-07-02 14:31:34 +00001446
blueswir1a2502b52007-06-10 17:01:00 +00001447Set the initial TCX graphic mode. The default is 1024x768x8, currently
1448the only other possible mode is 1024x768x24.
bellard34751872005-07-02 14:31:34 +00001449
blueswir166508602007-05-01 14:16:52 +00001450@item -prom-env string
1451
1452Set OpenBIOS variables in NVRAM, for example:
1453
1454@example
1455qemu-system-sparc -prom-env 'auto-boot?=false' \
1456 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
1457@end example
1458
blueswir134a3d232008-10-04 20:43:39 +00001459@item -M [SS-4|SS-5|SS-10|SS-20|SS-600MP|LX|Voyager|SPARCClassic|SPARCbook|SS-2|SS-1000|SS-2000]
blueswir1a2502b52007-06-10 17:01:00 +00001460
1461Set the emulated machine type. Default is SS-5.
1462
bellard34751872005-07-02 14:31:34 +00001463@end table
1464
ths5fafdf22007-09-16 21:08:06 +00001465@c man end
bellard34751872005-07-02 14:31:34 +00001466
ths24d4de42007-07-11 10:24:28 +00001467@node Sparc64 System emulator
1468@section Sparc64 System emulator
bellard34751872005-07-02 14:31:34 +00001469
blueswir134a3d232008-10-04 20:43:39 +00001470Use the executable @file{qemu-system-sparc64} to simulate a Sun4u
1471(UltraSPARC PC-like machine), Sun4v (T1 PC-like machine), or generic
1472Niagara (T1) machine. The emulator is not usable for anything yet, but
1473it can launch some kernels.
bellardb7569212005-03-13 09:43:05 +00001474
blueswir1c7ba2182008-07-22 07:07:34 +00001475QEMU emulates the following peripherals:
bellard83469012005-07-23 14:27:54 +00001476
1477@itemize @minus
1478@item
ths5fafdf22007-09-16 21:08:06 +00001479UltraSparc IIi APB PCI Bridge
bellard83469012005-07-23 14:27:54 +00001480@item
1481PCI VGA compatible card with VESA Bochs Extensions
1482@item
blueswir134a3d232008-10-04 20:43:39 +00001483PS/2 mouse and keyboard
1484@item
bellard83469012005-07-23 14:27:54 +00001485Non Volatile RAM M48T59
1486@item
1487PC-compatible serial ports
blueswir1c7ba2182008-07-22 07:07:34 +00001488@item
14892 PCI IDE interfaces with hard disk and CD-ROM support
blueswir134a3d232008-10-04 20:43:39 +00001490@item
1491Floppy disk
bellard83469012005-07-23 14:27:54 +00001492@end itemize
1493
blueswir1c7ba2182008-07-22 07:07:34 +00001494@c man begin OPTIONS
1495
1496The following options are specific to the Sparc64 emulation:
1497
1498@table @option
1499
blueswir134a3d232008-10-04 20:43:39 +00001500@item -prom-env string
1501
1502Set OpenBIOS variables in NVRAM, for example:
1503
1504@example
1505qemu-system-sparc64 -prom-env 'auto-boot?=false'
1506@end example
1507
1508@item -M [sun4u|sun4v|Niagara]
blueswir1c7ba2182008-07-22 07:07:34 +00001509
1510Set the emulated machine type. The default is sun4u.
1511
1512@end table
1513
1514@c man end
1515
ths24d4de42007-07-11 10:24:28 +00001516@node MIPS System emulator
1517@section MIPS System emulator
bellard9d0a8e62005-07-03 17:34:05 +00001518
thsd9aedc32007-12-17 03:47:55 +00001519Four executables cover simulation of 32 and 64-bit MIPS systems in
1520both endian options, @file{qemu-system-mips}, @file{qemu-system-mipsel}
1521@file{qemu-system-mips64} and @file{qemu-system-mips64el}.
aurel3288cb0a02008-04-08 05:57:37 +00001522Five different machine types are emulated:
ths24d4de42007-07-11 10:24:28 +00001523
1524@itemize @minus
1525@item
1526A generic ISA PC-like machine "mips"
1527@item
1528The MIPS Malta prototype board "malta"
1529@item
thsd9aedc32007-12-17 03:47:55 +00001530An ACER Pica "pica61". This machine needs the 64-bit emulator.
ths6bf5b4e2007-10-17 13:08:32 +00001531@item
thsf0fc6f82007-10-17 13:39:42 +00001532MIPS emulator pseudo board "mipssim"
aurel3288cb0a02008-04-08 05:57:37 +00001533@item
1534A MIPS Magnum R4000 machine "magnum". This machine needs the 64-bit emulator.
ths24d4de42007-07-11 10:24:28 +00001535@end itemize
1536
1537The generic emulation is supported by Debian 'Etch' and is able to
1538install Debian into a virtual disk image. The following devices are
1539emulated:
bellard9d0a8e62005-07-03 17:34:05 +00001540
bellard3f9f3aa2005-12-18 20:11:37 +00001541@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001542@item
ths6bf5b4e2007-10-17 13:08:32 +00001543A range of MIPS CPUs, default is the 24Kf
bellard3f9f3aa2005-12-18 20:11:37 +00001544@item
1545PC style serial port
1546@item
ths24d4de42007-07-11 10:24:28 +00001547PC style IDE disk
1548@item
bellard3f9f3aa2005-12-18 20:11:37 +00001549NE2000 network card
1550@end itemize
1551
ths24d4de42007-07-11 10:24:28 +00001552The Malta emulation supports the following devices:
bellard3f9f3aa2005-12-18 20:11:37 +00001553
ths24d4de42007-07-11 10:24:28 +00001554@itemize @minus
1555@item
ths0b64d002007-07-11 21:43:14 +00001556Core board with MIPS 24Kf CPU and Galileo system controller
ths24d4de42007-07-11 10:24:28 +00001557@item
1558PIIX4 PCI/USB/SMbus controller
1559@item
1560The Multi-I/O chip's serial device
1561@item
Stefan Weil3a2eeac2009-06-06 18:05:58 +02001562PCI network cards (PCnet32 and others)
ths24d4de42007-07-11 10:24:28 +00001563@item
1564Malta FPGA serial device
1565@item
aurel321f605a72009-02-08 14:51:19 +00001566Cirrus (default) or any other PCI VGA graphics card
ths24d4de42007-07-11 10:24:28 +00001567@end itemize
1568
1569The ACER Pica emulation supports:
1570
1571@itemize @minus
1572@item
1573MIPS R4000 CPU
1574@item
1575PC-style IRQ and DMA controllers
1576@item
1577PC Keyboard
1578@item
1579IDE controller
1580@end itemize
1581
thsf0fc6f82007-10-17 13:39:42 +00001582The mipssim pseudo board emulation provides an environment similiar
1583to what the proprietary MIPS emulator uses for running Linux.
1584It supports:
ths6bf5b4e2007-10-17 13:08:32 +00001585
1586@itemize @minus
1587@item
1588A range of MIPS CPUs, default is the 24Kf
1589@item
1590PC style serial port
1591@item
1592MIPSnet network emulation
1593@end itemize
1594
aurel3288cb0a02008-04-08 05:57:37 +00001595The MIPS Magnum R4000 emulation supports:
1596
1597@itemize @minus
1598@item
1599MIPS R4000 CPU
1600@item
1601PC-style IRQ controller
1602@item
1603PC Keyboard
1604@item
1605SCSI controller
1606@item
1607G364 framebuffer
1608@end itemize
1609
1610
ths24d4de42007-07-11 10:24:28 +00001611@node ARM System emulator
1612@section ARM System emulator
bellard3f9f3aa2005-12-18 20:11:37 +00001613
1614Use the executable @file{qemu-system-arm} to simulate a ARM
1615machine. The ARM Integrator/CP board is emulated with the following
1616devices:
1617
1618@itemize @minus
1619@item
pbrook9ee6e8b2007-11-11 00:04:49 +00001620ARM926E, ARM1026E, ARM946E, ARM1136 or Cortex-A8 CPU
bellard3f9f3aa2005-12-18 20:11:37 +00001621@item
1622Two PL011 UARTs
ths5fafdf22007-09-16 21:08:06 +00001623@item
bellard3f9f3aa2005-12-18 20:11:37 +00001624SMC 91c111 Ethernet adapter
pbrook00a9bf12006-05-13 16:55:46 +00001625@item
1626PL110 LCD controller
1627@item
1628PL050 KMI with PS/2 keyboard and mouse.
pbrooka1bb27b2007-04-06 16:49:48 +00001629@item
1630PL181 MultiMedia Card Interface with SD card.
pbrook00a9bf12006-05-13 16:55:46 +00001631@end itemize
1632
1633The ARM Versatile baseboard is emulated with the following devices:
1634
1635@itemize @minus
1636@item
pbrook9ee6e8b2007-11-11 00:04:49 +00001637ARM926E, ARM1136 or Cortex-A8 CPU
pbrook00a9bf12006-05-13 16:55:46 +00001638@item
1639PL190 Vectored Interrupt Controller
1640@item
1641Four PL011 UARTs
ths5fafdf22007-09-16 21:08:06 +00001642@item
pbrook00a9bf12006-05-13 16:55:46 +00001643SMC 91c111 Ethernet adapter
1644@item
1645PL110 LCD controller
1646@item
1647PL050 KMI with PS/2 keyboard and mouse.
1648@item
1649PCI host bridge. Note the emulated PCI bridge only provides access to
1650PCI memory space. It does not provide access to PCI IO space.
ths4be456f2007-06-03 13:41:28 +00001651This means some devices (eg. ne2k_pci NIC) are not usable, and others
1652(eg. rtl8139 NIC) are only usable when the guest drivers use the memory
pbrook00a9bf12006-05-13 16:55:46 +00001653mapped control registers.
pbrooke6de1ba2006-06-16 21:48:48 +00001654@item
1655PCI OHCI USB controller.
1656@item
1657LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
pbrooka1bb27b2007-04-06 16:49:48 +00001658@item
1659PL181 MultiMedia Card Interface with SD card.
bellard3f9f3aa2005-12-18 20:11:37 +00001660@end itemize
1661
pbrookd7739d72007-02-28 16:25:17 +00001662The ARM RealView Emulation baseboard is emulated with the following devices:
1663
1664@itemize @minus
1665@item
pbrook9ee6e8b2007-11-11 00:04:49 +00001666ARM926E, ARM1136, ARM11MPCORE(x4) or Cortex-A8 CPU
pbrookd7739d72007-02-28 16:25:17 +00001667@item
1668ARM AMBA Generic/Distributed Interrupt Controller
1669@item
1670Four PL011 UARTs
ths5fafdf22007-09-16 21:08:06 +00001671@item
pbrookd7739d72007-02-28 16:25:17 +00001672SMC 91c111 Ethernet adapter
1673@item
1674PL110 LCD controller
1675@item
1676PL050 KMI with PS/2 keyboard and mouse
1677@item
1678PCI host bridge
1679@item
1680PCI OHCI USB controller
1681@item
1682LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
pbrooka1bb27b2007-04-06 16:49:48 +00001683@item
1684PL181 MultiMedia Card Interface with SD card.
pbrookd7739d72007-02-28 16:25:17 +00001685@end itemize
1686
balrogb00052e2007-04-30 02:22:06 +00001687The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
1688and "Terrier") emulation includes the following peripherals:
1689
1690@itemize @minus
1691@item
1692Intel PXA270 System-on-chip (ARM V5TE core)
1693@item
1694NAND Flash memory
1695@item
1696IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
1697@item
1698On-chip OHCI USB controller
1699@item
1700On-chip LCD controller
1701@item
1702On-chip Real Time Clock
1703@item
1704TI ADS7846 touchscreen controller on SSP bus
1705@item
1706Maxim MAX1111 analog-digital converter on I@math{^2}C bus
1707@item
1708GPIO-connected keyboard controller and LEDs
1709@item
balrog549444e2007-05-01 17:53:37 +00001710Secure Digital card connected to PXA MMC/SD host
balrogb00052e2007-04-30 02:22:06 +00001711@item
1712Three on-chip UARTs
1713@item
1714WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
1715@end itemize
1716
balrog02645922007-11-03 12:50:46 +00001717The Palm Tungsten|E PDA (codename "Cheetah") emulation includes the
1718following elements:
1719
1720@itemize @minus
1721@item
1722Texas Instruments OMAP310 System-on-chip (ARM 925T core)
1723@item
1724ROM and RAM memories (ROM firmware image can be loaded with -option-rom)
1725@item
1726On-chip LCD controller
1727@item
1728On-chip Real Time Clock
1729@item
1730TI TSC2102i touchscreen controller / analog-digital converter / Audio
1731CODEC, connected through MicroWire and I@math{^2}S busses
1732@item
1733GPIO-connected matrix keypad
1734@item
1735Secure Digital card connected to OMAP MMC/SD host
1736@item
1737Three on-chip UARTs
1738@end itemize
1739
balrogc30bb262008-05-18 13:01:40 +00001740Nokia N800 and N810 internet tablets (known also as RX-34 and RX-44 / 48)
1741emulation supports the following elements:
1742
1743@itemize @minus
1744@item
1745Texas Instruments OMAP2420 System-on-chip (ARM 1136 core)
1746@item
1747RAM and non-volatile OneNAND Flash memories
1748@item
1749Display connected to EPSON remote framebuffer chip and OMAP on-chip
1750display controller and a LS041y3 MIPI DBI-C controller
1751@item
1752TI TSC2301 (in N800) and TI TSC2005 (in N810) touchscreen controllers
1753driven through SPI bus
1754@item
1755National Semiconductor LM8323-controlled qwerty keyboard driven
1756through I@math{^2}C bus
1757@item
1758Secure Digital card connected to OMAP MMC/SD host
1759@item
1760Three OMAP on-chip UARTs and on-chip STI debugging console
1761@item
balrog2d564692008-11-09 02:24:54 +00001762A Bluetooth(R) transciever and HCI connected to an UART
1763@item
balrogc30bb262008-05-18 13:01:40 +00001764Mentor Graphics "Inventra" dual-role USB controller embedded in a TI
1765TUSB6010 chip - only USB host mode is supported
1766@item
1767TI TMP105 temperature sensor driven through I@math{^2}C bus
1768@item
1769TI TWL92230C power management companion with an RTC on I@math{^2}C bus
1770@item
1771Nokia RETU and TAHVO multi-purpose chips with an RTC, connected
1772through CBUS
1773@end itemize
1774
pbrook9ee6e8b2007-11-11 00:04:49 +00001775The Luminary Micro Stellaris LM3S811EVB emulation includes the following
1776devices:
1777
1778@itemize @minus
1779@item
1780Cortex-M3 CPU core.
1781@item
178264k Flash and 8k SRAM.
1783@item
1784Timers, UARTs, ADC and I@math{^2}C interface.
1785@item
1786OSRAM Pictiva 96x16 OLED with SSD0303 controller on I@math{^2}C bus.
1787@end itemize
1788
1789The Luminary Micro Stellaris LM3S6965EVB emulation includes the following
1790devices:
1791
1792@itemize @minus
1793@item
1794Cortex-M3 CPU core.
1795@item
1796256k Flash and 64k SRAM.
1797@item
1798Timers, UARTs, ADC, I@math{^2}C and SSI interfaces.
1799@item
1800OSRAM Pictiva 128x64 OLED with SSD0323 controller connected via SSI.
1801@end itemize
1802
balrog57cd6e92008-05-07 12:23:32 +00001803The Freecom MusicPal internet radio emulation includes the following
1804elements:
1805
1806@itemize @minus
1807@item
1808Marvell MV88W8618 ARM core.
1809@item
181032 MB RAM, 256 KB SRAM, 8 MB flash.
1811@item
1812Up to 2 16550 UARTs
1813@item
1814MV88W8xx8 Ethernet controller
1815@item
1816MV88W8618 audio controller, WM8750 CODEC and mixer
1817@item
1818128×64 display with brightness control
1819@item
18202 buttons, 2 navigation wheels with button function
1821@end itemize
1822
balrog997641a2008-12-15 02:05:00 +00001823The Siemens SX1 models v1 and v2 (default) basic emulation.
1824The emulaton includes the following elements:
1825
1826@itemize @minus
1827@item
1828Texas Instruments OMAP310 System-on-chip (ARM 925T core)
1829@item
1830ROM and RAM memories (ROM firmware image can be loaded with -pflash)
1831V1
18321 Flash of 16MB and 1 Flash of 8MB
1833V2
18341 Flash of 32MB
1835@item
1836On-chip LCD controller
1837@item
1838On-chip Real Time Clock
1839@item
1840Secure Digital card connected to OMAP MMC/SD host
1841@item
1842Three on-chip UARTs
1843@end itemize
1844
Paul Brook4af39612009-05-14 23:11:09 +01001845The "Syborg" Symbian Virtual Platform base model includes the following
1846elements:
1847
1848@itemize @minus
1849@item
1850ARM Cortex-A8 CPU
1851@item
1852Interrupt controller
1853@item
1854Timer
1855@item
1856Real Time Clock
1857@item
1858Keyboard
1859@item
1860Framebuffer
1861@item
1862Touchscreen
1863@item
1864UARTs
1865@end itemize
1866
bellard3f9f3aa2005-12-18 20:11:37 +00001867A Linux 2.6 test image is available on the QEMU web site. More
1868information is available in the QEMU mailing-list archive.
1869
blueswir1d2c639d2009-01-24 18:19:25 +00001870@c man begin OPTIONS
1871
1872The following options are specific to the ARM emulation:
1873
1874@table @option
1875
1876@item -semihosting
1877Enable semihosting syscall emulation.
1878
1879On ARM this implements the "Angel" interface.
1880
1881Note that this allows guest direct access to the host filesystem,
1882so should only be used with trusted guest OS.
1883
1884@end table
1885
ths24d4de42007-07-11 10:24:28 +00001886@node ColdFire System emulator
1887@section ColdFire System emulator
pbrook209a4e62007-05-23 20:16:15 +00001888
1889Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
1890The emulator is able to boot a uClinux kernel.
pbrook707e0112007-06-04 00:50:06 +00001891
1892The M5208EVB emulation includes the following devices:
1893
1894@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001895@item
pbrook707e0112007-06-04 00:50:06 +00001896MCF5208 ColdFire V2 Microprocessor (ISA A+ with EMAC).
1897@item
1898Three Two on-chip UARTs.
1899@item
1900Fast Ethernet Controller (FEC)
1901@end itemize
1902
1903The AN5206 emulation includes the following devices:
pbrook209a4e62007-05-23 20:16:15 +00001904
1905@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001906@item
pbrook209a4e62007-05-23 20:16:15 +00001907MCF5206 ColdFire V2 Microprocessor.
1908@item
1909Two on-chip UARTs.
1910@end itemize
1911
blueswir1d2c639d2009-01-24 18:19:25 +00001912@c man begin OPTIONS
1913
1914The following options are specific to the ARM emulation:
1915
1916@table @option
1917
1918@item -semihosting
1919Enable semihosting syscall emulation.
1920
1921On M68K this implements the "ColdFire GDB" interface used by libgloss.
1922
1923Note that this allows guest direct access to the host filesystem,
1924so should only be used with trusted guest OS.
1925
1926@end table
1927
ths5fafdf22007-09-16 21:08:06 +00001928@node QEMU User space emulator
1929@chapter QEMU User space emulator
bellard83195232007-02-05 19:42:07 +00001930
1931@menu
1932* Supported Operating Systems ::
1933* Linux User space emulator::
1934* Mac OS X/Darwin User space emulator ::
blueswir184778502008-10-26 20:33:16 +00001935* BSD User space emulator ::
bellard83195232007-02-05 19:42:07 +00001936@end menu
1937
1938@node Supported Operating Systems
1939@section Supported Operating Systems
1940
1941The following OS are supported in user space emulation:
1942
1943@itemize @minus
1944@item
ths4be456f2007-06-03 13:41:28 +00001945Linux (referred as qemu-linux-user)
bellard83195232007-02-05 19:42:07 +00001946@item
ths4be456f2007-06-03 13:41:28 +00001947Mac OS X/Darwin (referred as qemu-darwin-user)
blueswir184778502008-10-26 20:33:16 +00001948@item
1949BSD (referred as qemu-bsd-user)
bellard83195232007-02-05 19:42:07 +00001950@end itemize
1951
1952@node Linux User space emulator
1953@section Linux User space emulator
bellard386405f2003-03-23 21:28:45 +00001954
bellarddebc7062006-04-30 21:58:41 +00001955@menu
1956* Quick Start::
1957* Wine launch::
1958* Command line options::
pbrook79737e42006-06-11 16:28:41 +00001959* Other binaries::
bellarddebc7062006-04-30 21:58:41 +00001960@end menu
1961
1962@node Quick Start
bellard83195232007-02-05 19:42:07 +00001963@subsection Quick Start
bellard386405f2003-03-23 21:28:45 +00001964
bellard1f673132004-04-04 15:21:17 +00001965In order to launch a Linux process, QEMU needs the process executable
ths5fafdf22007-09-16 21:08:06 +00001966itself and all the target (x86) dynamic libraries used by it.
bellard386405f2003-03-23 21:28:45 +00001967
bellard1f673132004-04-04 15:21:17 +00001968@itemize
bellard386405f2003-03-23 21:28:45 +00001969
bellard1f673132004-04-04 15:21:17 +00001970@item On x86, you can just try to launch any process by using the native
1971libraries:
bellard386405f2003-03-23 21:28:45 +00001972
ths5fafdf22007-09-16 21:08:06 +00001973@example
bellard1f673132004-04-04 15:21:17 +00001974qemu-i386 -L / /bin/ls
1975@end example
bellardfd429f22003-03-30 20:59:46 +00001976
bellard1f673132004-04-04 15:21:17 +00001977@code{-L /} tells that the x86 dynamic linker must be searched with a
1978@file{/} prefix.
bellard1eb20522003-06-25 16:21:49 +00001979
thsdbcf5e82007-02-10 22:14:55 +00001980@item Since QEMU is also a linux process, you can launch qemu with
1981qemu (NOTE: you can only do that if you compiled QEMU from the sources):
bellard1eb20522003-06-25 16:21:49 +00001982
ths5fafdf22007-09-16 21:08:06 +00001983@example
bellard1f673132004-04-04 15:21:17 +00001984qemu-i386 -L / qemu-i386 -L / /bin/ls
1985@end example
bellard386405f2003-03-23 21:28:45 +00001986
bellard1f673132004-04-04 15:21:17 +00001987@item On non x86 CPUs, you need first to download at least an x86 glibc
1988(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1989@code{LD_LIBRARY_PATH} is not set:
bellard386405f2003-03-23 21:28:45 +00001990
bellard1f673132004-04-04 15:21:17 +00001991@example
ths5fafdf22007-09-16 21:08:06 +00001992unset LD_LIBRARY_PATH
bellard1f673132004-04-04 15:21:17 +00001993@end example
bellard386405f2003-03-23 21:28:45 +00001994
bellard1f673132004-04-04 15:21:17 +00001995Then you can launch the precompiled @file{ls} x86 executable:
bellard386405f2003-03-23 21:28:45 +00001996
bellard1f673132004-04-04 15:21:17 +00001997@example
1998qemu-i386 tests/i386/ls
1999@end example
2000You can look at @file{qemu-binfmt-conf.sh} so that
2001QEMU is automatically launched by the Linux kernel when you try to
2002launch x86 executables. It requires the @code{binfmt_misc} module in the
2003Linux kernel.
bellard386405f2003-03-23 21:28:45 +00002004
bellard1f673132004-04-04 15:21:17 +00002005@item The x86 version of QEMU is also included. You can try weird things such as:
2006@example
bellarddebc7062006-04-30 21:58:41 +00002007qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
2008 /usr/local/qemu-i386/bin/ls-i386
bellard1f673132004-04-04 15:21:17 +00002009@end example
bellard386405f2003-03-23 21:28:45 +00002010
bellard1f673132004-04-04 15:21:17 +00002011@end itemize
bellard386405f2003-03-23 21:28:45 +00002012
bellarddebc7062006-04-30 21:58:41 +00002013@node Wine launch
bellard83195232007-02-05 19:42:07 +00002014@subsection Wine launch
bellard386405f2003-03-23 21:28:45 +00002015
bellard1f673132004-04-04 15:21:17 +00002016@itemize
bellard386405f2003-03-23 21:28:45 +00002017
bellard1f673132004-04-04 15:21:17 +00002018@item Ensure that you have a working QEMU with the x86 glibc
2019distribution (see previous section). In order to verify it, you must be
2020able to do:
bellard386405f2003-03-23 21:28:45 +00002021
bellard1f673132004-04-04 15:21:17 +00002022@example
2023qemu-i386 /usr/local/qemu-i386/bin/ls-i386
2024@end example
bellard386405f2003-03-23 21:28:45 +00002025
bellard1f673132004-04-04 15:21:17 +00002026@item Download the binary x86 Wine install
ths5fafdf22007-09-16 21:08:06 +00002027(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
bellard386405f2003-03-23 21:28:45 +00002028
bellard1f673132004-04-04 15:21:17 +00002029@item Configure Wine on your account. Look at the provided script
bellarddebc7062006-04-30 21:58:41 +00002030@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
bellard1f673132004-04-04 15:21:17 +00002031@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
bellard386405f2003-03-23 21:28:45 +00002032
bellard1f673132004-04-04 15:21:17 +00002033@item Then you can try the example @file{putty.exe}:
bellard386405f2003-03-23 21:28:45 +00002034
bellard1f673132004-04-04 15:21:17 +00002035@example
bellarddebc7062006-04-30 21:58:41 +00002036qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
2037 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
bellard1f673132004-04-04 15:21:17 +00002038@end example
bellard386405f2003-03-23 21:28:45 +00002039
bellard1f673132004-04-04 15:21:17 +00002040@end itemize
bellard386405f2003-03-23 21:28:45 +00002041
bellarddebc7062006-04-30 21:58:41 +00002042@node Command line options
bellard83195232007-02-05 19:42:07 +00002043@subsection Command line options
bellard386405f2003-03-23 21:28:45 +00002044
bellard1f673132004-04-04 15:21:17 +00002045@example
Paul Brook379f6692009-07-17 12:48:08 +01002046usage: qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] program [arguments...]
bellard1f673132004-04-04 15:21:17 +00002047@end example
bellard386405f2003-03-23 21:28:45 +00002048
bellard1f673132004-04-04 15:21:17 +00002049@table @option
2050@item -h
2051Print the help
ths3b46e622007-09-17 08:09:54 +00002052@item -L path
bellard1f673132004-04-04 15:21:17 +00002053Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
2054@item -s size
2055Set the x86 stack size in bytes (default=524288)
blueswir134a3d232008-10-04 20:43:39 +00002056@item -cpu model
2057Select CPU model (-cpu ? for list and additional feature selection)
Paul Brook379f6692009-07-17 12:48:08 +01002058@item -B offset
2059Offset guest address by the specified number of bytes. This is useful when
2060the address region rewuired by guest applications is reserved on the host.
2061Ths option is currently only supported on some hosts.
bellard386405f2003-03-23 21:28:45 +00002062@end table
2063
bellard1f673132004-04-04 15:21:17 +00002064Debug options:
bellard386405f2003-03-23 21:28:45 +00002065
bellard1f673132004-04-04 15:21:17 +00002066@table @option
2067@item -d
2068Activate log (logfile=/tmp/qemu.log)
2069@item -p pagesize
2070Act as if the host page size was 'pagesize' bytes
blueswir134a3d232008-10-04 20:43:39 +00002071@item -g port
2072Wait gdb connection to port
aurel321b530a62009-04-05 20:08:59 +00002073@item -singlestep
2074Run the emulation in single step mode.
bellard1f673132004-04-04 15:21:17 +00002075@end table
bellard386405f2003-03-23 21:28:45 +00002076
balrogb01bcae2007-12-16 13:05:59 +00002077Environment variables:
2078
2079@table @env
2080@item QEMU_STRACE
2081Print system calls and arguments similar to the 'strace' program
2082(NOTE: the actual 'strace' program will not work because the user
2083space emulator hasn't implemented ptrace). At the moment this is
2084incomplete. All system calls that don't have a specific argument
2085format are printed with information for six arguments. Many
2086flag-style arguments don't have decoders and will show up as numbers.
ths5cfdf932007-12-17 03:38:26 +00002087@end table
balrogb01bcae2007-12-16 13:05:59 +00002088
pbrook79737e42006-06-11 16:28:41 +00002089@node Other binaries
bellard83195232007-02-05 19:42:07 +00002090@subsection Other binaries
pbrook79737e42006-06-11 16:28:41 +00002091
2092@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
2093binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
2094configurations), and arm-uclinux bFLT format binaries.
2095
pbrooke6e59062006-10-22 00:18:54 +00002096@command{qemu-m68k} is capable of running semihosted binaries using the BDM
2097(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
2098coldfire uClinux bFLT format binaries.
2099
pbrook79737e42006-06-11 16:28:41 +00002100The binary format is detected automatically.
2101
blueswir134a3d232008-10-04 20:43:39 +00002102@command{qemu-sparc} can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
2103
blueswir1a785e422007-10-20 08:09:05 +00002104@command{qemu-sparc32plus} can execute Sparc32 and SPARC32PLUS binaries
2105(Sparc64 CPU, 32 bit ABI).
2106
2107@command{qemu-sparc64} can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
2108SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
2109
bellard83195232007-02-05 19:42:07 +00002110@node Mac OS X/Darwin User space emulator
2111@section Mac OS X/Darwin User space emulator
2112
2113@menu
2114* Mac OS X/Darwin Status::
2115* Mac OS X/Darwin Quick Start::
2116* Mac OS X/Darwin Command line options::
2117@end menu
2118
2119@node Mac OS X/Darwin Status
2120@subsection Mac OS X/Darwin Status
2121
2122@itemize @minus
2123@item
2124target x86 on x86: Most apps (Cocoa and Carbon too) works. [1]
2125@item
2126target PowerPC on x86: Not working as the ppc commpage can't be mapped (yet!)
2127@item
thsdbcf5e82007-02-10 22:14:55 +00002128target PowerPC on PowerPC: Most apps (Cocoa and Carbon too) works. [1]
bellard83195232007-02-05 19:42:07 +00002129@item
2130target x86 on PowerPC: most utilities work. Cocoa and Carbon apps are not yet supported.
2131@end itemize
2132
2133[1] If you're host commpage can be executed by qemu.
2134
2135@node Mac OS X/Darwin Quick Start
2136@subsection Quick Start
2137
2138In order to launch a Mac OS X/Darwin process, QEMU needs the process executable
2139itself and all the target dynamic libraries used by it. If you don't have the FAT
2140libraries (you're running Mac OS X/ppc) you'll need to obtain it from a Mac OS X
2141CD or compile them by hand.
2142
2143@itemize
2144
2145@item On x86, you can just try to launch any process by using the native
2146libraries:
2147
ths5fafdf22007-09-16 21:08:06 +00002148@example
thsdbcf5e82007-02-10 22:14:55 +00002149qemu-i386 /bin/ls
bellard83195232007-02-05 19:42:07 +00002150@end example
2151
2152or to run the ppc version of the executable:
2153
ths5fafdf22007-09-16 21:08:06 +00002154@example
thsdbcf5e82007-02-10 22:14:55 +00002155qemu-ppc /bin/ls
bellard83195232007-02-05 19:42:07 +00002156@end example
2157
2158@item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
2159are installed:
2160
ths5fafdf22007-09-16 21:08:06 +00002161@example
thsdbcf5e82007-02-10 22:14:55 +00002162qemu-i386 -L /opt/x86_root/ /bin/ls
bellard83195232007-02-05 19:42:07 +00002163@end example
2164
2165@code{-L /opt/x86_root/} tells that the dynamic linker (dyld) path is in
2166@file{/opt/x86_root/usr/bin/dyld}.
2167
2168@end itemize
2169
2170@node Mac OS X/Darwin Command line options
2171@subsection Command line options
2172
2173@example
thsdbcf5e82007-02-10 22:14:55 +00002174usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
bellard83195232007-02-05 19:42:07 +00002175@end example
2176
2177@table @option
2178@item -h
2179Print the help
ths3b46e622007-09-17 08:09:54 +00002180@item -L path
bellard83195232007-02-05 19:42:07 +00002181Set the library root path (default=/)
2182@item -s size
2183Set the stack size in bytes (default=524288)
2184@end table
2185
2186Debug options:
2187
2188@table @option
2189@item -d
2190Activate log (logfile=/tmp/qemu.log)
2191@item -p pagesize
2192Act as if the host page size was 'pagesize' bytes
aurel321b530a62009-04-05 20:08:59 +00002193@item -singlestep
2194Run the emulation in single step mode.
bellard83195232007-02-05 19:42:07 +00002195@end table
2196
blueswir184778502008-10-26 20:33:16 +00002197@node BSD User space emulator
2198@section BSD User space emulator
2199
2200@menu
2201* BSD Status::
2202* BSD Quick Start::
2203* BSD Command line options::
2204@end menu
2205
2206@node BSD Status
2207@subsection BSD Status
2208
2209@itemize @minus
2210@item
2211target Sparc64 on Sparc64: Some trivial programs work.
2212@end itemize
2213
2214@node BSD Quick Start
2215@subsection Quick Start
2216
2217In order to launch a BSD process, QEMU needs the process executable
2218itself and all the target dynamic libraries used by it.
2219
2220@itemize
2221
2222@item On Sparc64, you can just try to launch any process by using the native
2223libraries:
2224
2225@example
2226qemu-sparc64 /bin/ls
2227@end example
2228
2229@end itemize
2230
2231@node BSD Command line options
2232@subsection Command line options
2233
2234@example
2235usage: qemu-sparc64 [-h] [-d] [-L path] [-s size] [-bsd type] program [arguments...]
2236@end example
2237
2238@table @option
2239@item -h
2240Print the help
2241@item -L path
2242Set the library root path (default=/)
2243@item -s size
2244Set the stack size in bytes (default=524288)
2245@item -bsd type
2246Set the type of the emulated BSD Operating system. Valid values are
2247FreeBSD, NetBSD and OpenBSD (default).
2248@end table
2249
2250Debug options:
2251
2252@table @option
2253@item -d
2254Activate log (logfile=/tmp/qemu.log)
2255@item -p pagesize
2256Act as if the host page size was 'pagesize' bytes
aurel321b530a62009-04-05 20:08:59 +00002257@item -singlestep
2258Run the emulation in single step mode.
blueswir184778502008-10-26 20:33:16 +00002259@end table
2260
bellard15a34c62004-07-08 21:26:26 +00002261@node compilation
2262@chapter Compilation from the sources
2263
bellarddebc7062006-04-30 21:58:41 +00002264@menu
2265* Linux/Unix::
2266* Windows::
2267* Cross compilation for Windows with Linux::
2268* Mac OS X::
2269@end menu
2270
2271@node Linux/Unix
bellard7c3fc842005-02-10 21:46:47 +00002272@section Linux/Unix
bellard15a34c62004-07-08 21:26:26 +00002273
bellard7c3fc842005-02-10 21:46:47 +00002274@subsection Compilation
2275
2276First you must decompress the sources:
2277@example
2278cd /tmp
2279tar zxvf qemu-x.y.z.tar.gz
2280cd qemu-x.y.z
2281@end example
2282
2283Then you configure QEMU and build it (usually no options are needed):
2284@example
2285./configure
2286make
2287@end example
2288
2289Then type as root user:
2290@example
2291make install
2292@end example
2293to install QEMU in @file{/usr/local}.
2294
bellarddebc7062006-04-30 21:58:41 +00002295@node Windows
bellard15a34c62004-07-08 21:26:26 +00002296@section Windows
2297
2298@itemize
2299@item Install the current versions of MSYS and MinGW from
2300@url{http://www.mingw.org/}. You can find detailed installation
2301instructions in the download section and the FAQ.
2302
ths5fafdf22007-09-16 21:08:06 +00002303@item Download
bellard15a34c62004-07-08 21:26:26 +00002304the MinGW development library of SDL 1.2.x
bellarddebc7062006-04-30 21:58:41 +00002305(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
bellard15a34c62004-07-08 21:26:26 +00002306@url{http://www.libsdl.org}. Unpack it in a temporary place, and
2307unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
2308directory. Edit the @file{sdl-config} script so that it gives the
2309correct SDL directory when invoked.
2310
2311@item Extract the current version of QEMU.
ths5fafdf22007-09-16 21:08:06 +00002312
bellard15a34c62004-07-08 21:26:26 +00002313@item Start the MSYS shell (file @file{msys.bat}).
2314
ths5fafdf22007-09-16 21:08:06 +00002315@item Change to the QEMU directory. Launch @file{./configure} and
bellard15a34c62004-07-08 21:26:26 +00002316@file{make}. If you have problems using SDL, verify that
2317@file{sdl-config} can be launched from the MSYS command line.
2318
ths5fafdf22007-09-16 21:08:06 +00002319@item You can install QEMU in @file{Program Files/Qemu} by typing
bellard15a34c62004-07-08 21:26:26 +00002320@file{make install}. Don't forget to copy @file{SDL.dll} in
2321@file{Program Files/Qemu}.
2322
2323@end itemize
2324
bellarddebc7062006-04-30 21:58:41 +00002325@node Cross compilation for Windows with Linux
bellard15a34c62004-07-08 21:26:26 +00002326@section Cross compilation for Windows with Linux
2327
2328@itemize
2329@item
2330Install the MinGW cross compilation tools available at
2331@url{http://www.mingw.org/}.
2332
ths5fafdf22007-09-16 21:08:06 +00002333@item
bellard15a34c62004-07-08 21:26:26 +00002334Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
2335unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
2336variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
2337the QEMU configuration script.
2338
ths5fafdf22007-09-16 21:08:06 +00002339@item
bellard15a34c62004-07-08 21:26:26 +00002340Configure QEMU for Windows cross compilation:
2341@example
2342./configure --enable-mingw32
2343@end example
2344If necessary, you can change the cross-prefix according to the prefix
ths4be456f2007-06-03 13:41:28 +00002345chosen for the MinGW tools with --cross-prefix. You can also use
bellard15a34c62004-07-08 21:26:26 +00002346--prefix to set the Win32 install path.
2347
ths5fafdf22007-09-16 21:08:06 +00002348@item You can install QEMU in the installation directory by typing
bellard15a34c62004-07-08 21:26:26 +00002349@file{make install}. Don't forget to copy @file{SDL.dll} in the
ths5fafdf22007-09-16 21:08:06 +00002350installation directory.
bellard15a34c62004-07-08 21:26:26 +00002351
2352@end itemize
2353
2354Note: Currently, Wine does not seem able to launch
2355QEMU for Win32.
2356
bellarddebc7062006-04-30 21:58:41 +00002357@node Mac OS X
bellard15a34c62004-07-08 21:26:26 +00002358@section Mac OS X
2359
2360The Mac OS X patches are not fully merged in QEMU, so you should look
2361at the QEMU mailing list archive to have all the necessary
2362information.
2363
bellarddebc7062006-04-30 21:58:41 +00002364@node Index
2365@chapter Index
2366@printindex cp
2367
2368@bye