blob: 2fb5c0b249177aa34b7ebdbcaa12b02b425065ee [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)
Paul Brook0ef849d2009-11-16 17:06:43 +000083@item ARM RealView Emulation/Platform 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
Kevin Wolf4e257e52009-10-09 10:58:36 +02001345@item -g @var{W}x@var{H}[x@var{DEPTH}]
bellard15a34c62004-07-08 21:26:26 +00001346
1347Set the initial VGA graphic mode. The default is 800x600x15.
1348
Kevin Wolf4e257e52009-10-09 10:58:36 +02001349@item -prom-env @var{string}
blueswir195efd112008-12-24 20:26:14 +00001350
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
Kevin Wolf4e257e52009-10-09 10:58:36 +02001445@item -g @var{W}x@var{H}x[x@var{DEPTH}]
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
Kevin Wolf4e257e52009-10-09 10:58:36 +02001450@item -prom-env @var{string}
blueswir166508602007-05-01 14:16:52 +00001451
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
Kevin Wolf4e257e52009-10-09 10:58:36 +02001500@item -prom-env @var{string}
blueswir134a3d232008-10-04 20:43:39 +00001501
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
Paul Brook21a88942009-12-21 20:19:12 +00001662Several variants of the ARM RealView baseboard are emulated,
1663including the EB, PB-A8 and PBX-A9. Due to interactions with the
1664bootloader, only certain Linux kernel configurations work out
1665of the box on these boards.
1666
1667Kernels for the PB-A8 board should have CONFIG_REALVIEW_HIGH_PHYS_OFFSET
1668enabled in the kernel, and expect 512M RAM. Kernels for The PBX-A9 board
1669should have CONFIG_SPARSEMEM enabled, CONFIG_REALVIEW_HIGH_PHYS_OFFSET
1670disabled and expect 1024M RAM.
1671
1672The following devices are emuilated:
pbrookd7739d72007-02-28 16:25:17 +00001673
1674@itemize @minus
1675@item
Paul Brookf7c70322009-11-19 16:45:21 +00001676ARM926E, ARM1136, ARM11MPCore, Cortex-A8 or Cortex-A9 MPCore CPU
pbrookd7739d72007-02-28 16:25:17 +00001677@item
1678ARM AMBA Generic/Distributed Interrupt Controller
1679@item
1680Four PL011 UARTs
ths5fafdf22007-09-16 21:08:06 +00001681@item
Paul Brook0ef849d2009-11-16 17:06:43 +00001682SMC 91c111 or SMSC LAN9118 Ethernet adapter
pbrookd7739d72007-02-28 16:25:17 +00001683@item
1684PL110 LCD controller
1685@item
1686PL050 KMI with PS/2 keyboard and mouse
1687@item
1688PCI host bridge
1689@item
1690PCI OHCI USB controller
1691@item
1692LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
pbrooka1bb27b2007-04-06 16:49:48 +00001693@item
1694PL181 MultiMedia Card Interface with SD card.
pbrookd7739d72007-02-28 16:25:17 +00001695@end itemize
1696
balrogb00052e2007-04-30 02:22:06 +00001697The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
1698and "Terrier") emulation includes the following peripherals:
1699
1700@itemize @minus
1701@item
1702Intel PXA270 System-on-chip (ARM V5TE core)
1703@item
1704NAND Flash memory
1705@item
1706IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
1707@item
1708On-chip OHCI USB controller
1709@item
1710On-chip LCD controller
1711@item
1712On-chip Real Time Clock
1713@item
1714TI ADS7846 touchscreen controller on SSP bus
1715@item
1716Maxim MAX1111 analog-digital converter on I@math{^2}C bus
1717@item
1718GPIO-connected keyboard controller and LEDs
1719@item
balrog549444e2007-05-01 17:53:37 +00001720Secure Digital card connected to PXA MMC/SD host
balrogb00052e2007-04-30 02:22:06 +00001721@item
1722Three on-chip UARTs
1723@item
1724WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
1725@end itemize
1726
balrog02645922007-11-03 12:50:46 +00001727The Palm Tungsten|E PDA (codename "Cheetah") emulation includes the
1728following elements:
1729
1730@itemize @minus
1731@item
1732Texas Instruments OMAP310 System-on-chip (ARM 925T core)
1733@item
1734ROM and RAM memories (ROM firmware image can be loaded with -option-rom)
1735@item
1736On-chip LCD controller
1737@item
1738On-chip Real Time Clock
1739@item
1740TI TSC2102i touchscreen controller / analog-digital converter / Audio
1741CODEC, connected through MicroWire and I@math{^2}S busses
1742@item
1743GPIO-connected matrix keypad
1744@item
1745Secure Digital card connected to OMAP MMC/SD host
1746@item
1747Three on-chip UARTs
1748@end itemize
1749
balrogc30bb262008-05-18 13:01:40 +00001750Nokia N800 and N810 internet tablets (known also as RX-34 and RX-44 / 48)
1751emulation supports the following elements:
1752
1753@itemize @minus
1754@item
1755Texas Instruments OMAP2420 System-on-chip (ARM 1136 core)
1756@item
1757RAM and non-volatile OneNAND Flash memories
1758@item
1759Display connected to EPSON remote framebuffer chip and OMAP on-chip
1760display controller and a LS041y3 MIPI DBI-C controller
1761@item
1762TI TSC2301 (in N800) and TI TSC2005 (in N810) touchscreen controllers
1763driven through SPI bus
1764@item
1765National Semiconductor LM8323-controlled qwerty keyboard driven
1766through I@math{^2}C bus
1767@item
1768Secure Digital card connected to OMAP MMC/SD host
1769@item
1770Three OMAP on-chip UARTs and on-chip STI debugging console
1771@item
balrog2d564692008-11-09 02:24:54 +00001772A Bluetooth(R) transciever and HCI connected to an UART
1773@item
balrogc30bb262008-05-18 13:01:40 +00001774Mentor Graphics "Inventra" dual-role USB controller embedded in a TI
1775TUSB6010 chip - only USB host mode is supported
1776@item
1777TI TMP105 temperature sensor driven through I@math{^2}C bus
1778@item
1779TI TWL92230C power management companion with an RTC on I@math{^2}C bus
1780@item
1781Nokia RETU and TAHVO multi-purpose chips with an RTC, connected
1782through CBUS
1783@end itemize
1784
pbrook9ee6e8b2007-11-11 00:04:49 +00001785The Luminary Micro Stellaris LM3S811EVB emulation includes the following
1786devices:
1787
1788@itemize @minus
1789@item
1790Cortex-M3 CPU core.
1791@item
179264k Flash and 8k SRAM.
1793@item
1794Timers, UARTs, ADC and I@math{^2}C interface.
1795@item
1796OSRAM Pictiva 96x16 OLED with SSD0303 controller on I@math{^2}C bus.
1797@end itemize
1798
1799The Luminary Micro Stellaris LM3S6965EVB emulation includes the following
1800devices:
1801
1802@itemize @minus
1803@item
1804Cortex-M3 CPU core.
1805@item
1806256k Flash and 64k SRAM.
1807@item
1808Timers, UARTs, ADC, I@math{^2}C and SSI interfaces.
1809@item
1810OSRAM Pictiva 128x64 OLED with SSD0323 controller connected via SSI.
1811@end itemize
1812
balrog57cd6e92008-05-07 12:23:32 +00001813The Freecom MusicPal internet radio emulation includes the following
1814elements:
1815
1816@itemize @minus
1817@item
1818Marvell MV88W8618 ARM core.
1819@item
182032 MB RAM, 256 KB SRAM, 8 MB flash.
1821@item
1822Up to 2 16550 UARTs
1823@item
1824MV88W8xx8 Ethernet controller
1825@item
1826MV88W8618 audio controller, WM8750 CODEC and mixer
1827@item
1828128×64 display with brightness control
1829@item
18302 buttons, 2 navigation wheels with button function
1831@end itemize
1832
balrog997641a2008-12-15 02:05:00 +00001833The Siemens SX1 models v1 and v2 (default) basic emulation.
1834The emulaton includes the following elements:
1835
1836@itemize @minus
1837@item
1838Texas Instruments OMAP310 System-on-chip (ARM 925T core)
1839@item
1840ROM and RAM memories (ROM firmware image can be loaded with -pflash)
1841V1
18421 Flash of 16MB and 1 Flash of 8MB
1843V2
18441 Flash of 32MB
1845@item
1846On-chip LCD controller
1847@item
1848On-chip Real Time Clock
1849@item
1850Secure Digital card connected to OMAP MMC/SD host
1851@item
1852Three on-chip UARTs
1853@end itemize
1854
Paul Brook4af39612009-05-14 23:11:09 +01001855The "Syborg" Symbian Virtual Platform base model includes the following
1856elements:
1857
1858@itemize @minus
1859@item
1860ARM Cortex-A8 CPU
1861@item
1862Interrupt controller
1863@item
1864Timer
1865@item
1866Real Time Clock
1867@item
1868Keyboard
1869@item
1870Framebuffer
1871@item
1872Touchscreen
1873@item
1874UARTs
1875@end itemize
1876
bellard3f9f3aa2005-12-18 20:11:37 +00001877A Linux 2.6 test image is available on the QEMU web site. More
1878information is available in the QEMU mailing-list archive.
1879
blueswir1d2c639d2009-01-24 18:19:25 +00001880@c man begin OPTIONS
1881
1882The following options are specific to the ARM emulation:
1883
1884@table @option
1885
1886@item -semihosting
1887Enable semihosting syscall emulation.
1888
1889On ARM this implements the "Angel" interface.
1890
1891Note that this allows guest direct access to the host filesystem,
1892so should only be used with trusted guest OS.
1893
1894@end table
1895
ths24d4de42007-07-11 10:24:28 +00001896@node ColdFire System emulator
1897@section ColdFire System emulator
pbrook209a4e62007-05-23 20:16:15 +00001898
1899Use the executable @file{qemu-system-m68k} to simulate a ColdFire machine.
1900The emulator is able to boot a uClinux kernel.
pbrook707e0112007-06-04 00:50:06 +00001901
1902The M5208EVB emulation includes the following devices:
1903
1904@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001905@item
pbrook707e0112007-06-04 00:50:06 +00001906MCF5208 ColdFire V2 Microprocessor (ISA A+ with EMAC).
1907@item
1908Three Two on-chip UARTs.
1909@item
1910Fast Ethernet Controller (FEC)
1911@end itemize
1912
1913The AN5206 emulation includes the following devices:
pbrook209a4e62007-05-23 20:16:15 +00001914
1915@itemize @minus
ths5fafdf22007-09-16 21:08:06 +00001916@item
pbrook209a4e62007-05-23 20:16:15 +00001917MCF5206 ColdFire V2 Microprocessor.
1918@item
1919Two on-chip UARTs.
1920@end itemize
1921
blueswir1d2c639d2009-01-24 18:19:25 +00001922@c man begin OPTIONS
1923
1924The following options are specific to the ARM emulation:
1925
1926@table @option
1927
1928@item -semihosting
1929Enable semihosting syscall emulation.
1930
1931On M68K this implements the "ColdFire GDB" interface used by libgloss.
1932
1933Note that this allows guest direct access to the host filesystem,
1934so should only be used with trusted guest OS.
1935
1936@end table
1937
ths5fafdf22007-09-16 21:08:06 +00001938@node QEMU User space emulator
1939@chapter QEMU User space emulator
bellard83195232007-02-05 19:42:07 +00001940
1941@menu
1942* Supported Operating Systems ::
1943* Linux User space emulator::
1944* Mac OS X/Darwin User space emulator ::
blueswir184778502008-10-26 20:33:16 +00001945* BSD User space emulator ::
bellard83195232007-02-05 19:42:07 +00001946@end menu
1947
1948@node Supported Operating Systems
1949@section Supported Operating Systems
1950
1951The following OS are supported in user space emulation:
1952
1953@itemize @minus
1954@item
ths4be456f2007-06-03 13:41:28 +00001955Linux (referred as qemu-linux-user)
bellard83195232007-02-05 19:42:07 +00001956@item
ths4be456f2007-06-03 13:41:28 +00001957Mac OS X/Darwin (referred as qemu-darwin-user)
blueswir184778502008-10-26 20:33:16 +00001958@item
1959BSD (referred as qemu-bsd-user)
bellard83195232007-02-05 19:42:07 +00001960@end itemize
1961
1962@node Linux User space emulator
1963@section Linux User space emulator
bellard386405f2003-03-23 21:28:45 +00001964
bellarddebc7062006-04-30 21:58:41 +00001965@menu
1966* Quick Start::
1967* Wine launch::
1968* Command line options::
pbrook79737e42006-06-11 16:28:41 +00001969* Other binaries::
bellarddebc7062006-04-30 21:58:41 +00001970@end menu
1971
1972@node Quick Start
bellard83195232007-02-05 19:42:07 +00001973@subsection Quick Start
bellard386405f2003-03-23 21:28:45 +00001974
bellard1f673132004-04-04 15:21:17 +00001975In order to launch a Linux process, QEMU needs the process executable
ths5fafdf22007-09-16 21:08:06 +00001976itself and all the target (x86) dynamic libraries used by it.
bellard386405f2003-03-23 21:28:45 +00001977
bellard1f673132004-04-04 15:21:17 +00001978@itemize
bellard386405f2003-03-23 21:28:45 +00001979
bellard1f673132004-04-04 15:21:17 +00001980@item On x86, you can just try to launch any process by using the native
1981libraries:
bellard386405f2003-03-23 21:28:45 +00001982
ths5fafdf22007-09-16 21:08:06 +00001983@example
bellard1f673132004-04-04 15:21:17 +00001984qemu-i386 -L / /bin/ls
1985@end example
bellardfd429f22003-03-30 20:59:46 +00001986
bellard1f673132004-04-04 15:21:17 +00001987@code{-L /} tells that the x86 dynamic linker must be searched with a
1988@file{/} prefix.
bellard1eb20522003-06-25 16:21:49 +00001989
thsdbcf5e82007-02-10 22:14:55 +00001990@item Since QEMU is also a linux process, you can launch qemu with
1991qemu (NOTE: you can only do that if you compiled QEMU from the sources):
bellard1eb20522003-06-25 16:21:49 +00001992
ths5fafdf22007-09-16 21:08:06 +00001993@example
bellard1f673132004-04-04 15:21:17 +00001994qemu-i386 -L / qemu-i386 -L / /bin/ls
1995@end example
bellard386405f2003-03-23 21:28:45 +00001996
bellard1f673132004-04-04 15:21:17 +00001997@item On non x86 CPUs, you need first to download at least an x86 glibc
1998(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1999@code{LD_LIBRARY_PATH} is not set:
bellard386405f2003-03-23 21:28:45 +00002000
bellard1f673132004-04-04 15:21:17 +00002001@example
ths5fafdf22007-09-16 21:08:06 +00002002unset LD_LIBRARY_PATH
bellard1f673132004-04-04 15:21:17 +00002003@end example
bellard386405f2003-03-23 21:28:45 +00002004
bellard1f673132004-04-04 15:21:17 +00002005Then you can launch the precompiled @file{ls} x86 executable:
bellard386405f2003-03-23 21:28:45 +00002006
bellard1f673132004-04-04 15:21:17 +00002007@example
2008qemu-i386 tests/i386/ls
2009@end example
2010You can look at @file{qemu-binfmt-conf.sh} so that
2011QEMU is automatically launched by the Linux kernel when you try to
2012launch x86 executables. It requires the @code{binfmt_misc} module in the
2013Linux kernel.
bellard386405f2003-03-23 21:28:45 +00002014
bellard1f673132004-04-04 15:21:17 +00002015@item The x86 version of QEMU is also included. You can try weird things such as:
2016@example
bellarddebc7062006-04-30 21:58:41 +00002017qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
2018 /usr/local/qemu-i386/bin/ls-i386
bellard1f673132004-04-04 15:21:17 +00002019@end example
bellard386405f2003-03-23 21:28:45 +00002020
bellard1f673132004-04-04 15:21:17 +00002021@end itemize
bellard386405f2003-03-23 21:28:45 +00002022
bellarddebc7062006-04-30 21:58:41 +00002023@node Wine launch
bellard83195232007-02-05 19:42:07 +00002024@subsection Wine launch
bellard386405f2003-03-23 21:28:45 +00002025
bellard1f673132004-04-04 15:21:17 +00002026@itemize
bellard386405f2003-03-23 21:28:45 +00002027
bellard1f673132004-04-04 15:21:17 +00002028@item Ensure that you have a working QEMU with the x86 glibc
2029distribution (see previous section). In order to verify it, you must be
2030able to do:
bellard386405f2003-03-23 21:28:45 +00002031
bellard1f673132004-04-04 15:21:17 +00002032@example
2033qemu-i386 /usr/local/qemu-i386/bin/ls-i386
2034@end example
bellard386405f2003-03-23 21:28:45 +00002035
bellard1f673132004-04-04 15:21:17 +00002036@item Download the binary x86 Wine install
ths5fafdf22007-09-16 21:08:06 +00002037(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
bellard386405f2003-03-23 21:28:45 +00002038
bellard1f673132004-04-04 15:21:17 +00002039@item Configure Wine on your account. Look at the provided script
bellarddebc7062006-04-30 21:58:41 +00002040@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
bellard1f673132004-04-04 15:21:17 +00002041@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
bellard386405f2003-03-23 21:28:45 +00002042
bellard1f673132004-04-04 15:21:17 +00002043@item Then you can try the example @file{putty.exe}:
bellard386405f2003-03-23 21:28:45 +00002044
bellard1f673132004-04-04 15:21:17 +00002045@example
bellarddebc7062006-04-30 21:58:41 +00002046qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
2047 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
bellard1f673132004-04-04 15:21:17 +00002048@end example
bellard386405f2003-03-23 21:28:45 +00002049
bellard1f673132004-04-04 15:21:17 +00002050@end itemize
bellard386405f2003-03-23 21:28:45 +00002051
bellarddebc7062006-04-30 21:58:41 +00002052@node Command line options
bellard83195232007-02-05 19:42:07 +00002053@subsection Command line options
bellard386405f2003-03-23 21:28:45 +00002054
bellard1f673132004-04-04 15:21:17 +00002055@example
Paul Brook379f6692009-07-17 12:48:08 +01002056usage: qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] program [arguments...]
bellard1f673132004-04-04 15:21:17 +00002057@end example
bellard386405f2003-03-23 21:28:45 +00002058
bellard1f673132004-04-04 15:21:17 +00002059@table @option
2060@item -h
2061Print the help
ths3b46e622007-09-17 08:09:54 +00002062@item -L path
bellard1f673132004-04-04 15:21:17 +00002063Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
2064@item -s size
2065Set the x86 stack size in bytes (default=524288)
blueswir134a3d232008-10-04 20:43:39 +00002066@item -cpu model
2067Select CPU model (-cpu ? for list and additional feature selection)
Paul Brook379f6692009-07-17 12:48:08 +01002068@item -B offset
2069Offset guest address by the specified number of bytes. This is useful when
2070the address region rewuired by guest applications is reserved on the host.
2071Ths option is currently only supported on some hosts.
bellard386405f2003-03-23 21:28:45 +00002072@end table
2073
bellard1f673132004-04-04 15:21:17 +00002074Debug options:
bellard386405f2003-03-23 21:28:45 +00002075
bellard1f673132004-04-04 15:21:17 +00002076@table @option
2077@item -d
2078Activate log (logfile=/tmp/qemu.log)
2079@item -p pagesize
2080Act as if the host page size was 'pagesize' bytes
blueswir134a3d232008-10-04 20:43:39 +00002081@item -g port
2082Wait gdb connection to port
aurel321b530a62009-04-05 20:08:59 +00002083@item -singlestep
2084Run the emulation in single step mode.
bellard1f673132004-04-04 15:21:17 +00002085@end table
bellard386405f2003-03-23 21:28:45 +00002086
balrogb01bcae2007-12-16 13:05:59 +00002087Environment variables:
2088
2089@table @env
2090@item QEMU_STRACE
2091Print system calls and arguments similar to the 'strace' program
2092(NOTE: the actual 'strace' program will not work because the user
2093space emulator hasn't implemented ptrace). At the moment this is
2094incomplete. All system calls that don't have a specific argument
2095format are printed with information for six arguments. Many
2096flag-style arguments don't have decoders and will show up as numbers.
ths5cfdf932007-12-17 03:38:26 +00002097@end table
balrogb01bcae2007-12-16 13:05:59 +00002098
pbrook79737e42006-06-11 16:28:41 +00002099@node Other binaries
bellard83195232007-02-05 19:42:07 +00002100@subsection Other binaries
pbrook79737e42006-06-11 16:28:41 +00002101
2102@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
2103binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
2104configurations), and arm-uclinux bFLT format binaries.
2105
pbrooke6e59062006-10-22 00:18:54 +00002106@command{qemu-m68k} is capable of running semihosted binaries using the BDM
2107(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
2108coldfire uClinux bFLT format binaries.
2109
pbrook79737e42006-06-11 16:28:41 +00002110The binary format is detected automatically.
2111
blueswir134a3d232008-10-04 20:43:39 +00002112@command{qemu-sparc} can execute Sparc32 binaries (Sparc32 CPU, 32 bit ABI).
2113
blueswir1a785e422007-10-20 08:09:05 +00002114@command{qemu-sparc32plus} can execute Sparc32 and SPARC32PLUS binaries
2115(Sparc64 CPU, 32 bit ABI).
2116
2117@command{qemu-sparc64} can execute some Sparc64 (Sparc64 CPU, 64 bit ABI) and
2118SPARC32PLUS binaries (Sparc64 CPU, 32 bit ABI).
2119
bellard83195232007-02-05 19:42:07 +00002120@node Mac OS X/Darwin User space emulator
2121@section Mac OS X/Darwin User space emulator
2122
2123@menu
2124* Mac OS X/Darwin Status::
2125* Mac OS X/Darwin Quick Start::
2126* Mac OS X/Darwin Command line options::
2127@end menu
2128
2129@node Mac OS X/Darwin Status
2130@subsection Mac OS X/Darwin Status
2131
2132@itemize @minus
2133@item
2134target x86 on x86: Most apps (Cocoa and Carbon too) works. [1]
2135@item
2136target PowerPC on x86: Not working as the ppc commpage can't be mapped (yet!)
2137@item
thsdbcf5e82007-02-10 22:14:55 +00002138target PowerPC on PowerPC: Most apps (Cocoa and Carbon too) works. [1]
bellard83195232007-02-05 19:42:07 +00002139@item
2140target x86 on PowerPC: most utilities work. Cocoa and Carbon apps are not yet supported.
2141@end itemize
2142
2143[1] If you're host commpage can be executed by qemu.
2144
2145@node Mac OS X/Darwin Quick Start
2146@subsection Quick Start
2147
2148In order to launch a Mac OS X/Darwin process, QEMU needs the process executable
2149itself and all the target dynamic libraries used by it. If you don't have the FAT
2150libraries (you're running Mac OS X/ppc) you'll need to obtain it from a Mac OS X
2151CD or compile them by hand.
2152
2153@itemize
2154
2155@item On x86, you can just try to launch any process by using the native
2156libraries:
2157
ths5fafdf22007-09-16 21:08:06 +00002158@example
thsdbcf5e82007-02-10 22:14:55 +00002159qemu-i386 /bin/ls
bellard83195232007-02-05 19:42:07 +00002160@end example
2161
2162or to run the ppc version of the executable:
2163
ths5fafdf22007-09-16 21:08:06 +00002164@example
thsdbcf5e82007-02-10 22:14:55 +00002165qemu-ppc /bin/ls
bellard83195232007-02-05 19:42:07 +00002166@end example
2167
2168@item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
2169are installed:
2170
ths5fafdf22007-09-16 21:08:06 +00002171@example
thsdbcf5e82007-02-10 22:14:55 +00002172qemu-i386 -L /opt/x86_root/ /bin/ls
bellard83195232007-02-05 19:42:07 +00002173@end example
2174
2175@code{-L /opt/x86_root/} tells that the dynamic linker (dyld) path is in
2176@file{/opt/x86_root/usr/bin/dyld}.
2177
2178@end itemize
2179
2180@node Mac OS X/Darwin Command line options
2181@subsection Command line options
2182
2183@example
thsdbcf5e82007-02-10 22:14:55 +00002184usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
bellard83195232007-02-05 19:42:07 +00002185@end example
2186
2187@table @option
2188@item -h
2189Print the help
ths3b46e622007-09-17 08:09:54 +00002190@item -L path
bellard83195232007-02-05 19:42:07 +00002191Set the library root path (default=/)
2192@item -s size
2193Set the stack size in bytes (default=524288)
2194@end table
2195
2196Debug options:
2197
2198@table @option
2199@item -d
2200Activate log (logfile=/tmp/qemu.log)
2201@item -p pagesize
2202Act as if the host page size was 'pagesize' bytes
aurel321b530a62009-04-05 20:08:59 +00002203@item -singlestep
2204Run the emulation in single step mode.
bellard83195232007-02-05 19:42:07 +00002205@end table
2206
blueswir184778502008-10-26 20:33:16 +00002207@node BSD User space emulator
2208@section BSD User space emulator
2209
2210@menu
2211* BSD Status::
2212* BSD Quick Start::
2213* BSD Command line options::
2214@end menu
2215
2216@node BSD Status
2217@subsection BSD Status
2218
2219@itemize @minus
2220@item
2221target Sparc64 on Sparc64: Some trivial programs work.
2222@end itemize
2223
2224@node BSD Quick Start
2225@subsection Quick Start
2226
2227In order to launch a BSD process, QEMU needs the process executable
2228itself and all the target dynamic libraries used by it.
2229
2230@itemize
2231
2232@item On Sparc64, you can just try to launch any process by using the native
2233libraries:
2234
2235@example
2236qemu-sparc64 /bin/ls
2237@end example
2238
2239@end itemize
2240
2241@node BSD Command line options
2242@subsection Command line options
2243
2244@example
2245usage: qemu-sparc64 [-h] [-d] [-L path] [-s size] [-bsd type] program [arguments...]
2246@end example
2247
2248@table @option
2249@item -h
2250Print the help
2251@item -L path
2252Set the library root path (default=/)
2253@item -s size
2254Set the stack size in bytes (default=524288)
2255@item -bsd type
2256Set the type of the emulated BSD Operating system. Valid values are
2257FreeBSD, NetBSD and OpenBSD (default).
2258@end table
2259
2260Debug options:
2261
2262@table @option
2263@item -d
2264Activate log (logfile=/tmp/qemu.log)
2265@item -p pagesize
2266Act as if the host page size was 'pagesize' bytes
aurel321b530a62009-04-05 20:08:59 +00002267@item -singlestep
2268Run the emulation in single step mode.
blueswir184778502008-10-26 20:33:16 +00002269@end table
2270
bellard15a34c62004-07-08 21:26:26 +00002271@node compilation
2272@chapter Compilation from the sources
2273
bellarddebc7062006-04-30 21:58:41 +00002274@menu
2275* Linux/Unix::
2276* Windows::
2277* Cross compilation for Windows with Linux::
2278* Mac OS X::
2279@end menu
2280
2281@node Linux/Unix
bellard7c3fc842005-02-10 21:46:47 +00002282@section Linux/Unix
bellard15a34c62004-07-08 21:26:26 +00002283
bellard7c3fc842005-02-10 21:46:47 +00002284@subsection Compilation
2285
2286First you must decompress the sources:
2287@example
2288cd /tmp
2289tar zxvf qemu-x.y.z.tar.gz
2290cd qemu-x.y.z
2291@end example
2292
2293Then you configure QEMU and build it (usually no options are needed):
2294@example
2295./configure
2296make
2297@end example
2298
2299Then type as root user:
2300@example
2301make install
2302@end example
2303to install QEMU in @file{/usr/local}.
2304
bellarddebc7062006-04-30 21:58:41 +00002305@node Windows
bellard15a34c62004-07-08 21:26:26 +00002306@section Windows
2307
2308@itemize
2309@item Install the current versions of MSYS and MinGW from
2310@url{http://www.mingw.org/}. You can find detailed installation
2311instructions in the download section and the FAQ.
2312
ths5fafdf22007-09-16 21:08:06 +00002313@item Download
bellard15a34c62004-07-08 21:26:26 +00002314the MinGW development library of SDL 1.2.x
bellarddebc7062006-04-30 21:58:41 +00002315(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
bellard15a34c62004-07-08 21:26:26 +00002316@url{http://www.libsdl.org}. Unpack it in a temporary place, and
2317unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
2318directory. Edit the @file{sdl-config} script so that it gives the
2319correct SDL directory when invoked.
2320
2321@item Extract the current version of QEMU.
ths5fafdf22007-09-16 21:08:06 +00002322
bellard15a34c62004-07-08 21:26:26 +00002323@item Start the MSYS shell (file @file{msys.bat}).
2324
ths5fafdf22007-09-16 21:08:06 +00002325@item Change to the QEMU directory. Launch @file{./configure} and
bellard15a34c62004-07-08 21:26:26 +00002326@file{make}. If you have problems using SDL, verify that
2327@file{sdl-config} can be launched from the MSYS command line.
2328
ths5fafdf22007-09-16 21:08:06 +00002329@item You can install QEMU in @file{Program Files/Qemu} by typing
bellard15a34c62004-07-08 21:26:26 +00002330@file{make install}. Don't forget to copy @file{SDL.dll} in
2331@file{Program Files/Qemu}.
2332
2333@end itemize
2334
bellarddebc7062006-04-30 21:58:41 +00002335@node Cross compilation for Windows with Linux
bellard15a34c62004-07-08 21:26:26 +00002336@section Cross compilation for Windows with Linux
2337
2338@itemize
2339@item
2340Install the MinGW cross compilation tools available at
2341@url{http://www.mingw.org/}.
2342
ths5fafdf22007-09-16 21:08:06 +00002343@item
bellard15a34c62004-07-08 21:26:26 +00002344Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
2345unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
2346variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
2347the QEMU configuration script.
2348
ths5fafdf22007-09-16 21:08:06 +00002349@item
bellard15a34c62004-07-08 21:26:26 +00002350Configure QEMU for Windows cross compilation:
2351@example
2352./configure --enable-mingw32
2353@end example
2354If necessary, you can change the cross-prefix according to the prefix
ths4be456f2007-06-03 13:41:28 +00002355chosen for the MinGW tools with --cross-prefix. You can also use
bellard15a34c62004-07-08 21:26:26 +00002356--prefix to set the Win32 install path.
2357
ths5fafdf22007-09-16 21:08:06 +00002358@item You can install QEMU in the installation directory by typing
bellard15a34c62004-07-08 21:26:26 +00002359@file{make install}. Don't forget to copy @file{SDL.dll} in the
ths5fafdf22007-09-16 21:08:06 +00002360installation directory.
bellard15a34c62004-07-08 21:26:26 +00002361
2362@end itemize
2363
2364Note: Currently, Wine does not seem able to launch
2365QEMU for Win32.
2366
bellarddebc7062006-04-30 21:58:41 +00002367@node Mac OS X
bellard15a34c62004-07-08 21:26:26 +00002368@section Mac OS X
2369
2370The Mac OS X patches are not fully merged in QEMU, so you should look
2371at the QEMU mailing list archive to have all the necessary
2372information.
2373
bellarddebc7062006-04-30 21:58:41 +00002374@node Index
2375@chapter Index
2376@printindex cp
2377
2378@bye