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