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