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