]> git.proxmox.com Git - qemu.git/blame - qemu-doc.texi
Set OpenBIOS variables in NVRAM
[qemu.git] / qemu-doc.texi
CommitLineData
386405f7 1\input texinfo @c -*- texinfo -*-
debc7065
FB
2@c %**start of header
3@setfilename qemu-doc.info
8f40c388 4@settitle QEMU Emulator User Documentation
debc7065
FB
5@exampleindent 0
6@paragraphindent 0
7@c %**end of header
386405f7 8
0806e3f6 9@iftex
386405f7
FB
10@titlepage
11@sp 7
8f40c388 12@center @titlefont{QEMU Emulator}
debc7065
FB
13@sp 1
14@center @titlefont{User Documentation}
386405f7
FB
15@sp 3
16@end titlepage
0806e3f6 17@end iftex
386405f7 18
debc7065
FB
19@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::
83195237 28* QEMU User space emulator::
debc7065
FB
29* compilation:: Compilation from the sources
30* Index::
31@end menu
32@end ifnottex
33
34@contents
35
36@node Introduction
386405f7
FB
37@chapter Introduction
38
debc7065
FB
39@menu
40* intro_features:: Features
41@end menu
42
43@node intro_features
322d0c66 44@section Features
386405f7 45
1f673135
FB
46QEMU is a FAST! processor emulator using dynamic translation to
47achieve good emulation speed.
1eb20527
FB
48
49QEMU has two operating modes:
0806e3f6
FB
50
51@itemize @minus
52
53@item
1f673135 54Full system emulation. In this mode, QEMU emulates a full system (for
3f9f3aa1
FB
55example 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.
1eb20527 58
0806e3f6 59@item
83195237
FB
60User mode emulation. In this mode, QEMU can launch
61processes compiled for one CPU on another CPU. It can be used to
1f673135
FB
62launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
63to ease cross-compilation and cross-debugging.
1eb20527
FB
64
65@end itemize
66
7c3fc84d 67QEMU can run without an host kernel driver and yet gives acceptable
6f2f2b24 68performance.
322d0c66 69
52c00a5f
FB
70For system emulation, the following hardware targets are supported:
71@itemize
9d0a8e6f 72@item PC (x86 or x86_64 processor)
3f9f3aa1 73@item ISA PC (old style PC without PCI bus)
52c00a5f 74@item PREP (PowerPC processor)
9d0a8e6f
FB
75@item G3 BW PowerMac (PowerPC processor)
76@item Mac99 PowerMac (PowerPC processor, in progress)
3475187d
FB
77@item Sun4m (32-bit Sparc processor)
78@item Sun4u (64-bit Sparc processor, in progress)
3f9f3aa1 79@item Malta board (32-bit MIPS processor)
ed96ca35 80@item ARM Integrator/CP (ARM926E or 1026E processor)
00a9bf19 81@item ARM Versatile baseboard (ARM926E)
d7739d75 82@item ARM RealView Emulation baseboard (ARM926EJ-S)
b00052e4 83@item Spitz, Akita, Borzoi and Terrier PDAs (PXA270 processor)
52c00a5f 84@end itemize
386405f7 85
e6e5906b 86For user emulation, x86, PowerPC, ARM, MIPS, Sparc32/64 and ColdFire(m68k) CPUs are supported.
0806e3f6 87
debc7065 88@node Installation
5b9f457a
FB
89@chapter Installation
90
15a34c63
FB
91If you want to compile QEMU yourself, see @ref{compilation}.
92
debc7065
FB
93@menu
94* install_linux:: Linux
95* install_windows:: Windows
96* install_mac:: Macintosh
97@end menu
98
99@node install_linux
1f673135
FB
100@section Linux
101
7c3fc84d
FB
102If a precompiled package is available for your distribution - you just
103have to install it. Otherwise, see @ref{compilation}.
5b9f457a 104
debc7065 105@node install_windows
1f673135 106@section Windows
8cd0ac2f 107
15a34c63 108Download the experimental binary installer at
debc7065 109@url{http://www.free.oszoo.org/@/download.html}.
d691f669 110
debc7065 111@node install_mac
1f673135 112@section Mac OS X
d691f669 113
15a34c63 114Download the experimental binary installer at
debc7065 115@url{http://www.free.oszoo.org/@/download.html}.
df0f11a0 116
debc7065 117@node QEMU PC System emulator
3f9f3aa1 118@chapter QEMU PC System emulator
1eb20527 119
debc7065
FB
120@menu
121* pcsys_introduction:: Introduction
122* pcsys_quickstart:: Quick Start
123* sec_invocation:: Invocation
124* pcsys_keys:: Keys
125* pcsys_monitor:: QEMU Monitor
126* disk_images:: Disk Images
127* pcsys_network:: Network emulation
128* direct_linux_boot:: Direct Linux Boot
129* pcsys_usb:: USB emulation
130* gdb_usage:: GDB usage
131* pcsys_os_specific:: Target OS specific information
132@end menu
133
134@node pcsys_introduction
0806e3f6
FB
135@section Introduction
136
137@c man begin DESCRIPTION
138
3f9f3aa1
FB
139The QEMU PC System emulator simulates the
140following peripherals:
0806e3f6
FB
141
142@itemize @minus
15a34c63
FB
143@item
144i440FX host PCI bridge and PIIX3 PCI to ISA bridge
0806e3f6 145@item
15a34c63
FB
146Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
147extensions (hardware level, including all non standard modes).
0806e3f6
FB
148@item
149PS/2 mouse and keyboard
150@item
15a34c63 1512 PCI IDE interfaces with hard disk and CD-ROM support
1f673135
FB
152@item
153Floppy disk
0806e3f6 154@item
15a34c63 155NE2000 PCI network adapters
0806e3f6 156@item
05d5818c
FB
157Serial ports
158@item
c0fe3827
FB
159Creative SoundBlaster 16 sound card
160@item
161ENSONIQ AudioPCI ES1370 sound card
162@item
163Adlib(OPL2) - Yamaha YM3812 compatible chip
b389dbfb
FB
164@item
165PCI UHCI USB controller and a virtual USB hub.
0806e3f6
FB
166@end itemize
167
3f9f3aa1
FB
168SMP is supported with up to 255 CPUs.
169
c0fe3827
FB
170Note that adlib is only available when QEMU was configured with
171-enable-adlib
172
15a34c63
FB
173QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
174VGA BIOS.
175
c0fe3827
FB
176QEMU uses YM3812 emulation by Tatsuyuki Satoh.
177
0806e3f6
FB
178@c man end
179
debc7065 180@node pcsys_quickstart
1eb20527
FB
181@section Quick Start
182
285dc330 183Download and uncompress the linux image (@file{linux.img}) and type:
0806e3f6
FB
184
185@example
285dc330 186qemu linux.img
0806e3f6
FB
187@end example
188
189Linux should boot and give you a prompt.
190
6cc721cf 191@node sec_invocation
ec410fc9
FB
192@section Invocation
193
194@example
0806e3f6
FB
195@c man begin SYNOPSIS
196usage: qemu [options] [disk_image]
197@c man end
ec410fc9
FB
198@end example
199
0806e3f6 200@c man begin OPTIONS
9d4520d0 201@var{disk_image} is a raw hard disk image for IDE hard disk 0.
ec410fc9
FB
202
203General options:
204@table @option
3dbbdc25
FB
205@item -M machine
206Select the emulated machine (@code{-M ?} for list)
207
2be3bc02
FB
208@item -fda file
209@item -fdb file
debc7065 210Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You can
19cb3738 211use the host floppy by using @file{/dev/fd0} as filename (@pxref{host_drives}).
2be3bc02 212
ec410fc9
FB
213@item -hda file
214@item -hdb file
181f1558
FB
215@item -hdc file
216@item -hdd file
debc7065 217Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
1f47a922 218
181f1558
FB
219@item -cdrom file
220Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
be3edd95 221@option{-cdrom} at the same time). You can use the host CD-ROM by
19cb3738 222using @file{/dev/cdrom} as filename (@pxref{host_drives}).
181f1558 223
eec85c2a
TS
224@item -boot [a|c|d|n]
225Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot
226is the default.
1f47a922 227
181f1558 228@item -snapshot
1f47a922
FB
229Write to temporary files instead of disk image files. In this case,
230the raw disk image you use is not written back. You can however force
42550fde 231the write back by pressing @key{C-a s} (@pxref{disk_images}).
ec410fc9 232
52ca8d6a
FB
233@item -no-fd-bootchk
234Disable boot signature checking for floppy disks in Bochs BIOS. It may
235be needed to boot from old floppy disks.
236
ec410fc9 237@item -m megs
15a34c63 238Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
ec410fc9 239
3f9f3aa1
FB
240@item -smp n
241Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
242CPUs are supported.
243
0806e3f6
FB
244@item -nographic
245
246Normally, QEMU uses SDL to display the VGA output. With this option,
247you can totally disable graphical output so that QEMU is a simple
248command line application. The emulated serial port is redirected on
249the console. Therefore, you can still use QEMU to debug a Linux kernel
250with a serial console.
251
5f189496
TS
252@item -no-frame
253
254Do not use decorations for SDL windows and start them using the whole
255available screen space. This makes the using QEMU in a dedicated desktop
256workspace more convenient.
257
73fc9742 258@item -vnc display
24236869
FB
259
260Normally, QEMU uses SDL to display the VGA output. With this option,
73fc9742 261you can have QEMU listen on VNC display @var{display} and redirect the VGA
3c656346
FB
262display over the VNC session. It is very useful to enable the usb
263tablet device when using this option (option @option{-usbdevice
264tablet}). When using the VNC display, you must use the @option{-k}
73fc9742
TS
265option to set the keyboard layout if you are not using en-us.
266
267@var{display} may be in the form @var{interface:d}, in which case connections
268will only be allowed from @var{interface} on display @var{d}. Optionally,
269@var{interface} can be omitted. @var{display} can also be in the form
270@var{unix:path} where @var{path} is the location of a unix socket to listen for
271connections on.
272
24236869 273
3d11d0eb
FB
274@item -k language
275
276Use keyboard layout @var{language} (for example @code{fr} for
277French). This option is only needed where it is not easy to get raw PC
3c656346
FB
278keycodes (e.g. on Macs, with some X11 servers or with a VNC
279display). You don't normally need to use it on PC/Linux or PC/Windows
280hosts.
3d11d0eb
FB
281
282The available layouts are:
283@example
284ar de-ch es fo fr-ca hu ja mk no pt-br sv
285da en-gb et fr fr-ch is lt nl pl ru th
286de en-us fi fr-be hr it lv nl-be pt sl tr
287@end example
288
289The default is @code{en-us}.
290
1d14ffa9
FB
291@item -audio-help
292
293Will show the audio subsystem help: list of drivers, tunable
294parameters.
295
6a36d84e 296@item -soundhw card1,card2,... or -soundhw all
1d14ffa9
FB
297
298Enable audio and selected sound hardware. Use ? to print all
299available sound hardware.
300
301@example
302qemu -soundhw sb16,adlib hda
303qemu -soundhw es1370 hda
6a36d84e 304qemu -soundhw all hda
1d14ffa9
FB
305qemu -soundhw ?
306@end example
a8c490cd 307
15a34c63
FB
308@item -localtime
309Set the real time clock to local time (the default is to UTC
310time). This option is needed to have correct date in MS-DOS or
311Windows.
312
d63d307f
FB
313@item -full-screen
314Start in full screen.
315
f7cce898
FB
316@item -pidfile file
317Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
318from a script.
319
71e3ceb8
TS
320@item -daemonize
321Daemonize the QEMU process after initialization. QEMU will not detach from
322standard IO until it is ready to receive connections on any of its devices.
323This option is a useful way for external programs to launch QEMU without having
324to cope with initialization race conditions.
325
9d0a8e6f
FB
326@item -win2k-hack
327Use it when installing Windows 2000 to avoid a disk full bug. After
328Windows 2000 is installed, you no longer need this option (this option
329slows down the IDE transfers).
330
9ae02555
TS
331@item -option-rom file
332Load the contents of file as an option ROM. This option is useful to load
333things like EtherBoot.
334
c35734b2
TS
335@item -name string
336Sets the name of the guest. This name will be display in the SDL window
337caption. The name will also be used for the VNC server.
338
0806e3f6
FB
339@end table
340
b389dbfb
FB
341USB options:
342@table @option
343
344@item -usb
345Enable the USB driver (will be the default soon)
346
347@item -usbdevice devname
0aff66b5 348Add the USB device @var{devname}. @xref{usb_devices}.
b389dbfb
FB
349@end table
350
1f673135
FB
351Network options:
352
353@table @option
354
a41b2ff2 355@item -net nic[,vlan=n][,macaddr=addr][,model=type]
41d03949
FB
356Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
357= 0 is the default). The NIC is currently an NE2000 on the PC
358target. Optionally, the MAC address can be changed. If no
359@option{-net} option is specified, a single NIC is created.
a41b2ff2
PB
360Qemu can emulate several different models of network card. Valid values for
361@var{type} are @code{ne2k_pci}, @code{ne2k_isa}, @code{rtl8139},
362@code{smc91c111} and @code{lance}. Not all devices are supported on all
363targets.
41d03949 364
115defd1 365@item -net user[,vlan=n][,hostname=name]
7e89463d 366Use the user mode network stack which requires no administrator
a03a6053 367priviledge to run. @option{hostname=name} can be used to specify the client
115defd1 368hostname reported by the builtin DHCP server.
41d03949
FB
369
370@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
371Connect the host TAP network interface @var{name} to VLAN @var{n} and
372use the network script @var{file} to configure it. The default
6a1cbf68
TS
373network script is @file{/etc/qemu-ifup}. Use @option{script=no} to
374disable script execution. If @var{name} is not
41d03949
FB
375provided, the OS automatically provides one. @option{fd=h} can be
376used to specify the handle of an already opened host TAP interface. Example:
1f673135 377
41d03949
FB
378@example
379qemu linux.img -net nic -net tap
380@end example
381
382More complicated example (two NICs, each one connected to a TAP device)
383@example
384qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
385 -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
386@end example
3f1a88f4 387
3f1a88f4 388
41d03949 389@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]
1f673135 390
41d03949
FB
391Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual
392machine using a TCP socket connection. If @option{listen} is
393specified, QEMU waits for incoming connections on @var{port}
394(@var{host} is optional). @option{connect} is used to connect to
3d830459
FB
395another QEMU instance using the @option{listen} option. @option{fd=h}
396specifies an already opened TCP socket.
1f673135 397
41d03949
FB
398Example:
399@example
400# launch a first QEMU instance
debc7065
FB
401qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
402 -net socket,listen=:1234
403# connect the VLAN 0 of this instance to the VLAN 0
404# of the first instance
405qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
406 -net socket,connect=127.0.0.1:1234
41d03949 407@end example
52c00a5f 408
3d830459
FB
409@item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]
410
411Create a VLAN @var{n} shared with another QEMU virtual
412machines using a UDP multicast socket, effectively making a bus for
413every QEMU with same multicast address @var{maddr} and @var{port}.
414NOTES:
415@enumerate
416@item
417Several QEMU can be running on different hosts and share same bus (assuming
418correct multicast setup for these hosts).
419@item
420mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
421@url{http://user-mode-linux.sf.net}.
422@item Use @option{fd=h} to specify an already opened UDP multicast socket.
423@end enumerate
424
425Example:
426@example
427# launch one QEMU instance
debc7065
FB
428qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
429 -net socket,mcast=230.0.0.1:1234
3d830459 430# launch another QEMU instance on same "bus"
debc7065
FB
431qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
432 -net socket,mcast=230.0.0.1:1234
3d830459 433# launch yet another QEMU instance on same "bus"
debc7065
FB
434qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
435 -net socket,mcast=230.0.0.1:1234
3d830459
FB
436@end example
437
438Example (User Mode Linux compat.):
439@example
debc7065
FB
440# launch QEMU instance (note mcast address selected
441# is UML's default)
442qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
443 -net socket,mcast=239.192.168.1:1102
3d830459
FB
444# launch UML
445/path/to/linux ubd0=/path/to/root_fs eth0=mcast
446@end example
447
41d03949
FB
448@item -net none
449Indicate that no network devices should be configured. It is used to
039af320
FB
450override the default configuration (@option{-net nic -net user}) which
451is activated if no @option{-net} options are provided.
52c00a5f 452
0db1137d 453@item -tftp dir
9bf05444 454When using the user mode network stack, activate a built-in TFTP
0db1137d
TS
455server. The files in @var{dir} will be exposed as the root of a TFTP server.
456The TFTP client on the guest must be configured in binary mode (use the command
457@code{bin} of the Unix TFTP client). The host IP address on the guest is as
458usual 10.0.2.2.
9bf05444 459
47d5d01a
TS
460@item -bootp file
461When using the user mode network stack, broadcast @var{file} as the BOOTP
462filename. In conjunction with @option{-tftp}, this can be used to network boot
463a guest from a local directory.
464
465Example (using pxelinux):
466@example
467qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0
468@end example
469
2518bd0d
FB
470@item -smb dir
471When using the user mode network stack, activate a built-in SMB
472server so that Windows OSes can access to the host files in @file{dir}
473transparently.
474
475In the guest Windows OS, the line:
476@example
47710.0.2.4 smbserver
478@end example
479must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
480or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
481
482Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
483
484Note that a SAMBA server must be installed on the host OS in
366dfc52 485@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version
6cc721cf 4862.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
2518bd0d 487
9bf05444
FB
488@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
489
490When using the user mode network stack, redirect incoming TCP or UDP
491connections to the host port @var{host-port} to the guest
492@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
493is not specified, its value is 10.0.2.15 (default address given by the
494built-in DHCP server).
495
496For example, to redirect host X11 connection from screen 1 to guest
497screen 0, use the following:
498
499@example
500# on the host
501qemu -redir tcp:6001::6000 [...]
502# this host xterm should open in the guest X11 server
503xterm -display :1
504@end example
505
506To redirect telnet connections from host port 5555 to telnet port on
507the guest, use the following:
508
509@example
510# on the host
511qemu -redir tcp:5555::23 [...]
512telnet localhost 5555
513@end example
514
515Then when you use on the host @code{telnet localhost 5555}, you
516connect to the guest telnet server.
517
1f673135
FB
518@end table
519
41d03949 520Linux boot specific: When using these options, you can use a given
1f673135
FB
521Linux kernel without installing it in the disk image. It can be useful
522for easier testing of various kernels.
523
0806e3f6
FB
524@table @option
525
526@item -kernel bzImage
527Use @var{bzImage} as kernel image.
528
529@item -append cmdline
530Use @var{cmdline} as kernel command line
531
532@item -initrd file
533Use @var{file} as initial ram disk.
534
ec410fc9
FB
535@end table
536
15a34c63 537Debug/Expert options:
ec410fc9 538@table @option
a0a821a4
FB
539
540@item -serial dev
0bab00f3
FB
541Redirect the virtual serial port to host character device
542@var{dev}. The default device is @code{vc} in graphical mode and
543@code{stdio} in non graphical mode.
544
545This option can be used several times to simulate up to 4 serials
546ports.
547
c03b0f0f
FB
548Use @code{-serial none} to disable all serial ports.
549
0bab00f3 550Available character devices are:
a0a821a4
FB
551@table @code
552@item vc
553Virtual console
554@item pty
555[Linux only] Pseudo TTY (a new PTY is automatically allocated)
c03b0f0f
FB
556@item none
557No device is allocated.
a0a821a4
FB
558@item null
559void device
f8d179e3 560@item /dev/XXX
e57a8c0e 561[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
f8d179e3 562parameters are set according to the emulated ones.
e57a8c0e
FB
563@item /dev/parportN
564[Linux only, parallel port only] Use host parallel port
5867c88a 565@var{N}. Currently SPP and EPP parallel port features can be used.
f8d179e3
FB
566@item file:filename
567Write output to filename. No character can be read.
a0a821a4
FB
568@item stdio
569[Unix only] standard input/output
f8d179e3 570@item pipe:filename
0bab00f3
FB
571name pipe @var{filename}
572@item COMn
573[Windows only] Use host serial port @var{n}
951f1351
FB
574@item udp:[remote_host]:remote_port[@@[src_ip]:src_port]
575This implements UDP Net Console. When @var{remote_host} or @var{src_ip} are not specified they default to @code{0.0.0.0}. When not using a specifed @var{src_port} a random port is automatically chosen.
576
577If you just want a simple readonly console you can use @code{netcat} or
578@code{nc}, by starting qemu with: @code{-serial udp::4555} and nc as:
579@code{nc -u -l -p 4555}. Any time qemu writes something to that port it
580will appear in the netconsole session.
0bab00f3
FB
581
582If you plan to send characters back via netconsole or you want to stop
583and start qemu a lot of times, you should have qemu use the same
584source port each time by using something like @code{-serial
951f1351 585udp::4555@@:4556} to qemu. Another approach is to use a patched
0bab00f3
FB
586version of netcat which can listen to a TCP port and send and receive
587characters via udp. If you have a patched version of netcat which
588activates telnet remote echo and single char transfer, then you can
589use the following options to step up a netcat redirector to allow
590telnet on port 5555 to access the qemu port.
591@table @code
951f1351
FB
592@item Qemu Options:
593-serial udp::4555@@:4556
594@item netcat options:
595-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
596@item telnet options:
597localhost 5555
598@end table
599
600
f7499989 601@item tcp:[host]:port[,server][,nowait][,nodelay]
951f1351
FB
602The TCP Net Console has two modes of operation. It can send the serial
603I/O to a location or wait for a connection from a location. By default
604the TCP Net Console is sent to @var{host} at the @var{port}. If you use
f542086d
FB
605the @var{server} option QEMU will wait for a client socket application
606to connect to the port before continuing, unless the @code{nowait}
f7499989
PB
607option was specified. The @code{nodelay} option disables the Nagle buffering
608algoritm. If @var{host} is omitted, 0.0.0.0 is assumed. Only
951f1351
FB
609one TCP connection at a time is accepted. You can use @code{telnet} to
610connect to the corresponding character device.
611@table @code
612@item Example to send tcp console to 192.168.0.2 port 4444
613-serial tcp:192.168.0.2:4444
614@item Example to listen and wait on port 4444 for connection
615-serial tcp::4444,server
616@item Example to not wait and listen on ip 192.168.0.100 port 4444
617-serial tcp:192.168.0.100:4444,server,nowait
a0a821a4 618@end table
a0a821a4 619
f7499989 620@item telnet:host:port[,server][,nowait][,nodelay]
951f1351
FB
621The telnet protocol is used instead of raw tcp sockets. The options
622work the same as if you had specified @code{-serial tcp}. The
623difference is that the port acts like a telnet server or client using
624telnet option negotiation. This will also allow you to send the
625MAGIC_SYSRQ sequence if you use a telnet that supports sending the break
626sequence. Typically in unix telnet you do it with Control-] and then
627type "send break" followed by pressing the enter key.
0bab00f3 628
ffd843bc
TS
629@item unix:path[,server][,nowait]
630A unix domain socket is used instead of a tcp socket. The option works the
631same as if you had specified @code{-serial tcp} except the unix domain socket
632@var{path} is used for connections.
633
20d8a3ed
TS
634@item mon:dev_string
635This is a special option to allow the monitor to be multiplexed onto
636another serial port. The monitor is accessed with key sequence of
637@key{Control-a} and then pressing @key{c}. See monitor access
638@ref{pcsys_keys} in the -nographic section for more keys.
639@var{dev_string} should be any one of the serial devices specified
640above. An example to multiplex the monitor onto a telnet server
641listening on port 4444 would be:
642@table @code
643@item -serial mon:telnet::4444,server,nowait
644@end table
645
0bab00f3 646@end table
05d5818c 647
e57a8c0e
FB
648@item -parallel dev
649Redirect the virtual parallel port to host device @var{dev} (same
650devices as the serial port). On Linux hosts, @file{/dev/parportN} can
651be used to use hardware devices connected on the corresponding host
652parallel port.
653
654This option can be used several times to simulate up to 3 parallel
655ports.
656
c03b0f0f
FB
657Use @code{-parallel none} to disable all parallel ports.
658
a0a821a4
FB
659@item -monitor dev
660Redirect the monitor to host device @var{dev} (same devices as the
661serial port).
662The default device is @code{vc} in graphical mode and @code{stdio} in
663non graphical mode.
664
20d8a3ed
TS
665@item -echr numeric_ascii_value
666Change the escape character used for switching to the monitor when using
667monitor and serial sharing. The default is @code{0x01} when using the
668@code{-nographic} option. @code{0x01} is equal to pressing
669@code{Control-a}. You can select a different character from the ascii
670control keys where 1 through 26 map to Control-a through Control-z. For
671instance you could use the either of the following to change the escape
672character to Control-t.
673@table @code
674@item -echr 0x14
675@item -echr 20
676@end table
677
ec410fc9 678@item -s
debc7065 679Wait gdb connection to port 1234 (@pxref{gdb_usage}).
ec410fc9 680@item -p port
4046d913
PB
681Change gdb connection port. @var{port} can be either a decimal number
682to specify a TCP port, or a host device (same devices as the serial port).
52c00a5f
FB
683@item -S
684Do not start CPU at startup (you must type 'c' in the monitor).
ec410fc9 685@item -d
9d4520d0 686Output log in /tmp/qemu.log
46d4767d
FB
687@item -hdachs c,h,s,[,t]
688Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
689@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
690translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
691all thoses parameters. This option is useful for old MS-DOS disk
692images.
7c3fc84d 693
87b47350
FB
694@item -L path
695Set the directory for the BIOS, VGA BIOS and keymaps.
696
15a34c63
FB
697@item -std-vga
698Simulate a standard VGA card with Bochs VBE extensions (default is
3cb0853a
FB
699Cirrus Logic GD5446 PCI VGA). If your guest OS supports the VESA 2.0
700VBE extensions (e.g. Windows XP) and if you want to use high
701resolution modes (>= 1280x1024x16) then you should use this option.
702
3c656346
FB
703@item -no-acpi
704Disable ACPI (Advanced Configuration and Power Interface) support. Use
705it if your guest OS complains about ACPI problems (PC target machine
706only).
707
d1beab82
FB
708@item -no-reboot
709Exit instead of rebooting.
710
d63d307f
FB
711@item -loadvm file
712Start right away with a saved state (@code{loadvm} in monitor)
8e71621f
PB
713
714@item -semihosting
715Enable "Angel" semihosting interface (ARM target machines only).
716Note that this allows guest direct access to the host filesystem,
717so should only be used with trusted guest OS.
ec410fc9
FB
718@end table
719
3e11db9a
FB
720@c man end
721
debc7065 722@node pcsys_keys
3e11db9a
FB
723@section Keys
724
725@c man begin OPTIONS
726
a1b74fe8
FB
727During the graphical emulation, you can use the following keys:
728@table @key
f9859310 729@item Ctrl-Alt-f
a1b74fe8 730Toggle full screen
a0a821a4 731
f9859310 732@item Ctrl-Alt-n
a0a821a4
FB
733Switch to virtual console 'n'. Standard console mappings are:
734@table @emph
735@item 1
736Target system display
737@item 2
738Monitor
739@item 3
740Serial port
a1b74fe8
FB
741@end table
742
f9859310 743@item Ctrl-Alt
a0a821a4
FB
744Toggle mouse and keyboard grab.
745@end table
746
3e11db9a
FB
747In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
748@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
749
a0a821a4
FB
750During emulation, if you are using the @option{-nographic} option, use
751@key{Ctrl-a h} to get terminal commands:
ec410fc9
FB
752
753@table @key
a1b74fe8 754@item Ctrl-a h
ec410fc9 755Print this help
a1b74fe8 756@item Ctrl-a x
366dfc52 757Exit emulator
a1b74fe8 758@item Ctrl-a s
1f47a922 759Save disk data back to file (if -snapshot)
20d8a3ed
TS
760@item Ctrl-a t
761toggle console timestamps
a1b74fe8 762@item Ctrl-a b
1f673135 763Send break (magic sysrq in Linux)
a1b74fe8 764@item Ctrl-a c
1f673135 765Switch between console and monitor
a1b74fe8
FB
766@item Ctrl-a Ctrl-a
767Send Ctrl-a
ec410fc9 768@end table
0806e3f6
FB
769@c man end
770
771@ignore
772
1f673135
FB
773@c man begin SEEALSO
774The HTML documentation of QEMU for more precise information and Linux
775user mode emulator invocation.
776@c man end
777
778@c man begin AUTHOR
779Fabrice Bellard
780@c man end
781
782@end ignore
783
debc7065 784@node pcsys_monitor
1f673135
FB
785@section QEMU Monitor
786
787The QEMU monitor is used to give complex commands to the QEMU
788emulator. You can use it to:
789
790@itemize @minus
791
792@item
e598752a 793Remove or insert removable media images
1f673135
FB
794(such as CD-ROM or floppies)
795
796@item
797Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
798from a disk file.
799
800@item Inspect the VM state without an external debugger.
801
802@end itemize
803
804@subsection Commands
805
806The following commands are available:
807
808@table @option
809
810@item help or ? [cmd]
811Show the help for all commands or just for command @var{cmd}.
812
813@item commit
814Commit changes to the disk images (if -snapshot is used)
815
816@item info subcommand
817show various information about the system state
818
819@table @option
820@item info network
41d03949 821show the various VLANs and the associated devices
1f673135
FB
822@item info block
823show the block devices
824@item info registers
825show the cpu registers
826@item info history
827show the command line history
b389dbfb
FB
828@item info pci
829show emulated PCI device
830@item info usb
831show USB devices plugged on the virtual USB hub
832@item info usbhost
833show all USB host devices
a3c25997
FB
834@item info capture
835show information about active capturing
13a2e80f
FB
836@item info snapshots
837show list of VM snapshots
455204eb
TS
838@item info mice
839show which guest mouse is receiving events
1f673135
FB
840@end table
841
842@item q or quit
843Quit the emulator.
844
845@item eject [-f] device
e598752a 846Eject a removable medium (use -f to force it).
1f673135
FB
847
848@item change device filename
e598752a 849Change a removable medium.
1f673135
FB
850
851@item screendump filename
852Save screen into PPM image @var{filename}.
853
455204eb
TS
854@item mouse_move dx dy [dz]
855Move the active mouse to the specified coordinates @var{dx} @var{dy}
856with optional scroll axis @var{dz}.
857
858@item mouse_button val
859Change the active mouse button state @var{val} (1=L, 2=M, 4=R).
860
861@item mouse_set index
862Set which mouse device receives events at given @var{index}, index
863can be obtained with
864@example
865info mice
866@end example
867
a3c25997
FB
868@item wavcapture filename [frequency [bits [channels]]]
869Capture audio into @var{filename}. Using sample rate @var{frequency}
870bits per sample @var{bits} and number of channels @var{channels}.
871
872Defaults:
873@itemize @minus
874@item Sample rate = 44100 Hz - CD quality
875@item Bits = 16
876@item Number of channels = 2 - Stereo
877@end itemize
878
879@item stopcapture index
880Stop capture with a given @var{index}, index can be obtained with
881@example
882info capture
883@end example
884
1f673135
FB
885@item log item1[,...]
886Activate logging of the specified items to @file{/tmp/qemu.log}.
887
13a2e80f
FB
888@item savevm [tag|id]
889Create a snapshot of the whole virtual machine. If @var{tag} is
890provided, it is used as human readable identifier. If there is already
891a snapshot with the same tag or ID, it is replaced. More info at
892@ref{vm_snapshots}.
1f673135 893
13a2e80f
FB
894@item loadvm tag|id
895Set the whole virtual machine to the snapshot identified by the tag
896@var{tag} or the unique snapshot ID @var{id}.
897
898@item delvm tag|id
899Delete the snapshot identified by @var{tag} or @var{id}.
1f673135
FB
900
901@item stop
902Stop emulation.
903
904@item c or cont
905Resume emulation.
906
907@item gdbserver [port]
908Start gdbserver session (default port=1234)
909
910@item x/fmt addr
911Virtual memory dump starting at @var{addr}.
912
913@item xp /fmt addr
914Physical memory dump starting at @var{addr}.
915
916@var{fmt} is a format which tells the command how to format the
917data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
918
919@table @var
920@item count
921is the number of items to be dumped.
922
923@item format
924can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
925c (char) or i (asm instruction).
926
927@item size
52c00a5f
FB
928can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
929@code{h} or @code{w} can be specified with the @code{i} format to
930respectively select 16 or 32 bit code instruction size.
1f673135
FB
931
932@end table
933
934Examples:
935@itemize
936@item
937Dump 10 instructions at the current instruction pointer:
938@example
939(qemu) x/10i $eip
9400x90107063: ret
9410x90107064: sti
9420x90107065: lea 0x0(%esi,1),%esi
9430x90107069: lea 0x0(%edi,1),%edi
9440x90107070: ret
9450x90107071: jmp 0x90107080
9460x90107073: nop
9470x90107074: nop
9480x90107075: nop
9490x90107076: nop
950@end example
951
952@item
953Dump 80 16 bit values at the start of the video memory.
debc7065 954@smallexample
1f673135
FB
955(qemu) xp/80hx 0xb8000
9560x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
9570x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
9580x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
9590x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
9600x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
9610x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
9620x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9630x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9640x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
9650x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
debc7065 966@end smallexample
1f673135
FB
967@end itemize
968
969@item p or print/fmt expr
970
971Print expression value. Only the @var{format} part of @var{fmt} is
972used.
0806e3f6 973
a3a91a35
FB
974@item sendkey keys
975
976Send @var{keys} to the emulator. Use @code{-} to press several keys
977simultaneously. Example:
978@example
979sendkey ctrl-alt-f1
980@end example
981
982This command is useful to send keys that your graphical user interface
983intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
984
15a34c63
FB
985@item system_reset
986
987Reset the system.
988
b389dbfb
FB
989@item usb_add devname
990
0aff66b5
PB
991Add the USB device @var{devname}. For details of available devices see
992@ref{usb_devices}
b389dbfb
FB
993
994@item usb_del devname
995
996Remove the USB device @var{devname} from the QEMU virtual USB
997hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
998command @code{info usb} to see the devices you can remove.
999
1f673135 1000@end table
0806e3f6 1001
1f673135
FB
1002@subsection Integer expressions
1003
1004The monitor understands integers expressions for every integer
1005argument. You can use register names to get the value of specifics
1006CPU registers by prefixing them with @emph{$}.
ec410fc9 1007
1f47a922
FB
1008@node disk_images
1009@section Disk Images
1010
acd935ef
FB
1011Since version 0.6.1, QEMU supports many disk image formats, including
1012growable disk images (their size increase as non empty sectors are
13a2e80f
FB
1013written), compressed and encrypted disk images. Version 0.8.3 added
1014the new qcow2 disk image format which is essential to support VM
1015snapshots.
1f47a922 1016
debc7065
FB
1017@menu
1018* disk_images_quickstart:: Quick start for disk image creation
1019* disk_images_snapshot_mode:: Snapshot mode
13a2e80f 1020* vm_snapshots:: VM snapshots
debc7065 1021* qemu_img_invocation:: qemu-img Invocation
19cb3738 1022* host_drives:: Using host drives
debc7065
FB
1023* disk_images_fat_images:: Virtual FAT disk images
1024@end menu
1025
1026@node disk_images_quickstart
acd935ef
FB
1027@subsection Quick start for disk image creation
1028
1029You can create a disk image with the command:
1f47a922 1030@example
acd935ef 1031qemu-img create myimage.img mysize
1f47a922 1032@end example
acd935ef
FB
1033where @var{myimage.img} is the disk image filename and @var{mysize} is its
1034size in kilobytes. You can add an @code{M} suffix to give the size in
1035megabytes and a @code{G} suffix for gigabytes.
1036
debc7065 1037See @ref{qemu_img_invocation} for more information.
1f47a922 1038
debc7065 1039@node disk_images_snapshot_mode
1f47a922
FB
1040@subsection Snapshot mode
1041
1042If you use the option @option{-snapshot}, all disk images are
1043considered as read only. When sectors in written, they are written in
1044a temporary file created in @file{/tmp}. You can however force the
acd935ef
FB
1045write back to the raw disk images by using the @code{commit} monitor
1046command (or @key{C-a s} in the serial console).
1f47a922 1047
13a2e80f
FB
1048@node vm_snapshots
1049@subsection VM snapshots
1050
1051VM snapshots are snapshots of the complete virtual machine including
1052CPU state, RAM, device state and the content of all the writable
1053disks. In order to use VM snapshots, you must have at least one non
1054removable and writable block device using the @code{qcow2} disk image
1055format. Normally this device is the first virtual hard drive.
1056
1057Use the monitor command @code{savevm} to create a new VM snapshot or
1058replace an existing one. A human readable name can be assigned to each
19d36792 1059snapshot in addition to its numerical ID.
13a2e80f
FB
1060
1061Use @code{loadvm} to restore a VM snapshot and @code{delvm} to remove
1062a VM snapshot. @code{info snapshots} lists the available snapshots
1063with their associated information:
1064
1065@example
1066(qemu) info snapshots
1067Snapshot devices: hda
1068Snapshot list (from hda):
1069ID TAG VM SIZE DATE VM CLOCK
10701 start 41M 2006-08-06 12:38:02 00:00:14.954
10712 40M 2006-08-06 12:43:29 00:00:18.633
10723 msys 40M 2006-08-06 12:44:04 00:00:23.514
1073@end example
1074
1075A VM snapshot is made of a VM state info (its size is shown in
1076@code{info snapshots}) and a snapshot of every writable disk image.
1077The VM state info is stored in the first @code{qcow2} non removable
1078and writable block device. The disk image snapshots are stored in
1079every disk image. The size of a snapshot in a disk image is difficult
1080to evaluate and is not shown by @code{info snapshots} because the
1081associated disk sectors are shared among all the snapshots to save
19d36792
FB
1082disk space (otherwise each snapshot would need a full copy of all the
1083disk images).
13a2e80f
FB
1084
1085When using the (unrelated) @code{-snapshot} option
1086(@ref{disk_images_snapshot_mode}), you can always make VM snapshots,
1087but they are deleted as soon as you exit QEMU.
1088
1089VM snapshots currently have the following known limitations:
1090@itemize
1091@item
1092They cannot cope with removable devices if they are removed or
1093inserted after a snapshot is done.
1094@item
1095A few device drivers still have incomplete snapshot support so their
1096state is not saved or restored properly (in particular USB).
1097@end itemize
1098
acd935ef
FB
1099@node qemu_img_invocation
1100@subsection @code{qemu-img} Invocation
1f47a922 1101
acd935ef 1102@include qemu-img.texi
05efe46e 1103
19cb3738
FB
1104@node host_drives
1105@subsection Using host drives
1106
1107In addition to disk image files, QEMU can directly access host
1108devices. We describe here the usage for QEMU version >= 0.8.3.
1109
1110@subsubsection Linux
1111
1112On Linux, you can directly use the host device filename instead of a
1113disk image filename provided you have enough proviledge to access
1114it. For example, use @file{/dev/cdrom} to access to the CDROM or
1115@file{/dev/fd0} for the floppy.
1116
f542086d 1117@table @code
19cb3738
FB
1118@item CD
1119You can specify a CDROM device even if no CDROM is loaded. QEMU has
1120specific code to detect CDROM insertion or removal. CDROM ejection by
1121the guest OS is supported. Currently only data CDs are supported.
1122@item Floppy
1123You can specify a floppy device even if no floppy is loaded. Floppy
1124removal is currently not detected accurately (if you change floppy
1125without doing floppy access while the floppy is not loaded, the guest
1126OS will think that the same floppy is loaded).
1127@item Hard disks
1128Hard disks can be used. Normally you must specify the whole disk
1129(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
1130see it as a partitioned disk. WARNING: unless you know what you do, it
1131is better to only make READ-ONLY accesses to the hard disk otherwise
1132you may corrupt your host data (use the @option{-snapshot} command
1133line option or modify the device permissions accordingly).
1134@end table
1135
1136@subsubsection Windows
1137
01781963
FB
1138@table @code
1139@item CD
1140The prefered syntax is the drive letter (e.g. @file{d:}). The
1141alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
1142supported as an alias to the first CDROM drive.
19cb3738 1143
e598752a 1144Currently there is no specific code to handle removable media, so it
19cb3738
FB
1145is better to use the @code{change} or @code{eject} monitor commands to
1146change or eject media.
01781963
FB
1147@item Hard disks
1148Hard disks can be used with the syntax: @file{\\.\PhysicalDriveN}
1149where @var{N} is the drive number (0 is the first hard disk).
1150
1151WARNING: unless you know what you do, it is better to only make
1152READ-ONLY accesses to the hard disk otherwise you may corrupt your
1153host data (use the @option{-snapshot} command line so that the
1154modifications are written in a temporary file).
1155@end table
1156
19cb3738
FB
1157
1158@subsubsection Mac OS X
1159
1160@file{/dev/cdrom} is an alias to the first CDROM.
1161
e598752a 1162Currently there is no specific code to handle removable media, so it
19cb3738
FB
1163is better to use the @code{change} or @code{eject} monitor commands to
1164change or eject media.
1165
debc7065 1166@node disk_images_fat_images
2c6cadd4
FB
1167@subsection Virtual FAT disk images
1168
1169QEMU can automatically create a virtual FAT disk image from a
1170directory tree. In order to use it, just type:
1171
1172@example
1173qemu linux.img -hdb fat:/my_directory
1174@end example
1175
1176Then you access access to all the files in the @file{/my_directory}
1177directory without having to copy them in a disk image or to export
1178them via SAMBA or NFS. The default access is @emph{read-only}.
1179
1180Floppies can be emulated with the @code{:floppy:} option:
1181
1182@example
1183qemu linux.img -fda fat:floppy:/my_directory
1184@end example
1185
1186A read/write support is available for testing (beta stage) with the
1187@code{:rw:} option:
1188
1189@example
1190qemu linux.img -fda fat:floppy:rw:/my_directory
1191@end example
1192
1193What you should @emph{never} do:
1194@itemize
1195@item use non-ASCII filenames ;
1196@item use "-snapshot" together with ":rw:" ;
85b2c688
FB
1197@item expect it to work when loadvm'ing ;
1198@item write to the FAT directory on the host system while accessing it with the guest system.
2c6cadd4
FB
1199@end itemize
1200
debc7065 1201@node pcsys_network
9d4fb82e
FB
1202@section Network emulation
1203
41d03949
FB
1204QEMU can simulate several networks cards (NE2000 boards on the PC
1205target) and can connect them to an arbitrary number of Virtual Local
1206Area Networks (VLANs). Host TAP devices can be connected to any QEMU
1207VLAN. VLAN can be connected between separate instances of QEMU to
1208simulate large networks. For simpler usage, a non priviledged user mode
1209network stack can replace the TAP device to have a basic network
1210connection.
1211
1212@subsection VLANs
9d4fb82e 1213
41d03949
FB
1214QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
1215connection between several network devices. These devices can be for
1216example QEMU virtual Ethernet cards or virtual Host ethernet devices
1217(TAP devices).
9d4fb82e 1218
41d03949
FB
1219@subsection Using TAP network interfaces
1220
1221This is the standard way to connect QEMU to a real network. QEMU adds
1222a virtual network device on your host (called @code{tapN}), and you
1223can then configure it as if it was a real ethernet card.
9d4fb82e 1224
8f40c388
FB
1225@subsubsection Linux host
1226
9d4fb82e
FB
1227As an example, you can download the @file{linux-test-xxx.tar.gz}
1228archive and copy the script @file{qemu-ifup} in @file{/etc} and
1229configure properly @code{sudo} so that the command @code{ifconfig}
1230contained in @file{qemu-ifup} can be executed as root. You must verify
41d03949 1231that your host kernel supports the TAP network interfaces: the
9d4fb82e
FB
1232device @file{/dev/net/tun} must be present.
1233
ee0f4751
FB
1234See @ref{sec_invocation} to have examples of command lines using the
1235TAP network interfaces.
9d4fb82e 1236
8f40c388
FB
1237@subsubsection Windows host
1238
1239There is a virtual ethernet driver for Windows 2000/XP systems, called
1240TAP-Win32. But it is not included in standard QEMU for Windows,
1241so you will need to get it separately. It is part of OpenVPN package,
1242so download OpenVPN from : @url{http://openvpn.net/}.
1243
9d4fb82e
FB
1244@subsection Using the user mode network stack
1245
41d03949
FB
1246By using the option @option{-net user} (default configuration if no
1247@option{-net} option is specified), QEMU uses a completely user mode
1248network stack (you don't need root priviledge to use the virtual
1249network). The virtual network configuration is the following:
9d4fb82e
FB
1250
1251@example
1252
41d03949
FB
1253 QEMU VLAN <------> Firewall/DHCP server <-----> Internet
1254 | (10.0.2.2)
9d4fb82e 1255 |
2518bd0d
FB
1256 ----> DNS server (10.0.2.3)
1257 |
1258 ----> SMB server (10.0.2.4)
9d4fb82e
FB
1259@end example
1260
1261The QEMU VM behaves as if it was behind a firewall which blocks all
1262incoming connections. You can use a DHCP client to automatically
41d03949
FB
1263configure the network in the QEMU VM. The DHCP server assign addresses
1264to the hosts starting from 10.0.2.15.
9d4fb82e
FB
1265
1266In order to check that the user mode network is working, you can ping
1267the address 10.0.2.2 and verify that you got an address in the range
126810.0.2.x from the QEMU virtual DHCP server.
1269
b415a407
FB
1270Note that @code{ping} is not supported reliably to the internet as it
1271would require root priviledges. It means you can only ping the local
1272router (10.0.2.2).
1273
9bf05444
FB
1274When using the built-in TFTP server, the router is also the TFTP
1275server.
1276
1277When using the @option{-redir} option, TCP or UDP connections can be
1278redirected from the host to the guest. It allows for example to
1279redirect X11, telnet or SSH connections.
443f1376 1280
41d03949
FB
1281@subsection Connecting VLANs between QEMU instances
1282
1283Using the @option{-net socket} option, it is possible to make VLANs
1284that span several QEMU instances. See @ref{sec_invocation} to have a
1285basic example.
1286
9d4fb82e
FB
1287@node direct_linux_boot
1288@section Direct Linux Boot
1f673135
FB
1289
1290This section explains how to launch a Linux kernel inside QEMU without
1291having to make a full bootable image. It is very useful for fast Linux
ee0f4751 1292kernel testing.
1f673135 1293
ee0f4751 1294The syntax is:
1f673135 1295@example
ee0f4751 1296qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
1f673135
FB
1297@end example
1298
ee0f4751
FB
1299Use @option{-kernel} to provide the Linux kernel image and
1300@option{-append} to give the kernel command line arguments. The
1301@option{-initrd} option can be used to provide an INITRD image.
1f673135 1302
ee0f4751
FB
1303When using the direct Linux boot, a disk image for the first hard disk
1304@file{hda} is required because its boot sector is used to launch the
1305Linux kernel.
1f673135 1306
ee0f4751
FB
1307If you do not need graphical output, you can disable it and redirect
1308the virtual serial port and the QEMU monitor to the console with the
1309@option{-nographic} option. The typical command line is:
1f673135 1310@example
ee0f4751
FB
1311qemu -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1312 -append "root=/dev/hda console=ttyS0" -nographic
1f673135
FB
1313@end example
1314
ee0f4751
FB
1315Use @key{Ctrl-a c} to switch between the serial console and the
1316monitor (@pxref{pcsys_keys}).
1f673135 1317
debc7065 1318@node pcsys_usb
b389dbfb
FB
1319@section USB emulation
1320
0aff66b5
PB
1321QEMU emulates a PCI UHCI USB controller. You can virtually plug
1322virtual USB devices or real host USB devices (experimental, works only
1323on Linux hosts). Qemu will automatically create and connect virtual USB hubs
f542086d 1324as necessary to connect multiple USB devices.
b389dbfb 1325
0aff66b5
PB
1326@menu
1327* usb_devices::
1328* host_usb_devices::
1329@end menu
1330@node usb_devices
1331@subsection Connecting USB devices
b389dbfb 1332
0aff66b5
PB
1333USB devices can be connected with the @option{-usbdevice} commandline option
1334or the @code{usb_add} monitor command. Available devices are:
b389dbfb 1335
0aff66b5
PB
1336@table @var
1337@item @code{mouse}
1338Virtual Mouse. This will override the PS/2 mouse emulation when activated.
1339@item @code{tablet}
c6d46c20 1340Pointer device that uses absolute coordinates (like a touchscreen).
0aff66b5
PB
1341This means qemu is able to report the mouse position without having
1342to grab the mouse. Also overrides the PS/2 mouse emulation when activated.
1343@item @code{disk:file}
1344Mass storage device based on @var{file} (@pxref{disk_images})
1345@item @code{host:bus.addr}
1346Pass through the host device identified by @var{bus.addr}
1347(Linux only)
1348@item @code{host:vendor_id:product_id}
1349Pass through the host device identified by @var{vendor_id:product_id}
1350(Linux only)
1351@end table
b389dbfb 1352
0aff66b5 1353@node host_usb_devices
b389dbfb
FB
1354@subsection Using host USB devices on a Linux host
1355
1356WARNING: this is an experimental feature. QEMU will slow down when
1357using it. USB devices requiring real time streaming (i.e. USB Video
1358Cameras) are not supported yet.
1359
1360@enumerate
1361@item If you use an early Linux 2.4 kernel, verify that no Linux driver
1362is actually using the USB device. A simple way to do that is simply to
1363disable the corresponding kernel module by renaming it from @file{mydriver.o}
1364to @file{mydriver.o.disabled}.
1365
1366@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
1367@example
1368ls /proc/bus/usb
1369001 devices drivers
1370@end example
1371
1372@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:
1373@example
1374chown -R myuid /proc/bus/usb
1375@end example
1376
1377@item Launch QEMU and do in the monitor:
1378@example
1379info usbhost
1380 Device 1.2, speed 480 Mb/s
1381 Class 00: USB device 1234:5678, USB DISK
1382@end example
1383You should see the list of the devices you can use (Never try to use
1384hubs, it won't work).
1385
1386@item Add the device in QEMU by using:
1387@example
1388usb_add host:1234:5678
1389@end example
1390
1391Normally the guest OS should report that a new USB device is
1392plugged. You can use the option @option{-usbdevice} to do the same.
1393
1394@item Now you can try to use the host USB device in QEMU.
1395
1396@end enumerate
1397
1398When relaunching QEMU, you may have to unplug and plug again the USB
1399device to make it work again (this is a bug).
1400
0806e3f6 1401@node gdb_usage
da415d54
FB
1402@section GDB usage
1403
1404QEMU has a primitive support to work with gdb, so that you can do
0806e3f6 1405'Ctrl-C' while the virtual machine is running and inspect its state.
da415d54 1406
9d4520d0 1407In order to use gdb, launch qemu with the '-s' option. It will wait for a
da415d54
FB
1408gdb connection:
1409@example
debc7065
FB
1410> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1411 -append "root=/dev/hda"
da415d54
FB
1412Connected to host network interface: tun0
1413Waiting gdb connection on port 1234
1414@end example
1415
1416Then launch gdb on the 'vmlinux' executable:
1417@example
1418> gdb vmlinux
1419@end example
1420
1421In gdb, connect to QEMU:
1422@example
6c9bf893 1423(gdb) target remote localhost:1234
da415d54
FB
1424@end example
1425
1426Then you can use gdb normally. For example, type 'c' to launch the kernel:
1427@example
1428(gdb) c
1429@end example
1430
0806e3f6
FB
1431Here are some useful tips in order to use gdb on system code:
1432
1433@enumerate
1434@item
1435Use @code{info reg} to display all the CPU registers.
1436@item
1437Use @code{x/10i $eip} to display the code at the PC position.
1438@item
1439Use @code{set architecture i8086} to dump 16 bit code. Then use
294e8637 1440@code{x/10i $cs*16+$eip} to dump the code at the PC position.
0806e3f6
FB
1441@end enumerate
1442
debc7065 1443@node pcsys_os_specific
1a084f3d
FB
1444@section Target OS specific information
1445
1446@subsection Linux
1447
15a34c63
FB
1448To have access to SVGA graphic modes under X11, use the @code{vesa} or
1449the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1450color depth in the guest and the host OS.
1a084f3d 1451
e3371e62
FB
1452When using a 2.6 guest Linux kernel, you should add the option
1453@code{clock=pit} on the kernel command line because the 2.6 Linux
1454kernels make very strict real time clock checks by default that QEMU
1455cannot simulate exactly.
1456
7c3fc84d
FB
1457When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1458not activated because QEMU is slower with this patch. The QEMU
1459Accelerator Module is also much slower in this case. Earlier Fedora
1460Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1461patch by default. Newer kernels don't have it.
1462
1a084f3d
FB
1463@subsection Windows
1464
1465If you have a slow host, using Windows 95 is better as it gives the
1466best speed. Windows 2000 is also a good choice.
1467
e3371e62
FB
1468@subsubsection SVGA graphic modes support
1469
1470QEMU emulates a Cirrus Logic GD5446 Video
15a34c63
FB
1471card. All Windows versions starting from Windows 95 should recognize
1472and use this graphic card. For optimal performances, use 16 bit color
1473depth in the guest and the host OS.
1a084f3d 1474
3cb0853a
FB
1475If you are using Windows XP as guest OS and if you want to use high
1476resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
14771280x1024x16), then you should use the VESA VBE virtual graphic card
1478(option @option{-std-vga}).
1479
e3371e62
FB
1480@subsubsection CPU usage reduction
1481
1482Windows 9x does not correctly use the CPU HLT
15a34c63
FB
1483instruction. The result is that it takes host CPU cycles even when
1484idle. You can install the utility from
1485@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1486problem. Note that no such tool is needed for NT, 2000 or XP.
1a084f3d 1487
9d0a8e6f 1488@subsubsection Windows 2000 disk full problem
e3371e62 1489
9d0a8e6f
FB
1490Windows 2000 has a bug which gives a disk full problem during its
1491installation. When installing it, use the @option{-win2k-hack} QEMU
1492option to enable a specific workaround. After Windows 2000 is
1493installed, you no longer need this option (this option slows down the
1494IDE transfers).
e3371e62 1495
6cc721cf
FB
1496@subsubsection Windows 2000 shutdown
1497
1498Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1499can. It comes from the fact that Windows 2000 does not automatically
1500use the APM driver provided by the BIOS.
1501
1502In order to correct that, do the following (thanks to Struan
1503Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1504Add/Troubleshoot a device => Add a new device & Next => No, select the
1505hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1506(again) a few times. Now the driver is installed and Windows 2000 now
1507correctly instructs QEMU to shutdown at the appropriate moment.
1508
1509@subsubsection Share a directory between Unix and Windows
1510
1511See @ref{sec_invocation} about the help of the option @option{-smb}.
1512
2192c332 1513@subsubsection Windows XP security problem
e3371e62
FB
1514
1515Some releases of Windows XP install correctly but give a security
1516error when booting:
1517@example
1518A problem is preventing Windows from accurately checking the
1519license for this computer. Error code: 0x800703e6.
1520@end example
e3371e62 1521
2192c332
FB
1522The workaround is to install a service pack for XP after a boot in safe
1523mode. Then reboot, and the problem should go away. Since there is no
1524network while in safe mode, its recommended to download the full
1525installation of SP1 or SP2 and transfer that via an ISO or using the
1526vvfat block device ("-hdb fat:directory_which_holds_the_SP").
e3371e62 1527
a0a821a4
FB
1528@subsection MS-DOS and FreeDOS
1529
1530@subsubsection CPU usage reduction
1531
1532DOS does not correctly use the CPU HLT instruction. The result is that
1533it takes host CPU cycles even when idle. You can install the utility
1534from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1535problem.
1536
debc7065 1537@node QEMU System emulator for non PC targets
3f9f3aa1
FB
1538@chapter QEMU System emulator for non PC targets
1539
1540QEMU is a generic emulator and it emulates many non PC
1541machines. Most of the options are similar to the PC emulator. The
1542differences are mentionned in the following sections.
1543
debc7065
FB
1544@menu
1545* QEMU PowerPC System emulator::
1546* Sparc32 System emulator invocation::
1547* Sparc64 System emulator invocation::
1548* MIPS System emulator invocation::
1549* ARM System emulator invocation::
1550@end menu
1551
1552@node QEMU PowerPC System emulator
3f9f3aa1 1553@section QEMU PowerPC System emulator
1a084f3d 1554
15a34c63
FB
1555Use the executable @file{qemu-system-ppc} to simulate a complete PREP
1556or PowerMac PowerPC system.
1a084f3d 1557
b671f9ed 1558QEMU emulates the following PowerMac peripherals:
1a084f3d 1559
15a34c63
FB
1560@itemize @minus
1561@item
1562UniNorth PCI Bridge
1563@item
1564PCI VGA compatible card with VESA Bochs Extensions
1565@item
15662 PMAC IDE interfaces with hard disk and CD-ROM support
1567@item
1568NE2000 PCI adapters
1569@item
1570Non Volatile RAM
1571@item
1572VIA-CUDA with ADB keyboard and mouse.
1a084f3d
FB
1573@end itemize
1574
b671f9ed 1575QEMU emulates the following PREP peripherals:
52c00a5f
FB
1576
1577@itemize @minus
1578@item
15a34c63
FB
1579PCI Bridge
1580@item
1581PCI VGA compatible card with VESA Bochs Extensions
1582@item
52c00a5f
FB
15832 IDE interfaces with hard disk and CD-ROM support
1584@item
1585Floppy disk
1586@item
15a34c63 1587NE2000 network adapters
52c00a5f
FB
1588@item
1589Serial port
1590@item
1591PREP Non Volatile RAM
15a34c63
FB
1592@item
1593PC compatible keyboard and mouse.
52c00a5f
FB
1594@end itemize
1595
15a34c63 1596QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
3f9f3aa1 1597@url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
52c00a5f 1598
15a34c63
FB
1599@c man begin OPTIONS
1600
1601The following options are specific to the PowerPC emulation:
1602
1603@table @option
1604
15a34c63
FB
1605@item -g WxH[xDEPTH]
1606
1607Set the initial VGA graphic mode. The default is 800x600x15.
1608
1609@end table
1610
1611@c man end
1612
1613
52c00a5f 1614More information is available at
3f9f3aa1 1615@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
52c00a5f 1616
debc7065 1617@node Sparc32 System emulator invocation
3f9f3aa1 1618@section Sparc32 System emulator invocation
e80cfcfc 1619
0986ac3b 1620Use the executable @file{qemu-system-sparc} to simulate a SparcStation 5
3475187d 1621(sun4m architecture). The emulation is somewhat complete.
e80cfcfc 1622
b671f9ed 1623QEMU emulates the following sun4m peripherals:
e80cfcfc
FB
1624
1625@itemize @minus
3475187d 1626@item
e80cfcfc
FB
1627IOMMU
1628@item
1629TCX Frame buffer
1630@item
1631Lance (Am7990) Ethernet
1632@item
1633Non Volatile RAM M48T08
1634@item
3475187d
FB
1635Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1636and power/reset logic
1637@item
1638ESP SCSI controller with hard disk and CD-ROM support
1639@item
1640Floppy drive
e80cfcfc
FB
1641@end itemize
1642
3475187d
FB
1643The number of peripherals is fixed in the architecture.
1644
30a604f3 1645Since version 0.8.2, QEMU uses OpenBIOS
0986ac3b
FB
1646@url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
1647firmware implementation. The goal is to implement a 100% IEEE
16481275-1994 (referred to as Open Firmware) compliant firmware.
3475187d
FB
1649
1650A sample Linux 2.6 series kernel and ram disk image are available on
0986ac3b
FB
1651the QEMU web site. Please note that currently NetBSD, OpenBSD or
1652Solaris kernels don't work.
3475187d
FB
1653
1654@c man begin OPTIONS
1655
1656The following options are specific to the Sparc emulation:
1657
1658@table @option
1659
1660@item -g WxH
1661
1662Set the initial TCX graphic mode. The default is 1024x768.
1663
66508601
BS
1664@item -prom-env string
1665
1666Set OpenBIOS variables in NVRAM, for example:
1667
1668@example
1669qemu-system-sparc -prom-env 'auto-boot?=false' \
1670 -prom-env 'boot-device=sd(0,2,0):d' -prom-env 'boot-args=linux single'
1671@end example
1672
3475187d
FB
1673@end table
1674
1675@c man end
1676
debc7065 1677@node Sparc64 System emulator invocation
3f9f3aa1 1678@section Sparc64 System emulator invocation
e80cfcfc 1679
3475187d
FB
1680Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
1681The emulator is not usable for anything yet.
b756921a 1682
83469015
FB
1683QEMU emulates the following sun4u peripherals:
1684
1685@itemize @minus
1686@item
1687UltraSparc IIi APB PCI Bridge
1688@item
1689PCI VGA compatible card with VESA Bochs Extensions
1690@item
1691Non Volatile RAM M48T59
1692@item
1693PC-compatible serial ports
1694@end itemize
1695
debc7065 1696@node MIPS System emulator invocation
3f9f3aa1 1697@section MIPS System emulator invocation
9d0a8e6f
FB
1698
1699Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
3f9f3aa1
FB
1700The emulator is able to boot a Linux kernel and to run a Linux Debian
1701installation from NFS. The following devices are emulated:
1702
1703@itemize @minus
1704@item
1705MIPS R4K CPU
1706@item
1707PC style serial port
1708@item
1709NE2000 network card
1710@end itemize
1711
1712More information is available in the QEMU mailing-list archive.
1713
debc7065 1714@node ARM System emulator invocation
3f9f3aa1
FB
1715@section ARM System emulator invocation
1716
1717Use the executable @file{qemu-system-arm} to simulate a ARM
1718machine. The ARM Integrator/CP board is emulated with the following
1719devices:
1720
1721@itemize @minus
1722@item
ed96ca35 1723ARM926E or ARM1026E CPU
3f9f3aa1
FB
1724@item
1725Two PL011 UARTs
1726@item
1727SMC 91c111 Ethernet adapter
00a9bf19
PB
1728@item
1729PL110 LCD controller
1730@item
1731PL050 KMI with PS/2 keyboard and mouse.
a1bb27b1
PB
1732@item
1733PL181 MultiMedia Card Interface with SD card.
00a9bf19
PB
1734@end itemize
1735
1736The ARM Versatile baseboard is emulated with the following devices:
1737
1738@itemize @minus
1739@item
1740ARM926E CPU
1741@item
1742PL190 Vectored Interrupt Controller
1743@item
1744Four PL011 UARTs
1745@item
1746SMC 91c111 Ethernet adapter
1747@item
1748PL110 LCD controller
1749@item
1750PL050 KMI with PS/2 keyboard and mouse.
1751@item
1752PCI host bridge. Note the emulated PCI bridge only provides access to
1753PCI memory space. It does not provide access to PCI IO space.
1754This means some devices (eg. ne2k_pci NIC) are not useable, and others
1755(eg. rtl8139 NIC) are only useable when the guest drivers use the memory
1756mapped control registers.
e6de1bad
PB
1757@item
1758PCI OHCI USB controller.
1759@item
1760LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices.
a1bb27b1
PB
1761@item
1762PL181 MultiMedia Card Interface with SD card.
3f9f3aa1
FB
1763@end itemize
1764
d7739d75
PB
1765The ARM RealView Emulation baseboard is emulated with the following devices:
1766
1767@itemize @minus
1768@item
1769ARM926E CPU
1770@item
1771ARM AMBA Generic/Distributed Interrupt Controller
1772@item
1773Four PL011 UARTs
1774@item
1775SMC 91c111 Ethernet adapter
1776@item
1777PL110 LCD controller
1778@item
1779PL050 KMI with PS/2 keyboard and mouse
1780@item
1781PCI host bridge
1782@item
1783PCI OHCI USB controller
1784@item
1785LSI53C895A PCI SCSI Host Bus Adapter with hard disk and CD-ROM devices
a1bb27b1
PB
1786@item
1787PL181 MultiMedia Card Interface with SD card.
d7739d75
PB
1788@end itemize
1789
b00052e4
AZ
1790The XScale-based clamshell PDA models ("Spitz", "Akita", "Borzoi"
1791and "Terrier") emulation includes the following peripherals:
1792
1793@itemize @minus
1794@item
1795Intel PXA270 System-on-chip (ARM V5TE core)
1796@item
1797NAND Flash memory
1798@item
1799IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in "Akita"
1800@item
1801On-chip OHCI USB controller
1802@item
1803On-chip LCD controller
1804@item
1805On-chip Real Time Clock
1806@item
1807TI ADS7846 touchscreen controller on SSP bus
1808@item
1809Maxim MAX1111 analog-digital converter on I@math{^2}C bus
1810@item
1811GPIO-connected keyboard controller and LEDs
1812@item
1813Secure Digital card conntected to PXA MMC/SD host
1814@item
1815Three on-chip UARTs
1816@item
1817WM8750 audio CODEC on I@math{^2}C and I@math{^2}S busses
1818@end itemize
1819
3f9f3aa1
FB
1820A Linux 2.6 test image is available on the QEMU web site. More
1821information is available in the QEMU mailing-list archive.
9d0a8e6f 1822
83195237
FB
1823@node QEMU User space emulator
1824@chapter QEMU User space emulator
1825
1826@menu
1827* Supported Operating Systems ::
1828* Linux User space emulator::
1829* Mac OS X/Darwin User space emulator ::
1830@end menu
1831
1832@node Supported Operating Systems
1833@section Supported Operating Systems
1834
1835The following OS are supported in user space emulation:
1836
1837@itemize @minus
1838@item
1839Linux (refered as qemu-linux-user)
1840@item
1841Mac OS X/Darwin (refered as qemu-darwin-user)
1842@end itemize
1843
1844@node Linux User space emulator
1845@section Linux User space emulator
386405f7 1846
debc7065
FB
1847@menu
1848* Quick Start::
1849* Wine launch::
1850* Command line options::
79737e4a 1851* Other binaries::
debc7065
FB
1852@end menu
1853
1854@node Quick Start
83195237 1855@subsection Quick Start
df0f11a0 1856
1f673135
FB
1857In order to launch a Linux process, QEMU needs the process executable
1858itself and all the target (x86) dynamic libraries used by it.
386405f7 1859
1f673135 1860@itemize
386405f7 1861
1f673135
FB
1862@item On x86, you can just try to launch any process by using the native
1863libraries:
386405f7 1864
1f673135
FB
1865@example
1866qemu-i386 -L / /bin/ls
1867@end example
386405f7 1868
1f673135
FB
1869@code{-L /} tells that the x86 dynamic linker must be searched with a
1870@file{/} prefix.
386405f7 1871
dbcf5e82
TS
1872@item Since QEMU is also a linux process, you can launch qemu with
1873qemu (NOTE: you can only do that if you compiled QEMU from the sources):
386405f7 1874
1f673135
FB
1875@example
1876qemu-i386 -L / qemu-i386 -L / /bin/ls
1877@end example
386405f7 1878
1f673135
FB
1879@item On non x86 CPUs, you need first to download at least an x86 glibc
1880(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1881@code{LD_LIBRARY_PATH} is not set:
df0f11a0 1882
1f673135
FB
1883@example
1884unset LD_LIBRARY_PATH
1885@end example
1eb87257 1886
1f673135 1887Then you can launch the precompiled @file{ls} x86 executable:
1eb87257 1888
1f673135
FB
1889@example
1890qemu-i386 tests/i386/ls
1891@end example
1892You can look at @file{qemu-binfmt-conf.sh} so that
1893QEMU is automatically launched by the Linux kernel when you try to
1894launch x86 executables. It requires the @code{binfmt_misc} module in the
1895Linux kernel.
1eb87257 1896
1f673135
FB
1897@item The x86 version of QEMU is also included. You can try weird things such as:
1898@example
debc7065
FB
1899qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
1900 /usr/local/qemu-i386/bin/ls-i386
1f673135 1901@end example
1eb20527 1902
1f673135 1903@end itemize
1eb20527 1904
debc7065 1905@node Wine launch
83195237 1906@subsection Wine launch
1eb20527 1907
1f673135 1908@itemize
386405f7 1909
1f673135
FB
1910@item Ensure that you have a working QEMU with the x86 glibc
1911distribution (see previous section). In order to verify it, you must be
1912able to do:
386405f7 1913
1f673135
FB
1914@example
1915qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1916@end example
386405f7 1917
1f673135
FB
1918@item Download the binary x86 Wine install
1919(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
386405f7 1920
1f673135 1921@item Configure Wine on your account. Look at the provided script
debc7065 1922@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
1f673135 1923@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
386405f7 1924
1f673135 1925@item Then you can try the example @file{putty.exe}:
386405f7 1926
1f673135 1927@example
debc7065
FB
1928qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
1929 /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1f673135 1930@end example
386405f7 1931
1f673135 1932@end itemize
fd429f2f 1933
debc7065 1934@node Command line options
83195237 1935@subsection Command line options
1eb20527 1936
1f673135
FB
1937@example
1938usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1939@end example
1eb20527 1940
1f673135
FB
1941@table @option
1942@item -h
1943Print the help
1944@item -L path
1945Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1946@item -s size
1947Set the x86 stack size in bytes (default=524288)
386405f7
FB
1948@end table
1949
1f673135 1950Debug options:
386405f7 1951
1f673135
FB
1952@table @option
1953@item -d
1954Activate log (logfile=/tmp/qemu.log)
1955@item -p pagesize
1956Act as if the host page size was 'pagesize' bytes
1957@end table
386405f7 1958
79737e4a 1959@node Other binaries
83195237 1960@subsection Other binaries
79737e4a
PB
1961
1962@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
1963binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
1964configurations), and arm-uclinux bFLT format binaries.
1965
e6e5906b
PB
1966@command{qemu-m68k} is capable of running semihosted binaries using the BDM
1967(m5xxx-ram-hosted.ld) or m68k-sim (sim.ld) syscall interfaces, and
1968coldfire uClinux bFLT format binaries.
1969
79737e4a
PB
1970The binary format is detected automatically.
1971
83195237
FB
1972@node Mac OS X/Darwin User space emulator
1973@section Mac OS X/Darwin User space emulator
1974
1975@menu
1976* Mac OS X/Darwin Status::
1977* Mac OS X/Darwin Quick Start::
1978* Mac OS X/Darwin Command line options::
1979@end menu
1980
1981@node Mac OS X/Darwin Status
1982@subsection Mac OS X/Darwin Status
1983
1984@itemize @minus
1985@item
1986target x86 on x86: Most apps (Cocoa and Carbon too) works. [1]
1987@item
1988target PowerPC on x86: Not working as the ppc commpage can't be mapped (yet!)
1989@item
dbcf5e82 1990target PowerPC on PowerPC: Most apps (Cocoa and Carbon too) works. [1]
83195237
FB
1991@item
1992target x86 on PowerPC: most utilities work. Cocoa and Carbon apps are not yet supported.
1993@end itemize
1994
1995[1] If you're host commpage can be executed by qemu.
1996
1997@node Mac OS X/Darwin Quick Start
1998@subsection Quick Start
1999
2000In order to launch a Mac OS X/Darwin process, QEMU needs the process executable
2001itself and all the target dynamic libraries used by it. If you don't have the FAT
2002libraries (you're running Mac OS X/ppc) you'll need to obtain it from a Mac OS X
2003CD or compile them by hand.
2004
2005@itemize
2006
2007@item On x86, you can just try to launch any process by using the native
2008libraries:
2009
2010@example
dbcf5e82 2011qemu-i386 /bin/ls
83195237
FB
2012@end example
2013
2014or to run the ppc version of the executable:
2015
2016@example
dbcf5e82 2017qemu-ppc /bin/ls
83195237
FB
2018@end example
2019
2020@item On ppc, you'll have to tell qemu where your x86 libraries (and dynamic linker)
2021are installed:
2022
2023@example
dbcf5e82 2024qemu-i386 -L /opt/x86_root/ /bin/ls
83195237
FB
2025@end example
2026
2027@code{-L /opt/x86_root/} tells that the dynamic linker (dyld) path is in
2028@file{/opt/x86_root/usr/bin/dyld}.
2029
2030@end itemize
2031
2032@node Mac OS X/Darwin Command line options
2033@subsection Command line options
2034
2035@example
dbcf5e82 2036usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
83195237
FB
2037@end example
2038
2039@table @option
2040@item -h
2041Print the help
2042@item -L path
2043Set the library root path (default=/)
2044@item -s size
2045Set the stack size in bytes (default=524288)
2046@end table
2047
2048Debug options:
2049
2050@table @option
2051@item -d
2052Activate log (logfile=/tmp/qemu.log)
2053@item -p pagesize
2054Act as if the host page size was 'pagesize' bytes
2055@end table
2056
15a34c63
FB
2057@node compilation
2058@chapter Compilation from the sources
2059
debc7065
FB
2060@menu
2061* Linux/Unix::
2062* Windows::
2063* Cross compilation for Windows with Linux::
2064* Mac OS X::
2065@end menu
2066
2067@node Linux/Unix
7c3fc84d
FB
2068@section Linux/Unix
2069
2070@subsection Compilation
2071
2072First you must decompress the sources:
2073@example
2074cd /tmp
2075tar zxvf qemu-x.y.z.tar.gz
2076cd qemu-x.y.z
2077@end example
2078
2079Then you configure QEMU and build it (usually no options are needed):
2080@example
2081./configure
2082make
2083@end example
2084
2085Then type as root user:
2086@example
2087make install
2088@end example
2089to install QEMU in @file{/usr/local}.
2090
4fe8b87a 2091@subsection GCC version
7c3fc84d 2092
366dfc52 2093In order to compile QEMU successfully, it is very important that you
4fe8b87a
FB
2094have the right tools. The most important one is gcc. On most hosts and
2095in particular on x86 ones, @emph{gcc 4.x is not supported}. If your
2096Linux distribution includes a gcc 4.x compiler, you can usually
2097install an older version (it is invoked by @code{gcc32} or
2098@code{gcc34}). The QEMU configure script automatically probes for
2099these older versions so that usally you don't have to do anything.
15a34c63 2100
debc7065 2101@node Windows
15a34c63
FB
2102@section Windows
2103
2104@itemize
2105@item Install the current versions of MSYS and MinGW from
2106@url{http://www.mingw.org/}. You can find detailed installation
2107instructions in the download section and the FAQ.
2108
2109@item Download
2110the MinGW development library of SDL 1.2.x
debc7065 2111(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
15a34c63
FB
2112@url{http://www.libsdl.org}. Unpack it in a temporary place, and
2113unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
2114directory. Edit the @file{sdl-config} script so that it gives the
2115correct SDL directory when invoked.
2116
2117@item Extract the current version of QEMU.
2118
2119@item Start the MSYS shell (file @file{msys.bat}).
2120
2121@item Change to the QEMU directory. Launch @file{./configure} and
2122@file{make}. If you have problems using SDL, verify that
2123@file{sdl-config} can be launched from the MSYS command line.
2124
2125@item You can install QEMU in @file{Program Files/Qemu} by typing
2126@file{make install}. Don't forget to copy @file{SDL.dll} in
2127@file{Program Files/Qemu}.
2128
2129@end itemize
2130
debc7065 2131@node Cross compilation for Windows with Linux
15a34c63
FB
2132@section Cross compilation for Windows with Linux
2133
2134@itemize
2135@item
2136Install the MinGW cross compilation tools available at
2137@url{http://www.mingw.org/}.
2138
2139@item
2140Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
2141unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
2142variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
2143the QEMU configuration script.
2144
2145@item
2146Configure QEMU for Windows cross compilation:
2147@example
2148./configure --enable-mingw32
2149@end example
2150If necessary, you can change the cross-prefix according to the prefix
2151choosen for the MinGW tools with --cross-prefix. You can also use
2152--prefix to set the Win32 install path.
2153
2154@item You can install QEMU in the installation directory by typing
2155@file{make install}. Don't forget to copy @file{SDL.dll} in the
2156installation directory.
2157
2158@end itemize
2159
2160Note: Currently, Wine does not seem able to launch
2161QEMU for Win32.
2162
debc7065 2163@node Mac OS X
15a34c63
FB
2164@section Mac OS X
2165
2166The Mac OS X patches are not fully merged in QEMU, so you should look
2167at the QEMU mailing list archive to have all the necessary
2168information.
2169
debc7065
FB
2170@node Index
2171@chapter Index
2172@printindex cp
2173
2174@bye