Statistics
| Branch: | Revision:

root / qemu-doc.texi @ c5d6edc3

History | View | Annotate | Download (50.8 kB)

1 386405f7 bellard
\input texinfo @c -*- texinfo -*-
2 debc7065 bellard
@c %**start of header
3 debc7065 bellard
@setfilename qemu-doc.info
4 debc7065 bellard
@settitle QEMU CPU Emulator User Documentation
5 debc7065 bellard
@exampleindent 0
6 debc7065 bellard
@paragraphindent 0
7 debc7065 bellard
@c %**end of header
8 386405f7 bellard
9 0806e3f6 bellard
@iftex
10 386405f7 bellard
@titlepage
11 386405f7 bellard
@sp 7
12 debc7065 bellard
@center @titlefont{QEMU CPU Emulator}
13 debc7065 bellard
@sp 1
14 debc7065 bellard
@center @titlefont{User Documentation}
15 386405f7 bellard
@sp 3
16 386405f7 bellard
@end titlepage
17 0806e3f6 bellard
@end iftex
18 386405f7 bellard
19 debc7065 bellard
@ifnottex
20 debc7065 bellard
@node Top
21 debc7065 bellard
@top
22 debc7065 bellard
23 debc7065 bellard
@menu
24 debc7065 bellard
* Introduction::
25 debc7065 bellard
* Installation::
26 debc7065 bellard
* QEMU PC System emulator::
27 debc7065 bellard
* QEMU System emulator for non PC targets::
28 debc7065 bellard
* QEMU Linux User space emulator::
29 debc7065 bellard
* compilation:: Compilation from the sources
30 debc7065 bellard
* Index::
31 debc7065 bellard
@end menu
32 debc7065 bellard
@end ifnottex
33 debc7065 bellard
34 debc7065 bellard
@contents
35 debc7065 bellard
36 debc7065 bellard
@node Introduction
37 386405f7 bellard
@chapter Introduction
38 386405f7 bellard
39 debc7065 bellard
@menu
40 debc7065 bellard
* intro_features:: Features
41 debc7065 bellard
@end menu
42 debc7065 bellard
43 debc7065 bellard
@node intro_features
44 322d0c66 bellard
@section Features
45 386405f7 bellard
46 1f673135 bellard
QEMU is a FAST! processor emulator using dynamic translation to
47 1f673135 bellard
achieve good emulation speed.
48 1eb20527 bellard
49 1eb20527 bellard
QEMU has two operating modes:
50 0806e3f6 bellard
51 0806e3f6 bellard
@itemize @minus
52 0806e3f6 bellard
53 0806e3f6 bellard
@item 
54 1f673135 bellard
Full system emulation. In this mode, QEMU emulates a full system (for
55 3f9f3aa1 bellard
example a PC), including one or several processors and various
56 3f9f3aa1 bellard
peripherals. It can be used to launch different Operating Systems
57 3f9f3aa1 bellard
without rebooting the PC or to debug system code.
58 1eb20527 bellard
59 0806e3f6 bellard
@item 
60 1f673135 bellard
User mode emulation (Linux host only). In this mode, QEMU can launch
61 1f673135 bellard
Linux processes compiled for one CPU on another CPU. It can be used to
62 1f673135 bellard
launch the Wine Windows API emulator (@url{http://www.winehq.org}) or
63 1f673135 bellard
to ease cross-compilation and cross-debugging.
64 1eb20527 bellard
65 1eb20527 bellard
@end itemize
66 1eb20527 bellard
67 7c3fc84d bellard
QEMU can run without an host kernel driver and yet gives acceptable
68 6f2f2b24 bellard
performance. 
69 322d0c66 bellard
70 52c00a5f bellard
For system emulation, the following hardware targets are supported:
71 52c00a5f bellard
@itemize
72 9d0a8e6f bellard
@item PC (x86 or x86_64 processor)
73 3f9f3aa1 bellard
@item ISA PC (old style PC without PCI bus)
74 52c00a5f bellard
@item PREP (PowerPC processor)
75 9d0a8e6f bellard
@item G3 BW PowerMac (PowerPC processor)
76 9d0a8e6f bellard
@item Mac99 PowerMac (PowerPC processor, in progress)
77 3475187d bellard
@item Sun4m (32-bit Sparc processor)
78 3475187d bellard
@item Sun4u (64-bit Sparc processor, in progress)
79 3f9f3aa1 bellard
@item Malta board (32-bit MIPS processor)
80 ed96ca35 pbrook
@item ARM Integrator/CP (ARM926E or 1026E processor)
81 00a9bf19 pbrook
@item ARM Versatile baseboard (ARM926E)
82 52c00a5f bellard
@end itemize
83 386405f7 bellard
84 3f9f3aa1 bellard
For user emulation, x86, PowerPC, ARM, MIPS, and Sparc32/64 CPUs are supported.
85 0806e3f6 bellard
86 debc7065 bellard
@node Installation
87 5b9f457a bellard
@chapter Installation
88 5b9f457a bellard
89 15a34c63 bellard
If you want to compile QEMU yourself, see @ref{compilation}.
90 15a34c63 bellard
91 debc7065 bellard
@menu
92 debc7065 bellard
* install_linux::   Linux
93 debc7065 bellard
* install_windows:: Windows
94 debc7065 bellard
* install_mac::     Macintosh
95 debc7065 bellard
@end menu
96 debc7065 bellard
97 debc7065 bellard
@node install_linux
98 1f673135 bellard
@section Linux
99 1f673135 bellard
100 7c3fc84d bellard
If a precompiled package is available for your distribution - you just
101 7c3fc84d bellard
have to install it. Otherwise, see @ref{compilation}.
102 5b9f457a bellard
103 debc7065 bellard
@node install_windows
104 1f673135 bellard
@section Windows
105 8cd0ac2f bellard
106 15a34c63 bellard
Download the experimental binary installer at
107 debc7065 bellard
@url{http://www.free.oszoo.org/@/download.html}.
108 d691f669 bellard
109 debc7065 bellard
@node install_mac
110 1f673135 bellard
@section Mac OS X
111 d691f669 bellard
112 15a34c63 bellard
Download the experimental binary installer at
113 debc7065 bellard
@url{http://www.free.oszoo.org/@/download.html}.
114 df0f11a0 bellard
115 debc7065 bellard
@node QEMU PC System emulator
116 3f9f3aa1 bellard
@chapter QEMU PC System emulator
117 1eb20527 bellard
118 debc7065 bellard
@menu
119 debc7065 bellard
* pcsys_introduction:: Introduction
120 debc7065 bellard
* pcsys_quickstart::   Quick Start
121 debc7065 bellard
* sec_invocation::     Invocation
122 debc7065 bellard
* pcsys_keys::         Keys
123 debc7065 bellard
* pcsys_monitor::      QEMU Monitor
124 debc7065 bellard
* disk_images::        Disk Images
125 debc7065 bellard
* pcsys_network::      Network emulation
126 debc7065 bellard
* direct_linux_boot::  Direct Linux Boot
127 debc7065 bellard
* pcsys_usb::          USB emulation
128 debc7065 bellard
* gdb_usage::          GDB usage
129 debc7065 bellard
* pcsys_os_specific::  Target OS specific information
130 debc7065 bellard
@end menu
131 debc7065 bellard
132 debc7065 bellard
@node pcsys_introduction
133 0806e3f6 bellard
@section Introduction
134 0806e3f6 bellard
135 0806e3f6 bellard
@c man begin DESCRIPTION
136 0806e3f6 bellard
137 3f9f3aa1 bellard
The QEMU PC System emulator simulates the
138 3f9f3aa1 bellard
following peripherals:
139 0806e3f6 bellard
140 0806e3f6 bellard
@itemize @minus
141 15a34c63 bellard
@item 
142 15a34c63 bellard
i440FX host PCI bridge and PIIX3 PCI to ISA bridge
143 0806e3f6 bellard
@item
144 15a34c63 bellard
Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
145 15a34c63 bellard
extensions (hardware level, including all non standard modes).
146 0806e3f6 bellard
@item
147 0806e3f6 bellard
PS/2 mouse and keyboard
148 0806e3f6 bellard
@item 
149 15a34c63 bellard
2 PCI IDE interfaces with hard disk and CD-ROM support
150 1f673135 bellard
@item
151 1f673135 bellard
Floppy disk
152 0806e3f6 bellard
@item 
153 15a34c63 bellard
NE2000 PCI network adapters
154 0806e3f6 bellard
@item
155 05d5818c bellard
Serial ports
156 05d5818c bellard
@item
157 c0fe3827 bellard
Creative SoundBlaster 16 sound card
158 c0fe3827 bellard
@item
159 c0fe3827 bellard
ENSONIQ AudioPCI ES1370 sound card
160 c0fe3827 bellard
@item
161 c0fe3827 bellard
Adlib(OPL2) - Yamaha YM3812 compatible chip
162 b389dbfb bellard
@item
163 b389dbfb bellard
PCI UHCI USB controller and a virtual USB hub.
164 0806e3f6 bellard
@end itemize
165 0806e3f6 bellard
166 3f9f3aa1 bellard
SMP is supported with up to 255 CPUs.
167 3f9f3aa1 bellard
168 c0fe3827 bellard
Note that adlib is only available when QEMU was configured with
169 c0fe3827 bellard
-enable-adlib
170 c0fe3827 bellard
171 15a34c63 bellard
QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
172 15a34c63 bellard
VGA BIOS.
173 15a34c63 bellard
174 c0fe3827 bellard
QEMU uses YM3812 emulation by Tatsuyuki Satoh.
175 c0fe3827 bellard
176 0806e3f6 bellard
@c man end
177 0806e3f6 bellard
178 debc7065 bellard
@node pcsys_quickstart
179 1eb20527 bellard
@section Quick Start
180 1eb20527 bellard
181 285dc330 bellard
Download and uncompress the linux image (@file{linux.img}) and type:
182 0806e3f6 bellard
183 0806e3f6 bellard
@example
184 285dc330 bellard
qemu linux.img
185 0806e3f6 bellard
@end example
186 0806e3f6 bellard
187 0806e3f6 bellard
Linux should boot and give you a prompt.
188 0806e3f6 bellard
189 6cc721cf bellard
@node sec_invocation
190 ec410fc9 bellard
@section Invocation
191 ec410fc9 bellard
192 ec410fc9 bellard
@example
193 0806e3f6 bellard
@c man begin SYNOPSIS
194 0806e3f6 bellard
usage: qemu [options] [disk_image]
195 0806e3f6 bellard
@c man end
196 ec410fc9 bellard
@end example
197 ec410fc9 bellard
198 0806e3f6 bellard
@c man begin OPTIONS
199 9d4520d0 bellard
@var{disk_image} is a raw hard disk image for IDE hard disk 0.
200 ec410fc9 bellard
201 ec410fc9 bellard
General options:
202 ec410fc9 bellard
@table @option
203 3dbbdc25 bellard
@item -M machine
204 3dbbdc25 bellard
Select the emulated machine (@code{-M ?} for list)
205 3dbbdc25 bellard
206 2be3bc02 bellard
@item -fda file
207 2be3bc02 bellard
@item -fdb file
208 debc7065 bellard
Use @var{file} as floppy disk 0/1 image (@pxref{disk_images}). You can
209 be3edd95 bellard
use the host floppy by using @file{/dev/fd0} as filename.
210 2be3bc02 bellard
211 ec410fc9 bellard
@item -hda file
212 ec410fc9 bellard
@item -hdb file
213 181f1558 bellard
@item -hdc file
214 181f1558 bellard
@item -hdd file
215 debc7065 bellard
Use @var{file} as hard disk 0, 1, 2 or 3 image (@pxref{disk_images}).
216 1f47a922 bellard
217 181f1558 bellard
@item -cdrom file
218 181f1558 bellard
Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
219 be3edd95 bellard
@option{-cdrom} at the same time). You can use the host CD-ROM by
220 be3edd95 bellard
using @file{/dev/cdrom} as filename.
221 181f1558 bellard
222 1f673135 bellard
@item -boot [a|c|d]
223 1f673135 bellard
Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is
224 2be3bc02 bellard
the default.
225 1f47a922 bellard
226 181f1558 bellard
@item -snapshot
227 1f47a922 bellard
Write to temporary files instead of disk image files. In this case,
228 1f47a922 bellard
the raw disk image you use is not written back. You can however force
229 debc7065 bellard
the write back by pressing @key{C-a s} (@pxref{disk_images}). 
230 ec410fc9 bellard
231 52ca8d6a bellard
@item -no-fd-bootchk
232 52ca8d6a bellard
Disable boot signature checking for floppy disks in Bochs BIOS. It may
233 52ca8d6a bellard
be needed to boot from old floppy disks.
234 52ca8d6a bellard
235 ec410fc9 bellard
@item -m megs
236 15a34c63 bellard
Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
237 ec410fc9 bellard
238 3f9f3aa1 bellard
@item -smp n
239 3f9f3aa1 bellard
Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
240 3f9f3aa1 bellard
CPUs are supported.
241 3f9f3aa1 bellard
242 0806e3f6 bellard
@item -nographic
243 0806e3f6 bellard
244 0806e3f6 bellard
Normally, QEMU uses SDL to display the VGA output. With this option,
245 0806e3f6 bellard
you can totally disable graphical output so that QEMU is a simple
246 0806e3f6 bellard
command line application. The emulated serial port is redirected on
247 0806e3f6 bellard
the console. Therefore, you can still use QEMU to debug a Linux kernel
248 0806e3f6 bellard
with a serial console.
249 0806e3f6 bellard
250 24236869 bellard
@item -vnc d
251 24236869 bellard
252 24236869 bellard
Normally, QEMU uses SDL to display the VGA output.  With this option,
253 24236869 bellard
you can have QEMU listen on VNC display d and redirect the VGA display
254 24236869 bellard
over the VNC session.  It is very useful to enable the usb tablet device
255 24236869 bellard
when using this option (option @option{-usbdevice tablet}).
256 24236869 bellard
257 3d11d0eb bellard
@item -k language
258 3d11d0eb bellard
259 3d11d0eb bellard
Use keyboard layout @var{language} (for example @code{fr} for
260 3d11d0eb bellard
French). This option is only needed where it is not easy to get raw PC
261 3d11d0eb bellard
keycodes (e.g. on Macs or with some X11 servers). You don't need to
262 3d11d0eb bellard
use it on PC/Linux or PC/Windows hosts.
263 3d11d0eb bellard
264 3d11d0eb bellard
The available layouts are:
265 3d11d0eb bellard
@example
266 3d11d0eb bellard
ar  de-ch  es  fo     fr-ca  hu  ja  mk     no  pt-br  sv
267 3d11d0eb bellard
da  en-gb  et  fr     fr-ch  is  lt  nl     pl  ru     th
268 3d11d0eb bellard
de  en-us  fi  fr-be  hr     it  lv  nl-be  pt  sl     tr
269 3d11d0eb bellard
@end example
270 3d11d0eb bellard
271 3d11d0eb bellard
The default is @code{en-us}.
272 3d11d0eb bellard
273 1d14ffa9 bellard
@item -audio-help
274 1d14ffa9 bellard
275 1d14ffa9 bellard
Will show the audio subsystem help: list of drivers, tunable
276 1d14ffa9 bellard
parameters.
277 1d14ffa9 bellard
278 6a36d84e bellard
@item -soundhw card1,card2,... or -soundhw all
279 1d14ffa9 bellard
280 1d14ffa9 bellard
Enable audio and selected sound hardware. Use ? to print all
281 1d14ffa9 bellard
available sound hardware.
282 1d14ffa9 bellard
283 1d14ffa9 bellard
@example
284 1d14ffa9 bellard
qemu -soundhw sb16,adlib hda
285 1d14ffa9 bellard
qemu -soundhw es1370 hda
286 6a36d84e bellard
qemu -soundhw all hda
287 1d14ffa9 bellard
qemu -soundhw ?
288 1d14ffa9 bellard
@end example
289 a8c490cd bellard
290 15a34c63 bellard
@item -localtime
291 15a34c63 bellard
Set the real time clock to local time (the default is to UTC
292 15a34c63 bellard
time). This option is needed to have correct date in MS-DOS or
293 15a34c63 bellard
Windows.
294 15a34c63 bellard
295 d63d307f bellard
@item -full-screen
296 d63d307f bellard
Start in full screen.
297 d63d307f bellard
298 f7cce898 bellard
@item -pidfile file
299 f7cce898 bellard
Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
300 f7cce898 bellard
from a script.
301 f7cce898 bellard
302 9d0a8e6f bellard
@item -win2k-hack
303 9d0a8e6f bellard
Use it when installing Windows 2000 to avoid a disk full bug. After
304 9d0a8e6f bellard
Windows 2000 is installed, you no longer need this option (this option
305 9d0a8e6f bellard
slows down the IDE transfers).
306 9d0a8e6f bellard
307 0806e3f6 bellard
@end table
308 0806e3f6 bellard
309 b389dbfb bellard
USB options:
310 b389dbfb bellard
@table @option
311 b389dbfb bellard
312 b389dbfb bellard
@item -usb
313 b389dbfb bellard
Enable the USB driver (will be the default soon)
314 b389dbfb bellard
315 b389dbfb bellard
@item -usbdevice devname
316 0aff66b5 pbrook
Add the USB device @var{devname}. @xref{usb_devices}.
317 b389dbfb bellard
@end table
318 b389dbfb bellard
319 1f673135 bellard
Network options:
320 1f673135 bellard
321 1f673135 bellard
@table @option
322 1f673135 bellard
323 a41b2ff2 pbrook
@item -net nic[,vlan=n][,macaddr=addr][,model=type]
324 41d03949 bellard
Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
325 41d03949 bellard
= 0 is the default). The NIC is currently an NE2000 on the PC
326 41d03949 bellard
target. Optionally, the MAC address can be changed. If no
327 41d03949 bellard
@option{-net} option is specified, a single NIC is created.
328 a41b2ff2 pbrook
Qemu can emulate several different models of network card.  Valid values for
329 a41b2ff2 pbrook
@var{type} are @code{ne2k_pci}, @code{ne2k_isa}, @code{rtl8139},
330 a41b2ff2 pbrook
@code{smc91c111} and @code{lance}.  Not all devices are supported on all
331 a41b2ff2 pbrook
targets.
332 41d03949 bellard
333 115defd1 pbrook
@item -net user[,vlan=n][,hostname=name]
334 7e89463d bellard
Use the user mode network stack which requires no administrator
335 a03a6053 pbrook
priviledge to run.  @option{hostname=name} can be used to specify the client
336 115defd1 pbrook
hostname reported by the builtin DHCP server.
337 41d03949 bellard
338 41d03949 bellard
@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file]
339 41d03949 bellard
Connect the host TAP network interface @var{name} to VLAN @var{n} and
340 41d03949 bellard
use the network script @var{file} to configure it. The default
341 41d03949 bellard
network script is @file{/etc/qemu-ifup}. If @var{name} is not
342 41d03949 bellard
provided, the OS automatically provides one.  @option{fd=h} can be
343 41d03949 bellard
used to specify the handle of an already opened host TAP interface. Example:
344 1f673135 bellard
345 41d03949 bellard
@example
346 41d03949 bellard
qemu linux.img -net nic -net tap
347 41d03949 bellard
@end example
348 41d03949 bellard
349 41d03949 bellard
More complicated example (two NICs, each one connected to a TAP device)
350 41d03949 bellard
@example
351 41d03949 bellard
qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
352 41d03949 bellard
               -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
353 41d03949 bellard
@end example
354 3f1a88f4 bellard
355 3f1a88f4 bellard
356 41d03949 bellard
@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]
357 1f673135 bellard
358 41d03949 bellard
Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual
359 41d03949 bellard
machine using a TCP socket connection. If @option{listen} is
360 41d03949 bellard
specified, QEMU waits for incoming connections on @var{port}
361 41d03949 bellard
(@var{host} is optional). @option{connect} is used to connect to
362 3d830459 bellard
another QEMU instance using the @option{listen} option. @option{fd=h}
363 3d830459 bellard
specifies an already opened TCP socket.
364 1f673135 bellard
365 41d03949 bellard
Example:
366 41d03949 bellard
@example
367 41d03949 bellard
# launch a first QEMU instance
368 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
369 debc7065 bellard
               -net socket,listen=:1234
