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