370 debc7065 bellard
# connect the VLAN 0 of this instance to the VLAN 0
371 debc7065 bellard
# of the first instance
372 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
373 debc7065 bellard
               -net socket,connect=127.0.0.1:1234
374 41d03949 bellard
@end example
375 52c00a5f bellard
376 3d830459 bellard
@item -net socket[,vlan=n][,fd=h][,mcast=maddr:port]
377 3d830459 bellard
378 3d830459 bellard
Create a VLAN @var{n} shared with another QEMU virtual
379 3d830459 bellard
machines using a UDP multicast socket, effectively making a bus for 
380 3d830459 bellard
every QEMU with same multicast address @var{maddr} and @var{port}.
381 3d830459 bellard
NOTES:
382 3d830459 bellard
@enumerate
383 3d830459 bellard
@item 
384 3d830459 bellard
Several QEMU can be running on different hosts and share same bus (assuming 
385 3d830459 bellard
correct multicast setup for these hosts).
386 3d830459 bellard
@item
387 3d830459 bellard
mcast support is compatible with User Mode Linux (argument @option{eth@var{N}=mcast}), see
388 3d830459 bellard
@url{http://user-mode-linux.sf.net}.
389 3d830459 bellard
@item Use @option{fd=h} to specify an already opened UDP multicast socket.
390 3d830459 bellard
@end enumerate
391 3d830459 bellard
392 3d830459 bellard
Example:
393 3d830459 bellard
@example
394 3d830459 bellard
# launch one QEMU instance
395 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
396 debc7065 bellard
               -net socket,mcast=230.0.0.1:1234
397 3d830459 bellard
# launch another QEMU instance on same "bus"
398 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
399 debc7065 bellard
               -net socket,mcast=230.0.0.1:1234
400 3d830459 bellard
# launch yet another QEMU instance on same "bus"
401 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
402 debc7065 bellard
               -net socket,mcast=230.0.0.1:1234
403 3d830459 bellard
@end example
404 3d830459 bellard
405 3d830459 bellard
Example (User Mode Linux compat.):
406 3d830459 bellard
@example
407 debc7065 bellard
# launch QEMU instance (note mcast address selected
408 debc7065 bellard
# is UML's default)
409 debc7065 bellard
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
410 debc7065 bellard
               -net socket,mcast=239.192.168.1:1102
411 3d830459 bellard
# launch UML
412 3d830459 bellard
/path/to/linux ubd0=/path/to/root_fs eth0=mcast
413 3d830459 bellard
@end example
414 3d830459 bellard
415 41d03949 bellard
@item -net none
416 41d03949 bellard
Indicate that no network devices should be configured. It is used to
417 039af320 bellard
override the default configuration (@option{-net nic -net user}) which
418 039af320 bellard
is activated if no @option{-net} options are provided.
419 52c00a5f bellard
420 9bf05444 bellard
@item -tftp prefix
421 9bf05444 bellard
When using the user mode network stack, activate a built-in TFTP
422 9bf05444 bellard
server. All filenames beginning with @var{prefix} can be downloaded
423 9bf05444 bellard
from the host to the guest using a TFTP client. The TFTP client on the
424 9bf05444 bellard
guest must be configured in binary mode (use the command @code{bin} of
425 9bf05444 bellard
the Unix TFTP client). The host IP address on the guest is as usual
426 9bf05444 bellard
10.0.2.2.
427 9bf05444 bellard
428 2518bd0d bellard
@item -smb dir
429 2518bd0d bellard
When using the user mode network stack, activate a built-in SMB
430 2518bd0d bellard
server so that Windows OSes can access to the host files in @file{dir}
431 2518bd0d bellard
transparently.
432 2518bd0d bellard
433 2518bd0d bellard
In the guest Windows OS, the line:
434 2518bd0d bellard
@example
435 2518bd0d bellard
10.0.2.4 smbserver
436 2518bd0d bellard
@end example
437 2518bd0d bellard
must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
438 2518bd0d bellard
or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
439 2518bd0d bellard
440 2518bd0d bellard
Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
441 2518bd0d bellard
442 2518bd0d bellard
Note that a SAMBA server must be installed on the host OS in
443 2518bd0d bellard
@file{/usr/sbin/smbd}. QEMU was tested succesfully with smbd version
444 6cc721cf bellard
2.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
445 2518bd0d bellard
446 9bf05444 bellard
@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
447 9bf05444 bellard
448 9bf05444 bellard
When using the user mode network stack, redirect incoming TCP or UDP
449 9bf05444 bellard
connections to the host port @var{host-port} to the guest
450 9bf05444 bellard
@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
451 9bf05444 bellard
is not specified, its value is 10.0.2.15 (default address given by the
452 9bf05444 bellard
built-in DHCP server).
453 9bf05444 bellard
454 9bf05444 bellard
For example, to redirect host X11 connection from screen 1 to guest
455 9bf05444 bellard
screen 0, use the following:
456 9bf05444 bellard
457 9bf05444 bellard
@example
458 9bf05444 bellard
# on the host
459 9bf05444 bellard
qemu -redir tcp:6001::6000 [...]
460 9bf05444 bellard
# this host xterm should open in the guest X11 server
461 9bf05444 bellard
xterm -display :1
462 9bf05444 bellard
@end example
463 9bf05444 bellard
464 9bf05444 bellard
To redirect telnet connections from host port 5555 to telnet port on
465 9bf05444 bellard
the guest, use the following:
466 9bf05444 bellard
467 9bf05444 bellard
@example
468 9bf05444 bellard
# on the host
469 9bf05444 bellard
qemu -redir tcp:5555::23 [...]
470 9bf05444 bellard
telnet localhost 5555
471 9bf05444 bellard
@end example
472 9bf05444 bellard
473 9bf05444 bellard
Then when you use on the host @code{telnet localhost 5555}, you
474 9bf05444 bellard
connect to the guest telnet server.
475 9bf05444 bellard
476 1f673135 bellard
@end table
477 1f673135 bellard
478 41d03949 bellard
Linux boot specific: When using these options, you can use a given
479 1f673135 bellard
Linux kernel without installing it in the disk image. It can be useful
480 1f673135 bellard
for easier testing of various kernels.
481 1f673135 bellard
482 0806e3f6 bellard
@table @option
483 0806e3f6 bellard
484 0806e3f6 bellard
@item -kernel bzImage 
485 0806e3f6 bellard
Use @var{bzImage} as kernel image.
486 0806e3f6 bellard
487 0806e3f6 bellard
@item -append cmdline 
488 0806e3f6 bellard
Use @var{cmdline} as kernel command line
489 0806e3f6 bellard
490 0806e3f6 bellard
@item -initrd file
491 0806e3f6 bellard
Use @var{file} as initial ram disk.
492 0806e3f6 bellard
493 ec410fc9 bellard
@end table
494 ec410fc9 bellard
495 15a34c63 bellard
Debug/Expert options:
496 ec410fc9 bellard
@table @option
497 a0a821a4 bellard
498 a0a821a4 bellard
@item -serial dev
499 a0a821a4 bellard
Redirect the virtual serial port to host device @var{dev}. Available
500 a0a821a4 bellard
devices are:
501 a0a821a4 bellard
@table @code
502 a0a821a4 bellard
@item vc
503 a0a821a4 bellard
Virtual console
504 a0a821a4 bellard
@item pty
505 a0a821a4 bellard
[Linux only] Pseudo TTY (a new PTY is automatically allocated)
506 a0a821a4 bellard
@item null
507 a0a821a4 bellard
void device
508 f8d179e3 bellard
@item /dev/XXX
509 e57a8c0e bellard
[Linux only] Use host tty, e.g. @file{/dev/ttyS0}. The host serial port
510 f8d179e3 bellard
parameters are set according to the emulated ones.
511 e57a8c0e bellard
@item /dev/parportN
512 e57a8c0e bellard
[Linux only, parallel port only] Use host parallel port
513 e57a8c0e bellard
@var{N}. Currently only SPP parallel port features can be used.
514 f8d179e3 bellard
@item file:filename
515 f8d179e3 bellard
Write output to filename. No character can be read.
516 a0a821a4 bellard
@item stdio
517 a0a821a4 bellard
[Unix only] standard input/output
518 f8d179e3 bellard
@item pipe:filename
519 f8d179e3 bellard
[Unix only] name pipe @var{filename}
520 a0a821a4 bellard
@end table
521 a0a821a4 bellard
The default device is @code{vc} in graphical mode and @code{stdio} in
522 a0a821a4 bellard
non graphical mode.
523 a0a821a4 bellard
524 05d5818c bellard
This option can be used several times to simulate up to 4 serials
525 05d5818c bellard
ports.
526 05d5818c bellard
527 e57a8c0e bellard
@item -parallel dev
528 e57a8c0e bellard
Redirect the virtual parallel port to host device @var{dev} (same
529 e57a8c0e bellard
devices as the serial port). On Linux hosts, @file{/dev/parportN} can
530 e57a8c0e bellard
be used to use hardware devices connected on the corresponding host
531 e57a8c0e bellard
parallel port.
532 e57a8c0e bellard
533 e57a8c0e bellard
This option can be used several times to simulate up to 3 parallel
534 e57a8c0e bellard
ports.
535 e57a8c0e bellard
536 a0a821a4 bellard
@item -monitor dev
537 a0a821a4 bellard
Redirect the monitor to host device @var{dev} (same devices as the
538 a0a821a4 bellard
serial port).
539 a0a821a4 bellard
The default device is @code{vc} in graphical mode and @code{stdio} in
540 a0a821a4 bellard
non graphical mode.
541 a0a821a4 bellard
542 ec410fc9 bellard
@item -s
543 debc7065 bellard
Wait gdb connection to port 1234 (@pxref{gdb_usage}). 
544 ec410fc9 bellard
@item -p port
545 ec410fc9 bellard
Change gdb connection port.
546 52c00a5f bellard
@item -S
547 52c00a5f bellard
Do not start CPU at startup (you must type 'c' in the monitor).
548 ec410fc9 bellard
@item -d             
549 9d4520d0 bellard
Output log in /tmp/qemu.log
550 46d4767d bellard
@item -hdachs c,h,s,[,t]
551 46d4767d bellard
Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
552 46d4767d bellard
@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
553 46d4767d bellard
translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
554 46d4767d bellard
all thoses parameters. This option is useful for old MS-DOS disk
555 46d4767d bellard
images.
556 7c3fc84d bellard
557 15a34c63 bellard
@item -std-vga
558 15a34c63 bellard
Simulate a standard VGA card with Bochs VBE extensions (default is
559 15a34c63 bellard
Cirrus Logic GD5446 PCI VGA)
560 d63d307f bellard
@item -loadvm file
561 d63d307f bellard
Start right away with a saved state (@code{loadvm} in monitor)
562 ec410fc9 bellard
@end table
563 ec410fc9 bellard
564 3e11db9a bellard
@c man end
565 3e11db9a bellard
566 debc7065 bellard
@node pcsys_keys
567 3e11db9a bellard
@section Keys
568 3e11db9a bellard
569 3e11db9a bellard
@c man begin OPTIONS
570 3e11db9a bellard
571 a1b74fe8 bellard
During the graphical emulation, you can use the following keys:
572 a1b74fe8 bellard
@table @key
573 f9859310 bellard
@item Ctrl-Alt-f
574 a1b74fe8 bellard
Toggle full screen
575 a0a821a4 bellard
576 f9859310 bellard
@item Ctrl-Alt-n
577 a0a821a4 bellard
Switch to virtual console 'n'. Standard console mappings are:
578 a0a821a4 bellard
@table @emph
579 a0a821a4 bellard
@item 1
580 a0a821a4 bellard
Target system display
581 a0a821a4 bellard
@item 2
582 a0a821a4 bellard
Monitor
583 a0a821a4 bellard
@item 3
584 a0a821a4 bellard
Serial port
585 a1b74fe8 bellard
@end table
586 a1b74fe8 bellard
587 f9859310 bellard
@item Ctrl-Alt
588 a0a821a4 bellard
Toggle mouse and keyboard grab.
589 a0a821a4 bellard
@end table
590 a0a821a4 bellard
591 3e11db9a bellard
In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
592 3e11db9a bellard
@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
593 3e11db9a bellard
594 a0a821a4 bellard
During emulation, if you are using the @option{-nographic} option, use
595 a0a821a4 bellard
@key{Ctrl-a h} to get terminal commands:
596 ec410fc9 bellard
597 ec410fc9 bellard
@table @key
598 a1b74fe8 bellard
@item Ctrl-a h
599 ec410fc9 bellard
Print this help
600 a1b74fe8 bellard
@item Ctrl-a x    
601 ec410fc9 bellard
Exit emulatior
602 a1b74fe8 bellard
@item Ctrl-a s    
603 1f47a922 bellard
Save disk data back to file (if -snapshot)
604 a1b74fe8 bellard
@item Ctrl-a b
605 1f673135 bellard
Send break (magic sysrq in Linux)
606 a1b74fe8 bellard
@item Ctrl-a c
607 1f673135 bellard
Switch between console and monitor
608 a1b74fe8 bellard
@item Ctrl-a Ctrl-a
609 a1b74fe8 bellard
Send Ctrl-a
610 ec410fc9 bellard
@end table
611 0806e3f6 bellard
@c man end
612 0806e3f6 bellard
613 0806e3f6 bellard
@ignore
614 0806e3f6 bellard
615 1f673135 bellard
@c man begin SEEALSO
616 1f673135 bellard
The HTML documentation of QEMU for more precise information and Linux
617 1f673135 bellard
user mode emulator invocation.
618 1f673135 bellard
@c man end
619 1f673135 bellard
620 1f673135 bellard
@c man begin AUTHOR
621 1f673135 bellard
Fabrice Bellard
622 1f673135 bellard
@c man end
623 1f673135 bellard
624 1f673135 bellard
@end ignore
625 1f673135 bellard
626 debc7065 bellard
@node pcsys_monitor
627 1f673135 bellard
@section QEMU Monitor
628 1f673135 bellard
629 1f673135 bellard
The QEMU monitor is used to give complex commands to the QEMU
630 1f673135 bellard
emulator. You can use it to:
631 1f673135 bellard
632 1f673135 bellard
@itemize @minus
633 1f673135 bellard
634 1f673135 bellard
@item
635 1f673135 bellard
Remove or insert removable medias images
636 1f673135 bellard
(such as CD-ROM or floppies)
637 1f673135 bellard
638 1f673135 bellard
@item 
639 1f673135 bellard
Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
640 1f673135 bellard
from a disk file.
641 1f673135 bellard
642 1f673135 bellard
@item Inspect the VM state without an external debugger.
643 1f673135 bellard
644 1f673135 bellard
@end itemize
645 1f673135 bellard
646 1f673135 bellard
@subsection Commands
647 1f673135 bellard
648 1f673135 bellard
The following commands are available:
649 1f673135 bellard
650 1f673135 bellard
@table @option
651 1f673135 bellard
652 1f673135 bellard
@item help or ? [cmd]
653 1f673135 bellard
Show the help for all commands or just for command @var{cmd}.
654 1f673135 bellard
655 1f673135 bellard
@item commit  
656 1f673135 bellard
Commit changes to the disk images (if -snapshot is used)
657 1f673135 bellard
658 1f673135 bellard
@item info subcommand 
659 1f673135 bellard
show various information about the system state
660 1f673135 bellard
661 1f673135 bellard
@table @option
662 1f673135 bellard
@item info network
663 41d03949 bellard
show the various VLANs and the associated devices
664 1f673135 bellard
@item info block
665 1f673135 bellard
show the block devices
666 1f673135 bellard
@item info registers
667 1f673135 bellard
show the cpu registers
668 1f673135 bellard
@item info history
669 1f673135 bellard
show the command line history
670 b389dbfb bellard
@item info pci
671 b389dbfb bellard
show emulated PCI device
672 b389dbfb bellard
@item info usb
673 b389dbfb bellard
show USB devices plugged on the virtual USB hub
674 b389dbfb bellard
@item info usbhost
675 b389dbfb bellard
show all USB host devices
676 1f673135 bellard
@end table
677 1f673135 bellard
678 1f673135 bellard
@item q or quit
679 1f673135 bellard
Quit the emulator.
680 1f673135 bellard
681 1f673135 bellard
@item eject [-f] device
682 1f673135 bellard
Eject a removable media (use -f to force it).
683 1f673135 bellard
684 1f673135 bellard
@item change device filename
685 1f673135 bellard
Change a removable media.
686 1f673135 bellard
687 1f673135 bellard
@item screendump filename
688 1f673135 bellard
Save screen into PPM image @var{filename}.
689 1f673135 bellard
690 1f673135 bellard
@item log item1[,...]
691 1f673135 bellard
Activate logging of the specified items to @file{/tmp/qemu.log}.
692 1f673135 bellard
693 1f673135 bellard
@item savevm filename
694 1f673135 bellard
Save the whole virtual machine state to @var{filename}.
695 1f673135 bellard
696 1f673135 bellard
@item loadvm filename
697 1f673135 bellard
Restore the whole virtual machine state from @var{filename}.
698 1f673135 bellard
699 1f673135 bellard
@item stop
700 1f673135 bellard
Stop emulation.
701 1f673135 bellard
702 1f673135 bellard
@item c or cont
703 1f673135 bellard
Resume emulation.
704 1f673135 bellard
705 1f673135 bellard
@item gdbserver [port]
706 1f673135 bellard
Start gdbserver session (default port=1234)
707 1f673135 bellard
708 1f673135 bellard
@item x/fmt addr
709 1f673135 bellard
Virtual memory dump starting at @var{addr}.
710 1f673135 bellard
711 1f673135 bellard
@item xp /fmt addr
712 1f673135 bellard
Physical memory dump starting at @var{addr}.
713 1f673135 bellard
714 1f673135 bellard
@var{fmt} is a format which tells the command how to format the
715 1f673135 bellard
data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
716 1f673135 bellard
717 1f673135 bellard
@table @var
718 1f673135 bellard
@item count 
719 1f673135 bellard
is the number of items to be dumped.
720 1f673135 bellard
721 1f673135 bellard
@item format
722 1f673135 bellard
can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
723 1f673135 bellard
c (char) or i (asm instruction).
724 1f673135 bellard
725 1f673135 bellard
@item size
726 52c00a5f bellard
can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
727 52c00a5f bellard
@code{h} or @code{w} can be specified with the @code{i} format to
728 52c00a5f bellard
respectively select 16 or 32 bit code instruction size.
729 1f673135 bellard
730 1f673135 bellard
@end table
731 1f673135 bellard
732 1f673135 bellard
Examples: 
733 1f673135 bellard
@itemize
734 1f673135 bellard
@item
735 1f673135 bellard
Dump 10 instructions at the current instruction pointer:
736 1f673135 bellard
@example 
737 1f673135 bellard
(qemu) x/10i $eip
738 1f673135 bellard
0x90107063:  ret
739 1f673135 bellard
0x90107064:  sti
740 1f673135 bellard
0x90107065:  lea    0x0(%esi,1),%esi
741 1f673135 bellard
0x90107069:  lea    0x0(%edi,1),%edi
742 1f673135 bellard
0x90107070:  ret
743 1f673135 bellard
0x90107071:  jmp    0x90107080
744 1f673135 bellard
0x90107073:  nop
745 1f673135 bellard
0x90107074:  nop
746 1f673135 bellard
0x90107075:  nop
747 1f673135 bellard
0x90107076:  nop
748 1f673135 bellard
@end example
749 1f673135 bellard
750 1f673135 bellard
@item
751 1f673135 bellard
Dump 80 16 bit values at the start of the video memory.
752 debc7065 bellard
@smallexample 
753 1f673135 bellard
(qemu) xp/80hx 0xb8000
754 1f673135 bellard
0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
755 1f673135 bellard
0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
756 1f673135 bellard
0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
757 1f673135 bellard
0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
758 1f673135 bellard
0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
759 1f673135 bellard
0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
760 1f673135 bellard
0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
761 1f673135 bellard
0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
762 1f673135 bellard
0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
763 1f673135 bellard
0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
764 debc7065 bellard
@end smallexample
765 1f673135 bellard
@end itemize
766 1f673135 bellard
767 1f673135 bellard
@item p or print/fmt expr
768 1f673135 bellard
769 1f673135 bellard
Print expression value. Only the @var{format} part of @var{fmt} is
770 1f673135 bellard
used.
771 0806e3f6 bellard
772 a3a91a35 bellard
@item sendkey keys
773 a3a91a35 bellard
774 a3a91a35 bellard
Send @var{keys} to the emulator. Use @code{-} to press several keys
775 a3a91a35 bellard
simultaneously. Example:
776 a3a91a35 bellard
@example
777 a3a91a35 bellard
sendkey ctrl-alt-f1
778 a3a91a35 bellard
@end example
779 a3a91a35 bellard
780 a3a91a35 bellard
This command is useful to send keys that your graphical user interface
781 a3a91a35 bellard
intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
782 a3a91a35 bellard
783 15a34c63 bellard
@item system_reset
784 15a34c63 bellard
785 15a34c63 bellard
Reset the system.
786 15a34c63 bellard
787 b389dbfb bellard
@item usb_add devname
788 b389dbfb bellard
789 0aff66b5 pbrook
Add the USB device @var{devname}.  For details of available devices see
790 0aff66b5 pbrook
@ref{usb_devices}
791 b389dbfb bellard
792 b389dbfb bellard
@item usb_del devname
793 b389dbfb bellard
794 b389dbfb bellard
Remove the USB device @var{devname} from the QEMU virtual USB
795 b389dbfb bellard
hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
796 b389dbfb bellard
command @code{info usb} to see the devices you can remove.
797 b389dbfb bellard
798 1f673135 bellard
@end table
799 0806e3f6 bellard
800 1f673135 bellard
@subsection Integer expressions
801 1f673135 bellard
802 1f673135 bellard
The monitor understands integers expressions for every integer
803 1f673135 bellard
argument. You can use register names to get the value of specifics
804 1f673135 bellard
CPU registers by prefixing them with @emph{$}.
805 ec410fc9 bellard
806 1f47a922 bellard
@node disk_images
807 1f47a922 bellard
@section Disk Images
808 1f47a922 bellard
809 acd935ef bellard
Since version 0.6.1, QEMU supports many disk image formats, including
810 acd935ef bellard
growable disk images (their size increase as non empty sectors are
811 acd935ef bellard
written), compressed and encrypted disk images.
812 1f47a922 bellard
813 debc7065 bellard
@menu
814 debc7065 bellard
* disk_images_quickstart::    Quick start for disk image creation
815 debc7065 bellard
* disk_images_snapshot_mode:: Snapshot mode
816 debc7065 bellard
* qemu_img_invocation::       qemu-img Invocation
817 debc7065 bellard
* disk_images_fat_images::    Virtual FAT disk images
818 debc7065 bellard
@end menu
819 debc7065 bellard
820 debc7065 bellard
@node disk_images_quickstart
821 acd935ef bellard
@subsection Quick start for disk image creation
822 acd935ef bellard
823 acd935ef bellard
You can create a disk image with the command:
824 1f47a922 bellard
@example
825 acd935ef bellard
qemu-img create myimage.img mysize
826 1f47a922 bellard
@end example
827 acd935ef bellard
where @var{myimage.img} is the disk image filename and @var{mysize} is its
828 acd935ef bellard
size in kilobytes. You can add an @code{M} suffix to give the size in
829 acd935ef bellard
megabytes and a @code{G} suffix for gigabytes.
830 acd935ef bellard
831 debc7065 bellard
See @ref{qemu_img_invocation} for more information.
832 1f47a922 bellard
833 debc7065 bellard
@node disk_images_snapshot_mode
834 1f47a922 bellard
@subsection Snapshot mode
835 1f47a922 bellard
836 1f47a922 bellard
If you use the option @option{-snapshot}, all disk images are
837 1f47a922 bellard
considered as read only. When sectors in written, they are written in
838 1f47a922 bellard
a temporary file created in @file{/tmp}. You can however force the
839 acd935ef bellard
write back to the raw disk images by using the @code{commit} monitor
840 acd935ef bellard
command (or @key{C-a s} in the serial console).
841 1f47a922 bellard
842 acd935ef bellard
@node qemu_img_invocation
843 acd935ef bellard
@subsection @code{qemu-img} Invocation
844 1f47a922 bellard
845 acd935ef bellard
@include qemu-img.texi
846 05efe46e bellard
847 debc7065 bellard
@node disk_images_fat_images
848 2c6cadd4 bellard
@subsection Virtual FAT disk images
849 2c6cadd4 bellard
850 2c6cadd4 bellard
QEMU can automatically create a virtual FAT disk image from a
851 2c6cadd4 bellard
directory tree. In order to use it, just type:
852 2c6cadd4 bellard
853 2c6cadd4 bellard
@example 
854 2c6cadd4 bellard
qemu linux.img -hdb fat:/my_directory
855 2c6cadd4 bellard
@end example
856 2c6cadd4 bellard
857 2c6cadd4 bellard
Then you access access to all the files in the @file{/my_directory}
858 2c6cadd4 bellard
directory without having to copy them in a disk image or to export
859 2c6cadd4 bellard
them via SAMBA or NFS. The default access is @emph{read-only}.
860 2c6cadd4 bellard
861 2c6cadd4 bellard
Floppies can be emulated with the @code{:floppy:} option:
862 2c6cadd4 bellard
863 2c6cadd4 bellard
@example 
864 2c6cadd4 bellard
qemu linux.img -fda fat:floppy:/my_directory
865 2c6cadd4 bellard
@end example
866 2c6cadd4 bellard
867 2c6cadd4 bellard
A read/write support is available for testing (beta stage) with the
868 2c6cadd4 bellard
@code{:rw:} option:
869 2c6cadd4 bellard
870 2c6cadd4 bellard
@example 
871 2c6cadd4 bellard
qemu linux.img -fda fat:floppy:rw:/my_directory
872 2c6cadd4 bellard
@end example
873 2c6cadd4 bellard
874 2c6cadd4 bellard
What you should @emph{never} do:
875 2c6cadd4 bellard
@itemize
876 2c6cadd4 bellard
@item use non-ASCII filenames ;
877 2c6cadd4 bellard
@item use "-snapshot" together with ":rw:" ;
878 85b2c688 bellard
@item expect it to work when loadvm'ing ;
879 85b2c688 bellard
@item write to the FAT directory on the host system while accessing it with the guest system.
880 2c6cadd4 bellard
@end itemize
881 2c6cadd4 bellard
882 debc7065 bellard
@node pcsys_network
883 9d4fb82e bellard
@section Network emulation
884 9d4fb82e bellard
885 41d03949 bellard
QEMU can simulate several networks cards (NE2000 boards on the PC
886 41d03949 bellard
target) and can connect them to an arbitrary number of Virtual Local
887 41d03949 bellard
Area Networks (VLANs). Host TAP devices can be connected to any QEMU
888 41d03949 bellard
VLAN. VLAN can be connected between separate instances of QEMU to
889 41d03949 bellard
simulate large networks. For simpler usage, a non priviledged user mode
890 41d03949 bellard
network stack can replace the TAP device to have a basic network
891 41d03949 bellard
connection.
892 41d03949 bellard
893 41d03949 bellard
@subsection VLANs
894 9d4fb82e bellard
895 41d03949 bellard
QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
896 41d03949 bellard
connection between several network devices. These devices can be for
897 41d03949 bellard
example QEMU virtual Ethernet cards or virtual Host ethernet devices
898 41d03949 bellard
(TAP devices).
899 9d4fb82e bellard
900 41d03949 bellard
@subsection Using TAP network interfaces
901 41d03949 bellard
902 41d03949 bellard
This is the standard way to connect QEMU to a real network. QEMU adds
903 41d03949 bellard
a virtual network device on your host (called @code{tapN}), and you
904 41d03949 bellard
can then configure it as if it was a real ethernet card.
905 9d4fb82e bellard
906 9d4fb82e bellard
As an example, you can download the @file{linux-test-xxx.tar.gz}
907 9d4fb82e bellard
archive and copy the script @file{qemu-ifup} in @file{/etc} and
908 9d4fb82e bellard
configure properly @code{sudo} so that the command @code{ifconfig}
909 9d4fb82e bellard
contained in @file{qemu-ifup} can be executed as root. You must verify
910 41d03949 bellard
that your host kernel supports the TAP network interfaces: the
911 9d4fb82e bellard
device @file{/dev/net/tun} must be present.
912 9d4fb82e bellard
913 9d4fb82e bellard
See @ref{direct_linux_boot} to have an example of network use with a
914 41d03949 bellard
Linux distribution and @ref{sec_invocation} to have examples of
915 41d03949 bellard
command lines using the TAP network interfaces.
916 9d4fb82e bellard
917 9d4fb82e bellard
@subsection Using the user mode network stack
918 9d4fb82e bellard
919 41d03949 bellard
By using the option @option{-net user} (default configuration if no
920 41d03949 bellard
@option{-net} option is specified), QEMU uses a completely user mode
921 41d03949 bellard
network stack (you don't need root priviledge to use the virtual
922 41d03949 bellard
network). The virtual network configuration is the following:
923 9d4fb82e bellard
924 9d4fb82e bellard
@example
925 9d4fb82e bellard
926 41d03949 bellard
         QEMU VLAN      <------>  Firewall/DHCP server <-----> Internet
927 41d03949 bellard
                           |          (10.0.2.2)
928 9d4fb82e bellard
                           |
929 2518bd0d bellard
                           ---->  DNS server (10.0.2.3)
930 2518bd0d bellard
                           |     
931 2518bd0d bellard
                           ---->  SMB server (10.0.2.4)
932 9d4fb82e bellard
@end example
933 9d4fb82e bellard
934 9d4fb82e bellard
The QEMU VM behaves as if it was behind a firewall which blocks all
935 9d4fb82e bellard
incoming connections. You can use a DHCP client to automatically
936 41d03949 bellard
configure the network in the QEMU VM. The DHCP server assign addresses
937 41d03949 bellard
to the hosts starting from 10.0.2.15.
938 9d4fb82e bellard
939 9d4fb82e bellard
In order to check that the user mode network is working, you can ping
940 9d4fb82e bellard
the address 10.0.2.2 and verify that you got an address in the range
941 9d4fb82e bellard
10.0.2.x from the QEMU virtual DHCP server.
942 9d4fb82e bellard
943 b415a407 bellard
Note that @code{ping} is not supported reliably to the internet as it
944 b415a407 bellard
would require root priviledges. It means you can only ping the local
945 b415a407 bellard
router (10.0.2.2).
946 b415a407 bellard
947 9bf05444 bellard
When using the built-in TFTP server, the router is also the TFTP
948 9bf05444 bellard
server.
949 9bf05444 bellard
950 9bf05444 bellard
When using the @option{-redir} option, TCP or UDP connections can be
951 9bf05444 bellard
redirected from the host to the guest. It allows for example to
952 9bf05444 bellard
redirect X11, telnet or SSH connections.
953 443f1376 bellard
954 41d03949 bellard
@subsection Connecting VLANs between QEMU instances
955 41d03949 bellard
956 41d03949 bellard
Using the @option{-net socket} option, it is possible to make VLANs
957 41d03949 bellard
that span several QEMU instances. See @ref{sec_invocation} to have a
958 41d03949 bellard
basic example.
959 41d03949 bellard
960 9d4fb82e bellard
@node direct_linux_boot
961 9d4fb82e bellard
@section Direct Linux Boot
962 1f673135 bellard
963 1f673135 bellard
This section explains how to launch a Linux kernel inside QEMU without
964 1f673135 bellard
having to make a full bootable image. It is very useful for fast Linux
965 1f673135 bellard
kernel testing. The QEMU network configuration is also explained.
966 1f673135 bellard
967 1f673135 bellard
@enumerate
968 1f673135 bellard
@item
969 1f673135 bellard
Download the archive @file{linux-test-xxx.tar.gz} containing a Linux
970 1f673135 bellard
kernel and a disk image. 
971 1f673135 bellard
972 1f673135 bellard
@item Optional: If you want network support (for example to launch X11 examples), you
973 1f673135 bellard
must copy the script @file{qemu-ifup} in @file{/etc} and configure
974 1f673135 bellard
properly @code{sudo} so that the command @code{ifconfig} contained in
975 1f673135 bellard
@file{qemu-ifup} can be executed as root. You must verify that your host
976 1f673135 bellard
kernel supports the TUN/TAP network interfaces: the device
977 1f673135 bellard
@file{/dev/net/tun} must be present.
978 1f673135 bellard
979 1f673135 bellard
When network is enabled, there is a virtual network connection between
980 1f673135 bellard
the host kernel and the emulated kernel. The emulated kernel is seen
981 1f673135 bellard
from the host kernel at IP address 172.20.0.2 and the host kernel is
982 1f673135 bellard
seen from the emulated kernel at IP address 172.20.0.1.
983 1f673135 bellard
984 1f673135 bellard
@item Launch @code{qemu.sh}. You should have the following output:
985 1f673135 bellard
986 debc7065 bellard
@smallexample
987 1f673135 bellard
> ./qemu.sh 
988 1f673135 bellard
Connected to host network interface: tun0
989 debc7065 bellard
Linux version 2.4.21 (bellard@@voyager.localdomain) (gcc version 3.2.2 20030222 @/(Red Hat @/Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003
990 1f673135 bellard
BIOS-provided physical RAM map:
991 1f673135 bellard
 BIOS-e801: 0000000000000000 - 000000000009f000 (usable)
992 1f673135 bellard
 BIOS-e801: 0000000000100000 - 0000000002000000 (usable)
993 1f673135 bellard
32MB LOWMEM available.
994 1f673135 bellard
On node 0 totalpages: 8192
995 1f673135 bellard
zone(0): 4096 pages.
996 1f673135 bellard
zone(1): 4096 pages.
997 1f673135 bellard
zone(2): 0 pages.
998 debc7065 bellard
Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe @/ide5=noprobe console=ttyS0
999 1f673135 bellard
ide_setup: ide2=noprobe
1000 1f673135 bellard
ide_setup: ide3=noprobe
1001 1f673135 bellard
ide_setup: ide4=noprobe
1002 1f673135 bellard
ide_setup: ide5=noprobe
1003 1f673135 bellard
Initializing CPU#0
1004 1f673135 bellard
Detected 2399.621 MHz processor.
1005 1f673135 bellard
Console: colour EGA 80x25
1006 1f673135 bellard
Calibrating delay loop... 4744.80 BogoMIPS
1007 debc7065 bellard
Memory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, @/0k highmem)
1008 1f673135 bellard
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
1009 1f673135 bellard
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
1010 1f673135 bellard
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
1011 1f673135 bellard
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
1012 1f673135 bellard
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
1013 1f673135 bellard
CPU: Intel Pentium Pro stepping 03
1014 1f673135 bellard
Checking 'hlt' instruction... OK.
1015 1f673135 bellard
POSIX conformance testing by UNIFIX
1016 1f673135 bellard
Linux NET4.0 for Linux 2.4
1017 1f673135 bellard
Based upon Swansea University Computer Society NET3.039
1018 1f673135 bellard
Initializing RT netlink socket
1019 1f673135 bellard
apm: BIOS not found.
1020 1f673135 bellard
Starting kswapd
1021 1f673135 bellard
Journalled Block Device driver loaded
1022 1f673135 bellard
Detected PS/2 Mouse Port.
1023 1f673135 bellard
pty: 256 Unix98 ptys configured
1024 1f673135 bellard
Serial driver version 5.05c (2001-07-08) with no serial options enabled
1025 1f673135 bellard
ttyS00 at 0x03f8 (irq = 4) is a 16450
1026 fa7cf687 bellard
ne.c:v1.10 9/23/94 Donald Becker (becker@@scyld.com)
1027 1f673135 bellard
Last modified Nov 1, 2000 by Paul Gortmaker
1028 1f673135 bellard
NE*000 ethercard probe at 0x300: 52 54 00 12 34 56
1029 1f673135 bellard
eth0: NE2000 found at 0x300, using IRQ 9.
1030 1f673135 bellard
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
1031 1f673135 bellard
Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
1032 1f673135 bellard
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
1033 1f673135 bellard
hda: QEMU HARDDISK, ATA DISK drive
1034 1f673135 bellard
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
1035 1f673135 bellard
hda: attached ide-disk driver.
1036 1f673135 bellard
hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63
1037 1f673135 bellard
Partition check:
1038 1f673135 bellard
 hda:
1039 1f673135 bellard
Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
1040 1f673135 bellard
NET4: Linux TCP/IP 1.0 for NET4.0
1041 1f673135 bellard
IP Protocols: ICMP, UDP, TCP, IGMP
1042 1f673135 bellard
IP: routing cache hash table of 512 buckets, 4Kbytes
1043 1f673135 bellard
TCP: Hash tables configured (established 2048 bind 4096)
1044 1f673135 bellard
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
1045 1f673135 bellard
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
1046 1f673135 bellard
VFS: Mounted root (ext2 filesystem).
1047 1f673135 bellard
Freeing unused kernel memory: 64k freed
1048 1f673135 bellard
 
1049 debc7065 bellard
Linux version 2.4.21 (bellard@@voyager.localdomain) (gcc version 3.2.2 20030222 @/(Red Hat @/Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003
1050 1f673135 bellard
 
1051 1f673135 bellard
QEMU Linux test distribution (based on Redhat 9)
1052 1f673135 bellard
 
1053 1f673135 bellard
Type 'exit' to halt the system
1054 1f673135 bellard
 
1055 1f673135 bellard
sh-2.05b# 
1056 debc7065 bellard
@end smallexample
1057 1f673135 bellard
1058 1f673135 bellard
@item
1059 1f673135 bellard
Then you can play with the kernel inside the virtual serial console. You
1060 1f673135 bellard
can launch @code{ls} for example. Type @key{Ctrl-a h} to have an help
1061 1f673135 bellard
about the keys you can type inside the virtual serial console. In
1062 1f673135 bellard
particular, use @key{Ctrl-a x} to exit QEMU and use @key{Ctrl-a b} as
1063 1f673135 bellard
the Magic SysRq key.
1064 1f673135 bellard
1065 1f673135 bellard
@item 
1066 1f673135 bellard
If the network is enabled, launch the script @file{/etc/linuxrc} in the
1067 1f673135 bellard
emulator (don't forget the leading dot):
1068 1f673135 bellard
@example
1069 1f673135 bellard
. /etc/linuxrc
1070 1f673135 bellard
@end example
1071 1f673135 bellard
1072 1f673135 bellard
Then enable X11 connections on your PC from the emulated Linux: 
1073 1f673135 bellard
@example
1074 1f673135 bellard
xhost +172.20.0.2
1075 1f673135 bellard
@end example
1076 1f673135 bellard
1077 1f673135 bellard
You can now launch @file{xterm} or @file{xlogo} and verify that you have
1078 1f673135 bellard
a real Virtual Linux system !
1079 1f673135 bellard
1080 1f673135 bellard
@end enumerate
1081 1f673135 bellard
1082 1f673135 bellard
NOTES:
1083 1f673135 bellard
@enumerate
1084 1f673135 bellard
@item 
1085 1f673135 bellard
A 2.5.74 kernel is also included in the archive. Just
1086 1f673135 bellard
replace the bzImage in qemu.sh to try it.
1087 1f673135 bellard
1088 1f673135 bellard
@item 
1089 1f673135 bellard
In order to exit cleanly from qemu, you can do a @emph{shutdown} inside
1090 1f673135 bellard
qemu. qemu will automatically exit when the Linux shutdown is done.
1091 1f673135 bellard
1092 1f673135 bellard
@item 
1093 1f673135 bellard
You can boot slightly faster by disabling the probe of non present IDE
1094 1f673135 bellard
interfaces. To do so, add the following options on the kernel command
1095 1f673135 bellard
line:
1096 1f673135 bellard
@example
1097 1f673135 bellard
ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe
1098 1f673135 bellard
@end example
1099 1f673135 bellard
1100 1f673135 bellard
@item 
1101 1f673135 bellard
The example disk image is a modified version of the one made by Kevin
1102 1f673135 bellard
Lawton for the plex86 Project (@url{www.plex86.org}).
1103 1f673135 bellard
1104 1f673135 bellard
@end enumerate
1105 1f673135 bellard
1106 debc7065 bellard
@node pcsys_usb
1107 b389dbfb bellard
@section USB emulation
1108 b389dbfb bellard
1109 0aff66b5 pbrook
QEMU emulates a PCI UHCI USB controller. You can virtually plug
1110 0aff66b5 pbrook
virtual USB devices or real host USB devices (experimental, works only
1111 0aff66b5 pbrook
on Linux hosts).  Qemu will automatically create and connect virtual USB hubs
1112 0aff66b5 pbrook
as neccessary to connect multiple USB devices.
1113 b389dbfb bellard
1114 0aff66b5 pbrook
@menu
1115 0aff66b5 pbrook
* usb_devices::
1116 0aff66b5 pbrook
* host_usb_devices::
1117 0aff66b5 pbrook
@end menu
1118 0aff66b5 pbrook
@node usb_devices
1119 0aff66b5 pbrook
@subsection Connecting USB devices
1120 b389dbfb bellard
1121 0aff66b5 pbrook
USB devices can be connected with the @option{-usbdevice} commandline option
1122 0aff66b5 pbrook
or the @code{usb_add} monitor command.  Available devices are:
1123 b389dbfb bellard
1124 0aff66b5 pbrook
@table @var
1125 0aff66b5 pbrook
@item @code{mouse}
1126 0aff66b5 pbrook
Virtual Mouse.  This will override the PS/2 mouse emulation when activated.
1127 0aff66b5 pbrook
@item @code{tablet}
1128 0aff66b5 pbrook
Pointer device that uses abolsute coordinates (like a touchscreen).
1129 0aff66b5 pbrook
This means qemu is able to report the mouse position without having
1130 0aff66b5 pbrook
to grab the mouse.  Also overrides the PS/2 mouse emulation when activated.
1131 0aff66b5 pbrook
@item @code{disk:file}
1132 0aff66b5 pbrook
Mass storage device based on @var{file} (@pxref{disk_images})
1133 0aff66b5 pbrook
@item @code{host:bus.addr}
1134 0aff66b5 pbrook
Pass through the host device identified by @var{bus.addr}
1135 0aff66b5 pbrook
(Linux only)
1136 0aff66b5 pbrook
@item @code{host:vendor_id:product_id}
1137 0aff66b5 pbrook
Pass through the host device identified by @var{vendor_id:product_id}
1138 0aff66b5 pbrook
(Linux only)
1139 0aff66b5 pbrook
@end table
1140 b389dbfb bellard
1141 0aff66b5 pbrook
@node host_usb_devices
1142 b389dbfb bellard
@subsection Using host USB devices on a Linux host
1143 b389dbfb bellard
1144 b389dbfb bellard
WARNING: this is an experimental feature. QEMU will slow down when
1145 b389dbfb bellard
using it. USB devices requiring real time streaming (i.e. USB Video
1146 b389dbfb bellard
Cameras) are not supported yet.
1147 b389dbfb bellard
1148 b389dbfb bellard
@enumerate
1149 b389dbfb bellard
@item If you use an early Linux 2.4 kernel, verify that no Linux driver 
1150 b389dbfb bellard
is actually using the USB device. A simple way to do that is simply to
1151 b389dbfb bellard
disable the corresponding kernel module by renaming it from @file{mydriver.o}
1152 b389dbfb bellard
to @file{mydriver.o.disabled}.
1153 b389dbfb bellard
1154 b389dbfb bellard
@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
1155 b389dbfb bellard
@example
1156 b389dbfb bellard
ls /proc/bus/usb
1157 b389dbfb bellard
001  devices  drivers
1158 b389dbfb bellard
@end example
1159 b389dbfb bellard
1160 b389dbfb bellard
@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:
1161 b389dbfb bellard
@example
1162 b389dbfb bellard
chown -R myuid /proc/bus/usb
1163 b389dbfb bellard
@end example
1164 b389dbfb bellard
1165 b389dbfb bellard
@item Launch QEMU and do in the monitor:
1166 b389dbfb bellard
@example 
1167 b389dbfb bellard
info usbhost
1168 b389dbfb bellard
  Device 1.2, speed 480 Mb/s
1169 b389dbfb bellard
    Class 00: USB device 1234:5678, USB DISK
1170 b389dbfb bellard
@end example
1171 b389dbfb bellard
You should see the list of the devices you can use (Never try to use
1172 b389dbfb bellard
hubs, it won't work).
1173 b389dbfb bellard
1174 b389dbfb bellard
@item Add the device in QEMU by using:
1175 b389dbfb bellard
@example 
1176 b389dbfb bellard
usb_add host:1234:5678
1177 b389dbfb bellard
@end example
1178 b389dbfb bellard
1179 b389dbfb bellard
Normally the guest OS should report that a new USB device is
1180 b389dbfb bellard
plugged. You can use the option @option{-usbdevice} to do the same.
1181 b389dbfb bellard
1182 b389dbfb bellard
@item Now you can try to use the host USB device in QEMU.
1183 b389dbfb bellard
1184 b389dbfb bellard
@end enumerate
1185 b389dbfb bellard
1186 b389dbfb bellard
When relaunching QEMU, you may have to unplug and plug again the USB
1187 b389dbfb bellard
device to make it work again (this is a bug).
1188 b389dbfb bellard
1189 0806e3f6 bellard
@node gdb_usage
1190 da415d54 bellard
@section GDB usage
1191 da415d54 bellard
1192 da415d54 bellard
QEMU has a primitive support to work with gdb, so that you can do
1193 0806e3f6 bellard
'Ctrl-C' while the virtual machine is running and inspect its state.
1194 da415d54 bellard
1195 9d4520d0 bellard
In order to use gdb, launch qemu with the '-s' option. It will wait for a
1196 da415d54 bellard
gdb connection:
1197 da415d54 bellard
@example
1198 debc7065 bellard
> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
1199 debc7065 bellard
       -append "root=/dev/hda"
1200 da415d54 bellard
Connected to host network interface: tun0
1201 da415d54 bellard
Waiting gdb connection on port 1234
1202 da415d54 bellard
@end example
1203 da415d54 bellard
1204 da415d54 bellard
Then launch gdb on the 'vmlinux' executable:
1205 da415d54 bellard
@example
1206 da415d54 bellard
> gdb vmlinux
1207 da415d54 bellard
@end example
1208 da415d54 bellard
1209 da415d54 bellard
In gdb, connect to QEMU:
1210 da415d54 bellard
@example
1211 6c9bf893 bellard
(gdb) target remote localhost:1234
1212 da415d54 bellard
@end example
1213 da415d54 bellard
1214 da415d54 bellard
Then you can use gdb normally. For example, type 'c' to launch the kernel:
1215 da415d54 bellard
@example
1216 da415d54 bellard
(gdb) c
1217 da415d54 bellard
@end example
1218 da415d54 bellard
1219 0806e3f6 bellard
Here are some useful tips in order to use gdb on system code:
1220 0806e3f6 bellard
1221 0806e3f6 bellard
@enumerate
1222 0806e3f6 bellard
@item
1223 0806e3f6 bellard
Use @code{info reg} to display all the CPU registers.
1224 0806e3f6 bellard
@item
1225 0806e3f6 bellard
Use @code{x/10i $eip} to display the code at the PC position.
1226 0806e3f6 bellard
@item
1227 0806e3f6 bellard
Use @code{set architecture i8086} to dump 16 bit code. Then use
1228 294e8637 bellard
@code{x/10i $cs*16+$eip} to dump the code at the PC position.
1229 0806e3f6 bellard
@end enumerate
1230 0806e3f6 bellard
1231 debc7065 bellard
@node pcsys_os_specific
1232 1a084f3d bellard
@section Target OS specific information
1233 1a084f3d bellard
1234 1a084f3d bellard
@subsection Linux
1235 1a084f3d bellard
1236 15a34c63 bellard
To have access to SVGA graphic modes under X11, use the @code{vesa} or
1237 15a34c63 bellard
the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1238 15a34c63 bellard
color depth in the guest and the host OS.
1239 1a084f3d bellard
1240 e3371e62 bellard
When using a 2.6 guest Linux kernel, you should add the option
1241 e3371e62 bellard
@code{clock=pit} on the kernel command line because the 2.6 Linux
1242 e3371e62 bellard
kernels make very strict real time clock checks by default that QEMU
1243 e3371e62 bellard
cannot simulate exactly.
1244 e3371e62 bellard
1245 7c3fc84d bellard
When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1246 7c3fc84d bellard
not activated because QEMU is slower with this patch. The QEMU
1247 7c3fc84d bellard
Accelerator Module is also much slower in this case. Earlier Fedora
1248 7c3fc84d bellard
Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1249 7c3fc84d bellard
patch by default. Newer kernels don't have it.
1250 7c3fc84d bellard
1251 1a084f3d bellard
@subsection Windows
1252 1a084f3d bellard
1253 1a084f3d bellard
If you have a slow host, using Windows 95 is better as it gives the
1254 1a084f3d bellard
best speed. Windows 2000 is also a good choice.
1255 1a084f3d bellard
1256 e3371e62 bellard
@subsubsection SVGA graphic modes support
1257 e3371e62 bellard
1258 e3371e62 bellard
QEMU emulates a Cirrus Logic GD5446 Video
1259 15a34c63 bellard
card. All Windows versions starting from Windows 95 should recognize
1260 15a34c63 bellard
and use this graphic card. For optimal performances, use 16 bit color
1261 15a34c63 bellard
depth in the guest and the host OS.
1262 1a084f3d bellard
1263 e3371e62 bellard
@subsubsection CPU usage reduction
1264 e3371e62 bellard
1265 e3371e62 bellard
Windows 9x does not correctly use the CPU HLT
1266 15a34c63 bellard
instruction. The result is that it takes host CPU cycles even when
1267 15a34c63 bellard
idle. You can install the utility from
1268 15a34c63 bellard
@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1269 15a34c63 bellard
problem. Note that no such tool is needed for NT, 2000 or XP.
1270 1a084f3d bellard
1271 9d0a8e6f bellard
@subsubsection Windows 2000 disk full problem
1272 e3371e62 bellard
1273 9d0a8e6f bellard
Windows 2000 has a bug which gives a disk full problem during its
1274 9d0a8e6f bellard
installation. When installing it, use the @option{-win2k-hack} QEMU
1275 9d0a8e6f bellard
option to enable a specific workaround. After Windows 2000 is
1276 9d0a8e6f bellard
installed, you no longer need this option (this option slows down the
1277 9d0a8e6f bellard
IDE transfers).
1278 e3371e62 bellard
1279 6cc721cf bellard
@subsubsection Windows 2000 shutdown
1280 6cc721cf bellard
1281 6cc721cf bellard
Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1282 6cc721cf bellard
can. It comes from the fact that Windows 2000 does not automatically
1283 6cc721cf bellard
use the APM driver provided by the BIOS.
1284 6cc721cf bellard
1285 6cc721cf bellard
In order to correct that, do the following (thanks to Struan
1286 6cc721cf bellard
Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1287 6cc721cf bellard
Add/Troubleshoot a device => Add a new device & Next => No, select the
1288 6cc721cf bellard
hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1289 6cc721cf bellard
(again) a few times. Now the driver is installed and Windows 2000 now
1290 6cc721cf bellard
correctly instructs QEMU to shutdown at the appropriate moment. 
1291 6cc721cf bellard
1292 6cc721cf bellard
@subsubsection Share a directory between Unix and Windows
1293 6cc721cf bellard
1294 6cc721cf bellard
See @ref{sec_invocation} about the help of the option @option{-smb}.
1295 6cc721cf bellard
1296 e3371e62 bellard
@subsubsection Windows XP security problems
1297 e3371e62 bellard
1298 e3371e62 bellard
Some releases of Windows XP install correctly but give a security
1299 e3371e62 bellard
error when booting:
1300 e3371e62 bellard
@example
1301 e3371e62 bellard
A problem is preventing Windows from accurately checking the
1302 e3371e62 bellard
license for this computer. Error code: 0x800703e6.
1303 e3371e62 bellard
@end example
1304 e3371e62 bellard
The only known workaround is to boot in Safe mode
1305 e3371e62 bellard
without networking support. 
1306 e3371e62 bellard
1307 e3371e62 bellard
Future QEMU releases are likely to correct this bug.
1308 e3371e62 bellard
1309 a0a821a4 bellard
@subsection MS-DOS and FreeDOS
1310 a0a821a4 bellard
1311 a0a821a4 bellard
@subsubsection CPU usage reduction
1312 a0a821a4 bellard
1313 a0a821a4 bellard
DOS does not correctly use the CPU HLT instruction. The result is that
1314 a0a821a4 bellard
it takes host CPU cycles even when idle. You can install the utility
1315 a0a821a4 bellard
from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1316 a0a821a4 bellard
problem.
1317 a0a821a4 bellard
1318 debc7065 bellard
@node QEMU System emulator for non PC targets
1319 3f9f3aa1 bellard
@chapter QEMU System emulator for non PC targets
1320 3f9f3aa1 bellard
1321 3f9f3aa1 bellard
QEMU is a generic emulator and it emulates many non PC
1322 3f9f3aa1 bellard
machines. Most of the options are similar to the PC emulator. The
1323 3f9f3aa1 bellard
differences are mentionned in the following sections.
1324 3f9f3aa1 bellard
1325 debc7065 bellard
@menu
1326 debc7065 bellard
* QEMU PowerPC System emulator::
1327 debc7065 bellard
* Sparc32 System emulator invocation::
1328 debc7065 bellard
* Sparc64 System emulator invocation::
1329 debc7065 bellard
* MIPS System emulator invocation::
1330 debc7065 bellard
* ARM System emulator invocation::
1331 debc7065 bellard
@end menu
1332 debc7065 bellard
1333 debc7065 bellard
@node QEMU PowerPC System emulator
1334 3f9f3aa1 bellard
@section QEMU PowerPC System emulator
1335 1a084f3d bellard
1336 15a34c63 bellard
Use the executable @file{qemu-system-ppc} to simulate a complete PREP
1337 15a34c63 bellard
or PowerMac PowerPC system.
1338 1a084f3d bellard
1339 b671f9ed bellard
QEMU emulates the following PowerMac peripherals:
1340 1a084f3d bellard
1341 15a34c63 bellard
@itemize @minus
1342 15a34c63 bellard
@item 
1343 15a34c63 bellard
UniNorth PCI Bridge 
1344 15a34c63 bellard
@item
1345 15a34c63 bellard
PCI VGA compatible card with VESA Bochs Extensions
1346 15a34c63 bellard
@item 
1347 15a34c63 bellard
2 PMAC IDE interfaces with hard disk and CD-ROM support
1348 15a34c63 bellard
@item 
1349 15a34c63 bellard
NE2000 PCI adapters
1350 15a34c63 bellard
@item
1351 15a34c63 bellard
Non Volatile RAM
1352 15a34c63 bellard
@item
1353 15a34c63 bellard
VIA-CUDA with ADB keyboard and mouse.
1354 1a084f3d bellard
@end itemize
1355 1a084f3d bellard
1356 b671f9ed bellard
QEMU emulates the following PREP peripherals:
1357 52c00a5f bellard
1358 52c00a5f bellard
@itemize @minus
1359 52c00a5f bellard
@item 
1360 15a34c63 bellard
PCI Bridge
1361 15a34c63 bellard
@item
1362 15a34c63 bellard
PCI VGA compatible card with VESA Bochs Extensions
1363 15a34c63 bellard
@item 
1364 52c00a5f bellard
2 IDE interfaces with hard disk and CD-ROM support
1365 52c00a5f bellard
@item
1366 52c00a5f bellard
Floppy disk
1367 52c00a5f bellard
@item 
1368 15a34c63 bellard
NE2000 network adapters
1369 52c00a5f bellard
@item
1370 52c00a5f bellard
Serial port
1371 52c00a5f bellard
@item
1372 52c00a5f bellard
PREP Non Volatile RAM
1373 15a34c63 bellard
@item
1374 15a34c63 bellard
PC compatible keyboard and mouse.
1375 52c00a5f bellard
@end itemize
1376 52c00a5f bellard
1377 15a34c63 bellard
QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
1378 3f9f3aa1 bellard
@url{http://perso.magic.fr/l_indien/OpenHackWare/index.htm}.
1379 52c00a5f bellard
1380 15a34c63 bellard
@c man begin OPTIONS
1381 15a34c63 bellard
1382 15a34c63 bellard
The following options are specific to the PowerPC emulation:
1383 15a34c63 bellard
1384 15a34c63 bellard
@table @option
1385 15a34c63 bellard
1386 15a34c63 bellard
@item -g WxH[xDEPTH]  
1387 15a34c63 bellard
1388 15a34c63 bellard
Set the initial VGA graphic mode. The default is 800x600x15.
1389 15a34c63 bellard
1390 15a34c63 bellard
@end table
1391 15a34c63 bellard
1392 15a34c63 bellard
@c man end 
1393 15a34c63 bellard
1394 15a34c63 bellard
1395 52c00a5f bellard
More information is available at
1396 3f9f3aa1 bellard
@url{http://perso.magic.fr/l_indien/qemu-ppc/}.
1397 52c00a5f bellard
1398 debc7065 bellard
@node Sparc32 System emulator invocation
1399 3f9f3aa1 bellard
@section Sparc32 System emulator invocation
1400 e80cfcfc bellard
1401 0986ac3b bellard
Use the executable @file{qemu-system-sparc} to simulate a SparcStation 5
1402 3475187d bellard
(sun4m architecture). The emulation is somewhat complete.
1403 e80cfcfc bellard
1404 b671f9ed bellard
QEMU emulates the following sun4m peripherals:
1405 e80cfcfc bellard
1406 e80cfcfc bellard
@itemize @minus
1407 3475187d bellard
@item
1408 e80cfcfc bellard
IOMMU
1409 e80cfcfc bellard
@item
1410 e80cfcfc bellard
TCX Frame buffer
1411 e80cfcfc bellard
@item 
1412 e80cfcfc bellard
Lance (Am7990) Ethernet
1413 e80cfcfc bellard
@item
1414 e80cfcfc bellard
Non Volatile RAM M48T08
1415 e80cfcfc bellard
@item
1416 3475187d bellard
Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1417 3475187d bellard
and power/reset logic
1418 3475187d bellard
@item
1419 3475187d bellard
ESP SCSI controller with hard disk and CD-ROM support
1420 3475187d bellard
@item
1421 3475187d bellard
Floppy drive
1422 e80cfcfc bellard
@end itemize
1423 e80cfcfc bellard
1424 3475187d bellard
The number of peripherals is fixed in the architecture.
1425 3475187d bellard
1426 0986ac3b bellard
Since version 0.8.1, QEMU uses OpenBIOS
1427 0986ac3b bellard
@url{http://www.openbios.org/}. OpenBIOS is a free (GPL v2) portable
1428 0986ac3b bellard
firmware implementation. The goal is to implement a 100% IEEE
1429 0986ac3b bellard
1275-1994 (referred to as Open Firmware) compliant firmware.
1430 3475187d bellard
1431 3475187d bellard
A sample Linux 2.6 series kernel and ram disk image are available on
1432 0986ac3b bellard
the QEMU web site. Please note that currently NetBSD, OpenBSD or
1433 0986ac3b bellard
Solaris kernels don't work.
1434 3475187d bellard
1435 3475187d bellard
@c man begin OPTIONS
1436 3475187d bellard
1437 3475187d bellard
The following options are specific to the Sparc emulation:
1438 3475187d bellard
1439 3475187d bellard
@table @option
1440 3475187d bellard
1441 3475187d bellard
@item -g WxH
1442 3475187d bellard
1443 3475187d bellard
Set the initial TCX graphic mode. The default is 1024x768.
1444 3475187d bellard
1445 3475187d bellard
@end table
1446 3475187d bellard
1447 3475187d bellard
@c man end 
1448 3475187d bellard
1449 debc7065 bellard
@node Sparc64 System emulator invocation
1450 3f9f3aa1 bellard
@section Sparc64 System emulator invocation
1451 e80cfcfc bellard
1452 3475187d bellard
Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
1453 3475187d bellard
The emulator is not usable for anything yet.
1454 b756921a bellard
1455 83469015 bellard
QEMU emulates the following sun4u peripherals:
1456 83469015 bellard
1457 83469015 bellard
@itemize @minus
1458 83469015 bellard
@item
1459 83469015 bellard
UltraSparc IIi APB PCI Bridge 
1460 83469015 bellard
@item
1461 83469015 bellard
PCI VGA compatible card with VESA Bochs Extensions
1462 83469015 bellard
@item
1463 83469015 bellard
Non Volatile RAM M48T59
1464 83469015 bellard
@item
1465 83469015 bellard
PC-compatible serial ports
1466 83469015 bellard
@end itemize
1467 83469015 bellard
1468 debc7065 bellard
@node MIPS System emulator invocation
1469 3f9f3aa1 bellard
@section MIPS System emulator invocation
1470 9d0a8e6f bellard
1471 9d0a8e6f bellard
Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
1472 3f9f3aa1 bellard
The emulator is able to boot a Linux kernel and to run a Linux Debian
1473 3f9f3aa1 bellard
installation from NFS. The following devices are emulated:
1474 3f9f3aa1 bellard
1475 3f9f3aa1 bellard
@itemize @minus
1476 3f9f3aa1 bellard
@item 
1477 3f9f3aa1 bellard
MIPS R4K CPU
1478 3f9f3aa1 bellard
@item
1479 3f9f3aa1 bellard
PC style serial port
1480 3f9f3aa1 bellard
@item
1481 3f9f3aa1 bellard
NE2000 network card
1482 3f9f3aa1 bellard
@end itemize
1483 3f9f3aa1 bellard
1484 3f9f3aa1 bellard
More information is available in the QEMU mailing-list archive.
1485 3f9f3aa1 bellard
1486 debc7065 bellard
@node ARM System emulator invocation
1487 3f9f3aa1 bellard
@section ARM System emulator invocation
1488 3f9f3aa1 bellard
1489 3f9f3aa1 bellard
Use the executable @file{qemu-system-arm} to simulate a ARM
1490 3f9f3aa1 bellard
machine. The ARM Integrator/CP board is emulated with the following
1491 3f9f3aa1 bellard
devices:
1492 3f9f3aa1 bellard
1493 3f9f3aa1 bellard
@itemize @minus
1494 3f9f3aa1 bellard
@item
1495 ed96ca35 pbrook
ARM926E or ARM1026E CPU
1496 3f9f3aa1 bellard
@item
1497 3f9f3aa1 bellard
Two PL011 UARTs
1498 3f9f3aa1 bellard
@item 
1499 3f9f3aa1 bellard
SMC 91c111 Ethernet adapter
1500 00a9bf19 pbrook
@item
1501 00a9bf19 pbrook
PL110 LCD controller
1502 00a9bf19 pbrook
@item
1503 00a9bf19 pbrook
PL050 KMI with PS/2 keyboard and mouse.
1504 00a9bf19 pbrook
@end itemize
1505 00a9bf19 pbrook
1506 00a9bf19 pbrook
The ARM Versatile baseboard is emulated with the following devices:
1507 00a9bf19 pbrook
1508 00a9bf19 pbrook
@itemize @minus
1509 00a9bf19 pbrook
@item
1510 00a9bf19 pbrook
ARM926E CPU
1511 00a9bf19 pbrook
@item
1512 00a9bf19 pbrook
PL190 Vectored Interrupt Controller
1513 00a9bf19 pbrook
@item
1514 00a9bf19 pbrook
Four PL011 UARTs
1515 00a9bf19 pbrook
@item 
1516 00a9bf19 pbrook
SMC 91c111 Ethernet adapter
1517 00a9bf19 pbrook
@item
1518 00a9bf19 pbrook
PL110 LCD controller
1519 00a9bf19 pbrook
@item
1520 00a9bf19 pbrook
PL050 KMI with PS/2 keyboard and mouse.
1521 00a9bf19 pbrook
@item
1522 00a9bf19 pbrook
PCI host bridge.  Note the emulated PCI bridge only provides access to
1523 00a9bf19 pbrook
PCI memory space.  It does not provide access to PCI IO space.
1524 00a9bf19 pbrook
This means some devices (eg. ne2k_pci NIC) are not useable, and others
1525 00a9bf19 pbrook
(eg. rtl8139 NIC) are only useable when the guest drivers use the memory
1526 00a9bf19 pbrook
mapped control registers.
1527 3f9f3aa1 bellard
@end itemize
1528 3f9f3aa1 bellard
1529 3f9f3aa1 bellard
A Linux 2.6 test image is available on the QEMU web site. More
1530 3f9f3aa1 bellard
information is available in the QEMU mailing-list archive.
1531 9d0a8e6f bellard
1532 debc7065 bellard
@node QEMU Linux User space emulator 
1533 3f9f3aa1 bellard
@chapter QEMU Linux User space emulator 
1534 386405f7 bellard
1535 debc7065 bellard
@menu
1536 debc7065 bellard
* Quick Start::
1537 debc7065 bellard
* Wine launch::
1538 debc7065 bellard
* Command line options::
1539 79737e4a pbrook
* Other binaries::
1540 debc7065 bellard
@end menu
1541 debc7065 bellard
1542 debc7065 bellard
@node Quick Start
1543 1f673135 bellard
@section Quick Start
1544 df0f11a0 bellard
1545 1f673135 bellard
In order to launch a Linux process, QEMU needs the process executable
1546 1f673135 bellard
itself and all the target (x86) dynamic libraries used by it. 
1547 386405f7 bellard
1548 1f673135 bellard
@itemize
1549 386405f7 bellard
1550 1f673135 bellard
@item On x86, you can just try to launch any process by using the native
1551 1f673135 bellard
libraries:
1552 386405f7 bellard
1553 1f673135 bellard
@example 
1554 1f673135 bellard
qemu-i386 -L / /bin/ls
1555 1f673135 bellard
@end example
1556 386405f7 bellard
1557 1f673135 bellard
@code{-L /} tells that the x86 dynamic linker must be searched with a
1558 1f673135 bellard
@file{/} prefix.
1559 386405f7 bellard
1560 1f673135 bellard
@item Since QEMU is also a linux process, you can launch qemu with qemu (NOTE: you can only do that if you compiled QEMU from the sources):
1561 386405f7 bellard
1562 1f673135 bellard
@example 
1563 1f673135 bellard
qemu-i386 -L / qemu-i386 -L / /bin/ls
1564 1f673135 bellard
@end example
1565 386405f7 bellard
1566 1f673135 bellard
@item On non x86 CPUs, you need first to download at least an x86 glibc
1567 1f673135 bellard
(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1568 1f673135 bellard
@code{LD_LIBRARY_PATH} is not set:
1569 df0f11a0 bellard
1570 1f673135 bellard
@example
1571 1f673135 bellard
unset LD_LIBRARY_PATH 
1572 1f673135 bellard
@end example
1573 1eb87257 bellard
1574 1f673135 bellard
Then you can launch the precompiled @file{ls} x86 executable:
1575 1eb87257 bellard
1576 1f673135 bellard
@example
1577 1f673135 bellard
qemu-i386 tests/i386/ls
1578 1f673135 bellard
@end example
1579 1f673135 bellard
You can look at @file{qemu-binfmt-conf.sh} so that
1580 1f673135 bellard
QEMU is automatically launched by the Linux kernel when you try to
1581 1f673135 bellard
launch x86 executables. It requires the @code{binfmt_misc} module in the
1582 1f673135 bellard
Linux kernel.
1583 1eb87257 bellard
1584 1f673135 bellard
@item The x86 version of QEMU is also included. You can try weird things such as:
1585 1f673135 bellard
@example
1586 debc7065 bellard
qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 \
1587 debc7065 bellard
          /usr/local/qemu-i386/bin/ls-i386
1588 1f673135 bellard
@end example
1589 1eb20527 bellard
1590 1f673135 bellard
@end itemize
1591 1eb20527 bellard
1592 debc7065 bellard
@node Wine launch
1593 1f673135 bellard
@section Wine launch
1594 1eb20527 bellard
1595 1f673135 bellard
@itemize
1596 386405f7 bellard
1597 1f673135 bellard
@item Ensure that you have a working QEMU with the x86 glibc
1598 1f673135 bellard
distribution (see previous section). In order to verify it, you must be
1599 1f673135 bellard
able to do:
1600 386405f7 bellard
1601 1f673135 bellard
@example
1602 1f673135 bellard
qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1603 1f673135 bellard
@end example
1604 386405f7 bellard
1605 1f673135 bellard
@item Download the binary x86 Wine install
1606 1f673135 bellard
(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page). 
1607 386405f7 bellard
1608 1f673135 bellard
@item Configure Wine on your account. Look at the provided script
1609 debc7065 bellard
@file{/usr/local/qemu-i386/@/bin/wine-conf.sh}. Your previous
1610 1f673135 bellard
@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
1611 386405f7 bellard
1612 1f673135 bellard
@item Then you can try the example @file{putty.exe}:
1613 386405f7 bellard
1614 1f673135 bellard
@example
1615 debc7065 bellard
qemu-i386 /usr/local/qemu-i386/wine/bin/wine \
1616 debc7065 bellard
          /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1617 1f673135 bellard
@end example
1618 386405f7 bellard
1619 1f673135 bellard
@end itemize
1620 fd429f2f bellard
1621 debc7065 bellard
@node Command line options
1622 1f673135 bellard
@section Command line options
1623 1eb20527 bellard
1624 1f673135 bellard
@example
1625 1f673135 bellard
usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1626 1f673135 bellard
@end example
1627 1eb20527 bellard
1628 1f673135 bellard
@table @option
1629 1f673135 bellard
@item -h
1630 1f673135 bellard
Print the help
1631 1f673135 bellard
@item -L path   
1632 1f673135 bellard
Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1633 1f673135 bellard
@item -s size
1634 1f673135 bellard
Set the x86 stack size in bytes (default=524288)
1635 386405f7 bellard
@end table
1636 386405f7 bellard
1637 1f673135 bellard
Debug options:
1638 386405f7 bellard
1639 1f673135 bellard
@table @option
1640 1f673135 bellard
@item -d
1641 1f673135 bellard
Activate log (logfile=/tmp/qemu.log)
1642 1f673135 bellard
@item -p pagesize
1643 1f673135 bellard
Act as if the host page size was 'pagesize' bytes
1644 1f673135 bellard
@end table
1645 386405f7 bellard
1646 79737e4a pbrook
@node Other binaries
1647 79737e4a pbrook
@section Other binaries
1648 79737e4a pbrook
1649 79737e4a pbrook
@command{qemu-arm} is also capable of running ARM "Angel" semihosted ELF
1650 79737e4a pbrook
binaries (as implemented by the arm-elf and arm-eabi Newlib/GDB
1651 79737e4a pbrook
configurations), and arm-uclinux bFLT format binaries.
1652 79737e4a pbrook
1653 79737e4a pbrook
The binary format is detected automatically.
1654 79737e4a pbrook
1655 15a34c63 bellard
@node compilation
1656 15a34c63 bellard
@chapter Compilation from the sources
1657 15a34c63 bellard
1658 debc7065 bellard
@menu
1659 debc7065 bellard
* Linux/Unix::
1660 debc7065 bellard
* Windows::
1661 debc7065 bellard
* Cross compilation for Windows with Linux::
1662 debc7065 bellard
* Mac OS X::
1663 debc7065 bellard
@end menu
1664 debc7065 bellard
1665 debc7065 bellard
@node Linux/Unix
1666 7c3fc84d bellard
@section Linux/Unix
1667 7c3fc84d bellard
1668 7c3fc84d bellard
@subsection Compilation
1669 7c3fc84d bellard
1670 7c3fc84d bellard
First you must decompress the sources:
1671 7c3fc84d bellard
@example
1672 7c3fc84d bellard
cd /tmp
1673 7c3fc84d bellard
tar zxvf qemu-x.y.z.tar.gz
1674 7c3fc84d bellard
cd qemu-x.y.z
1675 7c3fc84d bellard
@end example
1676 7c3fc84d bellard
1677 7c3fc84d bellard
Then you configure QEMU and build it (usually no options are needed):
1678 7c3fc84d bellard
@example
1679 7c3fc84d bellard
./configure
1680 7c3fc84d bellard
make
1681 7c3fc84d bellard
@end example
1682 7c3fc84d bellard
1683 7c3fc84d bellard
Then type as root user:
1684 7c3fc84d bellard
@example
1685 7c3fc84d bellard
make install
1686 7c3fc84d bellard
@end example
1687 7c3fc84d bellard
to install QEMU in @file{/usr/local}.
1688 7c3fc84d bellard
1689 7c3fc84d bellard
@subsection Tested tool versions
1690 7c3fc84d bellard
1691 7c3fc84d bellard
In order to compile QEMU succesfully, it is very important that you
1692 7c3fc84d bellard
have the right tools. The most important one is gcc. I cannot guaranty
1693 7c3fc84d bellard
that QEMU works if you do not use a tested gcc version. Look at
1694 7c3fc84d bellard
'configure' and 'Makefile' if you want to make a different gcc
1695 7c3fc84d bellard
version work.
1696 7c3fc84d bellard
1697 7c3fc84d bellard
@example
1698 7c3fc84d bellard
host      gcc      binutils      glibc    linux       distribution
1699 7c3fc84d bellard
----------------------------------------------------------------------
1700 7c3fc84d bellard
x86       3.2      2.13.2        2.1.3    2.4.18
1701 7c3fc84d bellard
          2.96     2.11.93.0.2   2.2.5    2.4.18      Red Hat 7.3
1702 7c3fc84d bellard
          3.2.2    2.13.90.0.18  2.3.2    2.4.20      Red Hat 9
1703 7c3fc84d bellard
1704 7c3fc84d bellard
PowerPC   3.3 [4]  2.13.90.0.18  2.3.1    2.4.20briq
1705 7c3fc84d bellard
          3.2
1706 7c3fc84d bellard
1707 7c3fc84d bellard
Alpha     3.3 [1]  2.14.90.0.4   2.2.5    2.2.20 [2]  Debian 3.0
1708 7c3fc84d bellard
1709 7c3fc84d bellard
Sparc32   2.95.4   2.12.90.0.1   2.2.5    2.4.18      Debian 3.0
1710 7c3fc84d bellard
1711 7c3fc84d bellard
ARM       2.95.4   2.12.90.0.1   2.2.5    2.4.9 [3]   Debian 3.0
1712 7c3fc84d bellard
1713 7c3fc84d bellard
[1] On Alpha, QEMU needs the gcc 'visibility' attribute only available
1714 7c3fc84d bellard
    for gcc version >= 3.3.
1715 7c3fc84d bellard
[2] Linux >= 2.4.20 is necessary for precise exception support
1716 7c3fc84d bellard
    (untested).
1717 7c3fc84d bellard
[3] 2.4.9-ac10-rmk2-np1-cerf2
1718 7c3fc84d bellard
1719 7c3fc84d bellard
[4] gcc 2.95.x generates invalid code when using too many register
1720 7c3fc84d bellard
variables. You must use gcc 3.x on PowerPC.
1721 7c3fc84d bellard
@end example
1722 15a34c63 bellard
1723 debc7065 bellard
@node Windows
1724 15a34c63 bellard
@section Windows
1725 15a34c63 bellard
1726 15a34c63 bellard
@itemize
1727 15a34c63 bellard
@item Install the current versions of MSYS and MinGW from
1728 15a34c63 bellard
@url{http://www.mingw.org/}. You can find detailed installation
1729 15a34c63 bellard
instructions in the download section and the FAQ.
1730 15a34c63 bellard
1731 15a34c63 bellard
@item Download 
1732 15a34c63 bellard
the MinGW development library of SDL 1.2.x
1733 debc7065 bellard
(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
1734 15a34c63 bellard
@url{http://www.libsdl.org}. Unpack it in a temporary place, and
1735 15a34c63 bellard
unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
1736 15a34c63 bellard
directory. Edit the @file{sdl-config} script so that it gives the
1737 15a34c63 bellard
correct SDL directory when invoked.
1738 15a34c63 bellard
1739 15a34c63 bellard
@item Extract the current version of QEMU.
1740 15a34c63 bellard
 
1741 15a34c63 bellard
@item Start the MSYS shell (file @file{msys.bat}).
1742 15a34c63 bellard
1743 15a34c63 bellard
@item Change to the QEMU directory. Launch @file{./configure} and 
1744 15a34c63 bellard
@file{make}.  If you have problems using SDL, verify that
1745 15a34c63 bellard
@file{sdl-config} can be launched from the MSYS command line.
1746 15a34c63 bellard
1747 15a34c63 bellard
@item You can install QEMU in @file{Program Files/Qemu} by typing 
1748 15a34c63 bellard
@file{make install}. Don't forget to copy @file{SDL.dll} in
1749 15a34c63 bellard
@file{Program Files/Qemu}.
1750 15a34c63 bellard
1751 15a34c63 bellard
@end itemize
1752 15a34c63 bellard
1753 debc7065 bellard
@node Cross compilation for Windows with Linux
1754 15a34c63 bellard
@section Cross compilation for Windows with Linux
1755 15a34c63 bellard
1756 15a34c63 bellard
@itemize
1757 15a34c63 bellard
@item
1758 15a34c63 bellard
Install the MinGW cross compilation tools available at
1759 15a34c63 bellard
@url{http://www.mingw.org/}.
1760 15a34c63 bellard
1761 15a34c63 bellard
@item 
1762 15a34c63 bellard
Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
1763 15a34c63 bellard
unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
1764 15a34c63 bellard
variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
1765 15a34c63 bellard
the QEMU configuration script.
1766 15a34c63 bellard
1767 15a34c63 bellard
@item 
1768 15a34c63 bellard
Configure QEMU for Windows cross compilation:
1769 15a34c63 bellard
@example
1770 15a34c63 bellard
./configure --enable-mingw32
1771 15a34c63 bellard
@end example
1772 15a34c63 bellard
If necessary, you can change the cross-prefix according to the prefix
1773 15a34c63 bellard
choosen for the MinGW tools with --cross-prefix. You can also use
1774 15a34c63 bellard
--prefix to set the Win32 install path.
1775 15a34c63 bellard
1776 15a34c63 bellard
@item You can install QEMU in the installation directory by typing 
1777 15a34c63 bellard
@file{make install}. Don't forget to copy @file{SDL.dll} in the
1778 15a34c63 bellard
installation directory. 
1779 15a34c63 bellard
1780 15a34c63 bellard
@end itemize
1781 15a34c63 bellard
1782 15a34c63 bellard
Note: Currently, Wine does not seem able to launch
1783 15a34c63 bellard
QEMU for Win32.
1784 15a34c63 bellard
1785 debc7065 bellard
@node Mac OS X
1786 15a34c63 bellard
@section Mac OS X
1787 15a34c63 bellard
1788 15a34c63 bellard
The Mac OS X patches are not fully merged in QEMU, so you should look
1789 15a34c63 bellard
at the QEMU mailing list archive to have all the necessary
1790 15a34c63 bellard
information.
1791 15a34c63 bellard
1792 debc7065 bellard
@node Index
1793 debc7065 bellard
@chapter Index
1794 debc7065 bellard
@printindex cp
1795 debc7065 bellard
1796 debc7065 bellard
@bye