blob: 6d7e85cd64b533628652123535abbde27ce506df [file] [log] [blame]
bellard386405f2003-03-23 21:28:45 +00001\input texinfo @c -*- texinfo -*-
2
bellard0806e3f2003-10-01 00:15:32 +00003@iftex
bellard1f673132004-04-04 15:21:17 +00004@settitle QEMU CPU Emulator User Documentation
bellard386405f2003-03-23 21:28:45 +00005@titlepage
6@sp 7
bellard1f673132004-04-04 15:21:17 +00007@center @titlefont{QEMU CPU Emulator User Documentation}
bellard386405f2003-03-23 21:28:45 +00008@sp 3
9@end titlepage
bellard0806e3f2003-10-01 00:15:32 +000010@end iftex
bellard386405f2003-03-23 21:28:45 +000011
12@chapter Introduction
13
bellard322d0c62003-06-15 23:29:28 +000014@section Features
bellard386405f2003-03-23 21:28:45 +000015
bellard1f673132004-04-04 15:21:17 +000016QEMU is a FAST! processor emulator using dynamic translation to
17achieve good emulation speed.
bellard1eb20522003-06-25 16:21:49 +000018
19QEMU has two operating modes:
bellard0806e3f2003-10-01 00:15:32 +000020
21@itemize @minus
22
23@item
bellard1f673132004-04-04 15:21:17 +000024Full system emulation. In this mode, QEMU emulates a full system (for
bellardb671f9e2005-04-30 15:08:33 +000025example a PC), including a processor and various peripherals. It can
bellard1f673132004-04-04 15:21:17 +000026be used to launch different Operating Systems without rebooting the
27PC or to debug system code.
bellard1eb20522003-06-25 16:21:49 +000028
bellard0806e3f2003-10-01 00:15:32 +000029@item
bellard1f673132004-04-04 15:21:17 +000030User 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.
bellard1eb20522003-06-25 16:21:49 +000034
35@end itemize
36
bellard7c3fc842005-02-10 21:46:47 +000037QEMU can run without an host kernel driver and yet gives acceptable
bellard6f2f2b22005-02-20 19:09:44 +000038performance.
bellard322d0c62003-06-15 23:29:28 +000039
bellard52c00a52004-04-25 21:27:03 +000040For system emulation, the following hardware targets are supported:
41@itemize
bellard9d0a8e62005-07-03 17:34:05 +000042@item PC (x86 or x86_64 processor)
bellard52c00a52004-04-25 21:27:03 +000043@item PREP (PowerPC processor)
bellard9d0a8e62005-07-03 17:34:05 +000044@item G3 BW PowerMac (PowerPC processor)
45@item Mac99 PowerMac (PowerPC processor, in progress)
bellard34751872005-07-02 14:31:34 +000046@item Sun4m (32-bit Sparc processor)
47@item Sun4u (64-bit Sparc processor, in progress)
bellard9d0a8e62005-07-03 17:34:05 +000048@item Malta board (32-bit MIPS processor, in progress)
bellard52c00a52004-04-25 21:27:03 +000049@end itemize
bellard386405f2003-03-23 21:28:45 +000050
bellard34751872005-07-02 14:31:34 +000051For user emulation, x86, PowerPC, ARM, and Sparc32/64 CPUs are supported.
bellard0806e3f2003-10-01 00:15:32 +000052
bellard5b9f4572003-10-28 00:49:54 +000053@chapter Installation
54
bellard15a34c62004-07-08 21:26:26 +000055If you want to compile QEMU yourself, see @ref{compilation}.
56
bellard1f673132004-04-04 15:21:17 +000057@section Linux
58
bellard7c3fc842005-02-10 21:46:47 +000059If a precompiled package is available for your distribution - you just
60have to install it. Otherwise, see @ref{compilation}.
bellard5b9f4572003-10-28 00:49:54 +000061
bellard1f673132004-04-04 15:21:17 +000062@section Windows
bellard8cd0ac22004-05-12 19:09:16 +000063
bellard15a34c62004-07-08 21:26:26 +000064Download the experimental binary installer at
65@url{http://www.freeoszoo.org/download.php}.
bellardd691f662003-03-24 21:58:34 +000066
bellard1f673132004-04-04 15:21:17 +000067@section Mac OS X
bellardd691f662003-03-24 21:58:34 +000068
bellard15a34c62004-07-08 21:26:26 +000069Download the experimental binary installer at
70@url{http://www.freeoszoo.org/download.php}.
bellarddf0f11a2003-05-28 00:27:57 +000071
bellard52c00a52004-04-25 21:27:03 +000072@chapter QEMU PC System emulator invocation
bellard1eb20522003-06-25 16:21:49 +000073
bellard0806e3f2003-10-01 00:15:32 +000074@section Introduction
75
76@c man begin DESCRIPTION
77
bellard7c3fc842005-02-10 21:46:47 +000078The QEMU System emulator simulates the
bellardb671f9e2005-04-30 15:08:33 +000079following PC peripherals:
bellard0806e3f2003-10-01 00:15:32 +000080
81@itemize @minus
bellard15a34c62004-07-08 21:26:26 +000082@item
83i440FX host PCI bridge and PIIX3 PCI to ISA bridge
bellard0806e3f2003-10-01 00:15:32 +000084@item
bellard15a34c62004-07-08 21:26:26 +000085Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
86extensions (hardware level, including all non standard modes).
bellard0806e3f2003-10-01 00:15:32 +000087@item
88PS/2 mouse and keyboard
89@item
bellard15a34c62004-07-08 21:26:26 +0000902 PCI IDE interfaces with hard disk and CD-ROM support
bellard1f673132004-04-04 15:21:17 +000091@item
92Floppy disk
bellard0806e3f2003-10-01 00:15:32 +000093@item
bellard15a34c62004-07-08 21:26:26 +000094NE2000 PCI network adapters
bellard0806e3f2003-10-01 00:15:32 +000095@item
bellard05d58182004-08-24 21:12:04 +000096Serial ports
97@item
bellardc0fe3822005-11-05 18:55:28 +000098Creative SoundBlaster 16 sound card
99@item
100ENSONIQ AudioPCI ES1370 sound card
101@item
102Adlib(OPL2) - Yamaha YM3812 compatible chip
bellardb389dbf2005-11-06 16:49:55 +0000103@item
104PCI UHCI USB controller and a virtual USB hub.
bellard0806e3f2003-10-01 00:15:32 +0000105@end itemize
106
bellardc0fe3822005-11-05 18:55:28 +0000107Note that adlib is only available when QEMU was configured with
108-enable-adlib
109
bellard15a34c62004-07-08 21:26:26 +0000110QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
111VGA BIOS.
112
bellardc0fe3822005-11-05 18:55:28 +0000113QEMU uses YM3812 emulation by Tatsuyuki Satoh.
114
bellard0806e3f2003-10-01 00:15:32 +0000115@c man end
116
bellard1eb20522003-06-25 16:21:49 +0000117@section Quick Start
118
bellard285dc332003-10-27 23:58:04 +0000119Download and uncompress the linux image (@file{linux.img}) and type:
bellard0806e3f2003-10-01 00:15:32 +0000120
121@example
bellard285dc332003-10-27 23:58:04 +0000122qemu linux.img
bellard0806e3f2003-10-01 00:15:32 +0000123@end example
124
125Linux should boot and give you a prompt.
126
bellard6cc721c2005-07-28 22:27:28 +0000127@node sec_invocation
bellard1f673132004-04-04 15:21:17 +0000128@section Invocation
129
130@example
131@c man begin SYNOPSIS
132usage: qemu [options] [disk_image]
133@c man end
134@end example
135
136@c man begin OPTIONS
137@var{disk_image} is a raw hard disk image for IDE hard disk 0.
138
139General options:
140@table @option
141@item -fda file
142@item -fdb file
bellardbe3edd92004-06-03 12:48:45 +0000143Use @var{file} as floppy disk 0/1 image (@xref{disk_images}). You can
144use the host floppy by using @file{/dev/fd0} as filename.
bellard1f673132004-04-04 15:21:17 +0000145
146@item -hda file
147@item -hdb file
148@item -hdc file
149@item -hdd file
150Use @var{file} as hard disk 0, 1, 2 or 3 image (@xref{disk_images}).
151
152@item -cdrom file
153Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and and
bellardbe3edd92004-06-03 12:48:45 +0000154@option{-cdrom} at the same time). You can use the host CD-ROM by
155using @file{/dev/cdrom} as filename.
bellard1f673132004-04-04 15:21:17 +0000156
157@item -boot [a|c|d]
158Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is
159the default.
160
161@item -snapshot
162Write to temporary files instead of disk image files. In this case,
163the raw disk image you use is not written back. You can however force
164the write back by pressing @key{C-a s} (@xref{disk_images}).
165
166@item -m megs
bellard15a34c62004-07-08 21:26:26 +0000167Set virtual RAM size to @var{megs} megabytes. Default is 128 MB.
bellard1f673132004-04-04 15:21:17 +0000168
bellard1f673132004-04-04 15:21:17 +0000169@item -nographic
170
171Normally, QEMU uses SDL to display the VGA output. With this option,
172you can totally disable graphical output so that QEMU is a simple
173command line application. The emulated serial port is redirected on
174the console. Therefore, you can still use QEMU to debug a Linux kernel
175with a serial console.
176
bellard3d11d0e2004-12-12 16:56:30 +0000177@item -k language
178
179Use keyboard layout @var{language} (for example @code{fr} for
180French). This option is only needed where it is not easy to get raw PC
181keycodes (e.g. on Macs or with some X11 servers). You don't need to
182use it on PC/Linux or PC/Windows hosts.
183
184The available layouts are:
185@example
186ar de-ch es fo fr-ca hu ja mk no pt-br sv
187da en-gb et fr fr-ch is lt nl pl ru th
188de en-us fi fr-be hr it lv nl-be pt sl tr
189@end example
190
191The default is @code{en-us}.
192
bellarda8c490c2004-04-26 20:59:17 +0000193@item -enable-audio
194
bellard1d14ffa2005-10-30 18:58:22 +0000195Will enable audio and all the sound hardware QEMU was built with.
196
197@item -audio-help
198
199Will show the audio subsystem help: list of drivers, tunable
200parameters.
201
202@item -soundhw card1,card2,...
203
204Enable audio and selected sound hardware. Use ? to print all
205available sound hardware.
206
207@example
208qemu -soundhw sb16,adlib hda
209qemu -soundhw es1370 hda
210qemu -soundhw ?
211@end example
bellarda8c490c2004-04-26 20:59:17 +0000212
bellard15a34c62004-07-08 21:26:26 +0000213@item -localtime
214Set the real time clock to local time (the default is to UTC
215time). This option is needed to have correct date in MS-DOS or
216Windows.
217
bellardd63d3072004-10-03 13:29:03 +0000218@item -full-screen
219Start in full screen.
220
bellardf7cce892004-12-08 22:21:25 +0000221@item -pidfile file
222Store the QEMU process PID in @var{file}. It is useful if you launch QEMU
223from a script.
224
bellard9d0a8e62005-07-03 17:34:05 +0000225@item -win2k-hack
226Use it when installing Windows 2000 to avoid a disk full bug. After
227Windows 2000 is installed, you no longer need this option (this option
228slows down the IDE transfers).
229
bellard1f673132004-04-04 15:21:17 +0000230@end table
231
bellardb389dbf2005-11-06 16:49:55 +0000232USB options:
233@table @option
234
235@item -usb
236Enable the USB driver (will be the default soon)
237
238@item -usbdevice devname
239Add the USB device @var{devname}. See the monitor command
240@code{usb_add} to have more information.
241@end table
242
bellard1f673132004-04-04 15:21:17 +0000243Network options:
244
245@table @option
246
247@item -n script
bellard52c00a52004-04-25 21:27:03 +0000248Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script
249is launched to configure the host network interface (usually tun0)
bellard1f673132004-04-04 15:21:17 +0000250corresponding to the virtual NE2000 card.
251
bellard3f1a88f2005-06-05 16:48:41 +0000252@item -nics n
253
254Simulate @var{n} network cards (the default is 1).
255
bellard1f673132004-04-04 15:21:17 +0000256@item -macaddr addr
257
258Set the mac address of the first interface (the format is
259aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each
260new network interface.
261
bellard52c00a52004-04-25 21:27:03 +0000262@item -tun-fd fd
263Assumes @var{fd} talks to a tap/tun host network interface and use
264it. Read @url{http://bellard.org/qemu/tetrinet.html} to have an
265example of its use.
266
267@item -user-net
bellard15a34c62004-07-08 21:26:26 +0000268Use the user mode network stack. This is the default if no tun/tap
269network init script is found.
bellard52c00a52004-04-25 21:27:03 +0000270
bellard9bf05442004-08-25 22:12:49 +0000271@item -tftp prefix
272When using the user mode network stack, activate a built-in TFTP
273server. All filenames beginning with @var{prefix} can be downloaded
274from the host to the guest using a TFTP client. The TFTP client on the
275guest must be configured in binary mode (use the command @code{bin} of
276the Unix TFTP client). The host IP address on the guest is as usual
27710.0.2.2.
278
bellard2518bd02004-09-30 22:35:13 +0000279@item -smb dir
280When using the user mode network stack, activate a built-in SMB
281server so that Windows OSes can access to the host files in @file{dir}
282transparently.
283
284In the guest Windows OS, the line:
285@example
28610.0.2.4 smbserver
287@end example
288must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me)
289or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000).
290
291Then @file{dir} can be accessed in @file{\\smbserver\qemu}.
292
293Note that a SAMBA server must be installed on the host OS in
294@file{/usr/sbin/smbd}. QEMU was tested succesfully with smbd version
bellard6cc721c2005-07-28 22:27:28 +00002952.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3.
bellard2518bd02004-09-30 22:35:13 +0000296
bellard9bf05442004-08-25 22:12:49 +0000297@item -redir [tcp|udp]:host-port:[guest-host]:guest-port
298
299When using the user mode network stack, redirect incoming TCP or UDP
300connections to the host port @var{host-port} to the guest
301@var{guest-host} on guest port @var{guest-port}. If @var{guest-host}
302is not specified, its value is 10.0.2.15 (default address given by the
303built-in DHCP server).
304
305For example, to redirect host X11 connection from screen 1 to guest
306screen 0, use the following:
307
308@example
309# on the host
310qemu -redir tcp:6001::6000 [...]
311# this host xterm should open in the guest X11 server
312xterm -display :1
313@end example
314
315To redirect telnet connections from host port 5555 to telnet port on
316the guest, use the following:
317
318@example
319# on the host
320qemu -redir tcp:5555::23 [...]
321telnet localhost 5555
322@end example
323
324Then when you use on the host @code{telnet localhost 5555}, you
325connect to the guest telnet server.
326
bellard52c00a52004-04-25 21:27:03 +0000327@item -dummy-net
bellard15a34c62004-07-08 21:26:26 +0000328Use the dummy network stack: no packet will be received by the network
bellard52c00a52004-04-25 21:27:03 +0000329cards.
bellard1f673132004-04-04 15:21:17 +0000330
331@end table
332
333Linux boot specific. When using this options, you can use a given
334Linux kernel without installing it in the disk image. It can be useful
335for easier testing of various kernels.
336
337@table @option
338
339@item -kernel bzImage
340Use @var{bzImage} as kernel image.
341
342@item -append cmdline
343Use @var{cmdline} as kernel command line
344
345@item -initrd file
346Use @var{file} as initial ram disk.
347
348@end table
349
bellard15a34c62004-07-08 21:26:26 +0000350Debug/Expert options:
bellard1f673132004-04-04 15:21:17 +0000351@table @option
bellarda0a821a2004-07-14 17:38:57 +0000352
353@item -serial dev
354Redirect the virtual serial port to host device @var{dev}. Available
355devices are:
356@table @code
357@item vc
358Virtual console
359@item pty
360[Linux only] Pseudo TTY (a new PTY is automatically allocated)
361@item null
362void device
363@item stdio
364[Unix only] standard input/output
365@end table
366The default device is @code{vc} in graphical mode and @code{stdio} in
367non graphical mode.
368
bellard05d58182004-08-24 21:12:04 +0000369This option can be used several times to simulate up to 4 serials
370ports.
371
bellarda0a821a2004-07-14 17:38:57 +0000372@item -monitor dev
373Redirect the monitor to host device @var{dev} (same devices as the
374serial port).
375The default device is @code{vc} in graphical mode and @code{stdio} in
376non graphical mode.
377
bellard1f673132004-04-04 15:21:17 +0000378@item -s
379Wait gdb connection to port 1234 (@xref{gdb_usage}).
380@item -p port
381Change gdb connection port.
bellard52c00a52004-04-25 21:27:03 +0000382@item -S
383Do not start CPU at startup (you must type 'c' in the monitor).
bellard1f673132004-04-04 15:21:17 +0000384@item -d
385Output log in /tmp/qemu.log
bellard46d47672004-11-16 01:45:27 +0000386@item -hdachs c,h,s,[,t]
387Force hard disk 0 physical geometry (1 <= @var{c} <= 16383, 1 <=
388@var{h} <= 16, 1 <= @var{s} <= 63) and optionally force the BIOS
389translation mode (@var{t}=none, lba or auto). Usually QEMU can guess
390all thoses parameters. This option is useful for old MS-DOS disk
391images.
bellard7c3fc842005-02-10 21:46:47 +0000392
bellard15a34c62004-07-08 21:26:26 +0000393@item -isa
394Simulate an ISA-only system (default is PCI system).
395@item -std-vga
396Simulate a standard VGA card with Bochs VBE extensions (default is
397Cirrus Logic GD5446 PCI VGA)
bellardd63d3072004-10-03 13:29:03 +0000398@item -loadvm file
399Start right away with a saved state (@code{loadvm} in monitor)
bellard1f673132004-04-04 15:21:17 +0000400@end table
401
bellard3e11db92004-07-14 17:47:14 +0000402@c man end
403
404@section Keys
405
406@c man begin OPTIONS
407
bellarda1b74fe2004-05-08 13:26:35 +0000408During the graphical emulation, you can use the following keys:
409@table @key
bellardf9859312004-10-03 14:33:10 +0000410@item Ctrl-Alt-f
bellarda1b74fe2004-05-08 13:26:35 +0000411Toggle full screen
bellarda0a821a2004-07-14 17:38:57 +0000412
bellardf9859312004-10-03 14:33:10 +0000413@item Ctrl-Alt-n
bellarda0a821a2004-07-14 17:38:57 +0000414Switch to virtual console 'n'. Standard console mappings are:
415@table @emph
416@item 1
417Target system display
418@item 2
419Monitor
420@item 3
421Serial port
bellarda1b74fe2004-05-08 13:26:35 +0000422@end table
423
bellardf9859312004-10-03 14:33:10 +0000424@item Ctrl-Alt
bellarda0a821a2004-07-14 17:38:57 +0000425Toggle mouse and keyboard grab.
426@end table
427
bellard3e11db92004-07-14 17:47:14 +0000428In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
429@key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
430
bellarda0a821a2004-07-14 17:38:57 +0000431During emulation, if you are using the @option{-nographic} option, use
432@key{Ctrl-a h} to get terminal commands:
bellard1f673132004-04-04 15:21:17 +0000433
434@table @key
bellarda1b74fe2004-05-08 13:26:35 +0000435@item Ctrl-a h
bellard1f673132004-04-04 15:21:17 +0000436Print this help
bellarda1b74fe2004-05-08 13:26:35 +0000437@item Ctrl-a x
bellard1f673132004-04-04 15:21:17 +0000438Exit emulatior
bellarda1b74fe2004-05-08 13:26:35 +0000439@item Ctrl-a s
bellard1f673132004-04-04 15:21:17 +0000440Save disk data back to file (if -snapshot)
bellarda1b74fe2004-05-08 13:26:35 +0000441@item Ctrl-a b
bellard1f673132004-04-04 15:21:17 +0000442Send break (magic sysrq in Linux)
bellarda1b74fe2004-05-08 13:26:35 +0000443@item Ctrl-a c
bellard1f673132004-04-04 15:21:17 +0000444Switch between console and monitor
bellarda1b74fe2004-05-08 13:26:35 +0000445@item Ctrl-a Ctrl-a
446Send Ctrl-a
bellard1f673132004-04-04 15:21:17 +0000447@end table
448@c man end
449
450@ignore
451
452@setfilename qemu
453@settitle QEMU System Emulator
454
455@c man begin SEEALSO
456The HTML documentation of QEMU for more precise information and Linux
457user mode emulator invocation.
458@c man end
459
460@c man begin AUTHOR
461Fabrice Bellard
462@c man end
463
464@end ignore
465
466@end ignore
467
bellard1f673132004-04-04 15:21:17 +0000468@section QEMU Monitor
469
470The QEMU monitor is used to give complex commands to the QEMU
471emulator. You can use it to:
472
473@itemize @minus
474
475@item
476Remove or insert removable medias images
477(such as CD-ROM or floppies)
478
479@item
480Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
481from a disk file.
482
483@item Inspect the VM state without an external debugger.
484
485@end itemize
486
487@subsection Commands
488
489The following commands are available:
490
491@table @option
492
493@item help or ? [cmd]
494Show the help for all commands or just for command @var{cmd}.
495
496@item commit
497Commit changes to the disk images (if -snapshot is used)
498
499@item info subcommand
500show various information about the system state
501
502@table @option
503@item info network
504show the network state
505@item info block
506show the block devices
507@item info registers
508show the cpu registers
509@item info history
510show the command line history
bellardb389dbf2005-11-06 16:49:55 +0000511@item info pci
512show emulated PCI device
513@item info usb
514show USB devices plugged on the virtual USB hub
515@item info usbhost
516show all USB host devices
bellard1f673132004-04-04 15:21:17 +0000517@end table
518
519@item q or quit
520Quit the emulator.
521
522@item eject [-f] device
523Eject a removable media (use -f to force it).
524
525@item change device filename
526Change a removable media.
527
528@item screendump filename
529Save screen into PPM image @var{filename}.
530
531@item log item1[,...]
532Activate logging of the specified items to @file{/tmp/qemu.log}.
533
534@item savevm filename
535Save the whole virtual machine state to @var{filename}.
536
537@item loadvm filename
538Restore the whole virtual machine state from @var{filename}.
539
540@item stop
541Stop emulation.
542
543@item c or cont
544Resume emulation.
545
546@item gdbserver [port]
547Start gdbserver session (default port=1234)
548
549@item x/fmt addr
550Virtual memory dump starting at @var{addr}.
551
552@item xp /fmt addr
553Physical memory dump starting at @var{addr}.
554
555@var{fmt} is a format which tells the command how to format the
556data. Its syntax is: @option{/@{count@}@{format@}@{size@}}
557
558@table @var
559@item count
560is the number of items to be dumped.
561
562@item format
563can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
564c (char) or i (asm instruction).
565
566@item size
bellard52c00a52004-04-25 21:27:03 +0000567can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
568@code{h} or @code{w} can be specified with the @code{i} format to
569respectively select 16 or 32 bit code instruction size.
bellard1f673132004-04-04 15:21:17 +0000570
571@end table
572
573Examples:
574@itemize
575@item
576Dump 10 instructions at the current instruction pointer:
577@example
578(qemu) x/10i $eip
5790x90107063: ret
5800x90107064: sti
5810x90107065: lea 0x0(%esi,1),%esi
5820x90107069: lea 0x0(%edi,1),%edi
5830x90107070: ret
5840x90107071: jmp 0x90107080
5850x90107073: nop
5860x90107074: nop
5870x90107075: nop
5880x90107076: nop
589@end example
590
591@item
592Dump 80 16 bit values at the start of the video memory.
593@example
594(qemu) xp/80hx 0xb8000
5950x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
5960x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
5970x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
5980x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
5990x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
6000x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
6010x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
6020x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
6030x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
6040x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
605@end example
606@end itemize
607
608@item p or print/fmt expr
609
610Print expression value. Only the @var{format} part of @var{fmt} is
611used.
612
bellarda3a91a32004-06-04 11:06:21 +0000613@item sendkey keys
614
615Send @var{keys} to the emulator. Use @code{-} to press several keys
616simultaneously. Example:
617@example
618sendkey ctrl-alt-f1
619@end example
620
621This command is useful to send keys that your graphical user interface
622intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
623
bellard15a34c62004-07-08 21:26:26 +0000624@item system_reset
625
626Reset the system.
627
bellardb389dbf2005-11-06 16:49:55 +0000628@item usb_add devname
629
630Plug the USB device devname to the QEMU virtual USB hub. @var{devname}
631is either a virtual device name (for example @code{mouse}) or a host
632USB device identifier. Host USB device identifiers have the following
633syntax: @code{host:bus.addr} or @code{host:vendor_id:product_id}.
634
635@item usb_del devname
636
637Remove the USB device @var{devname} from the QEMU virtual USB
638hub. @var{devname} has the syntax @code{bus.addr}. Use the monitor
639command @code{info usb} to see the devices you can remove.
640
bellard1f673132004-04-04 15:21:17 +0000641@end table
642
643@subsection Integer expressions
644
645The monitor understands integers expressions for every integer
646argument. You can use register names to get the value of specifics
647CPU registers by prefixing them with @emph{$}.
648
649@node disk_images
650@section Disk Images
651
bellardacd935e2004-11-15 22:57:26 +0000652Since version 0.6.1, QEMU supports many disk image formats, including
653growable disk images (their size increase as non empty sectors are
654written), compressed and encrypted disk images.
bellard1f673132004-04-04 15:21:17 +0000655
bellardacd935e2004-11-15 22:57:26 +0000656@subsection Quick start for disk image creation
657
658You can create a disk image with the command:
bellard1f673132004-04-04 15:21:17 +0000659@example
bellardacd935e2004-11-15 22:57:26 +0000660qemu-img create myimage.img mysize
bellard1f673132004-04-04 15:21:17 +0000661@end example
bellardacd935e2004-11-15 22:57:26 +0000662where @var{myimage.img} is the disk image filename and @var{mysize} is its
663size in kilobytes. You can add an @code{M} suffix to give the size in
664megabytes and a @code{G} suffix for gigabytes.
665
666@xref{qemu_img_invocation} for more information.
bellard1f673132004-04-04 15:21:17 +0000667
668@subsection Snapshot mode
669
670If you use the option @option{-snapshot}, all disk images are
671considered as read only. When sectors in written, they are written in
672a temporary file created in @file{/tmp}. You can however force the
bellardacd935e2004-11-15 22:57:26 +0000673write back to the raw disk images by using the @code{commit} monitor
674command (or @key{C-a s} in the serial console).
bellard1f673132004-04-04 15:21:17 +0000675
bellardacd935e2004-11-15 22:57:26 +0000676@node qemu_img_invocation
677@subsection @code{qemu-img} Invocation
bellard1f673132004-04-04 15:21:17 +0000678
bellardacd935e2004-11-15 22:57:26 +0000679@include qemu-img.texi
bellard05efe462004-06-16 20:34:33 +0000680
bellard9d4fb822004-04-26 20:55:38 +0000681@section Network emulation
682
683QEMU simulates up to 6 networks cards (NE2000 boards). Each card can
684be connected to a specific host network interface.
685
686@subsection Using tun/tap network interface
687
688This is the standard way to emulate network. QEMU adds a virtual
689network device on your host (called @code{tun0}), and you can then
690configure it as if it was a real ethernet card.
691
692As an example, you can download the @file{linux-test-xxx.tar.gz}
693archive and copy the script @file{qemu-ifup} in @file{/etc} and
694configure properly @code{sudo} so that the command @code{ifconfig}
695contained in @file{qemu-ifup} can be executed as root. You must verify
696that your host kernel supports the TUN/TAP network interfaces: the
697device @file{/dev/net/tun} must be present.
698
699See @ref{direct_linux_boot} to have an example of network use with a
700Linux distribution.
701
702@subsection Using the user mode network stack
703
bellard443f1372004-06-04 11:13:20 +0000704By using the option @option{-user-net} or if you have no tun/tap init
705script, QEMU uses a completely user mode network stack (you don't need
706root priviledge to use the virtual network). The virtual network
707configuration is the following:
bellard9d4fb822004-04-26 20:55:38 +0000708
709@example
710
711QEMU Virtual Machine <------> Firewall/DHCP server <-----> Internet
712 (10.0.2.x) | (10.0.2.2)
713 |
bellard2518bd02004-09-30 22:35:13 +0000714 ----> DNS server (10.0.2.3)
715 |
716 ----> SMB server (10.0.2.4)
bellard9d4fb822004-04-26 20:55:38 +0000717@end example
718
719The QEMU VM behaves as if it was behind a firewall which blocks all
720incoming connections. You can use a DHCP client to automatically
721configure the network in the QEMU VM.
722
723In order to check that the user mode network is working, you can ping
724the address 10.0.2.2 and verify that you got an address in the range
72510.0.2.x from the QEMU virtual DHCP server.
726
bellardb415a402004-05-23 21:04:06 +0000727Note that @code{ping} is not supported reliably to the internet as it
728would require root priviledges. It means you can only ping the local
729router (10.0.2.2).
730
bellard9bf05442004-08-25 22:12:49 +0000731When using the built-in TFTP server, the router is also the TFTP
732server.
733
734When using the @option{-redir} option, TCP or UDP connections can be
735redirected from the host to the guest. It allows for example to
736redirect X11, telnet or SSH connections.
bellard443f1372004-06-04 11:13:20 +0000737
bellard9d4fb822004-04-26 20:55:38 +0000738@node direct_linux_boot
739@section Direct Linux Boot
bellard0806e3f2003-10-01 00:15:32 +0000740
741This section explains how to launch a Linux kernel inside QEMU without
742having to make a full bootable image. It is very useful for fast Linux
743kernel testing. The QEMU network configuration is also explained.
bellard1eb20522003-06-25 16:21:49 +0000744
745@enumerate
746@item
bellard0806e3f2003-10-01 00:15:32 +0000747Download the archive @file{linux-test-xxx.tar.gz} containing a Linux
748kernel and a disk image.
bellard1eb20522003-06-25 16:21:49 +0000749
750@item Optional: If you want network support (for example to launch X11 examples), you
bellard0806e3f2003-10-01 00:15:32 +0000751must copy the script @file{qemu-ifup} in @file{/etc} and configure
bellard1eb20522003-06-25 16:21:49 +0000752properly @code{sudo} so that the command @code{ifconfig} contained in
bellard0806e3f2003-10-01 00:15:32 +0000753@file{qemu-ifup} can be executed as root. You must verify that your host
bellard1eb20522003-06-25 16:21:49 +0000754kernel supports the TUN/TAP network interfaces: the device
755@file{/dev/net/tun} must be present.
756
757When network is enabled, there is a virtual network connection between
758the host kernel and the emulated kernel. The emulated kernel is seen
759from the host kernel at IP address 172.20.0.2 and the host kernel is
760seen from the emulated kernel at IP address 172.20.0.1.
761
bellard0806e3f2003-10-01 00:15:32 +0000762@item Launch @code{qemu.sh}. You should have the following output:
bellard1eb20522003-06-25 16:21:49 +0000763
764@example
bellard0806e3f2003-10-01 00:15:32 +0000765> ./qemu.sh
bellard181f1552003-11-13 01:47:16 +0000766Connected to host network interface: tun0
767Linux 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
bellard1eb20522003-06-25 16:21:49 +0000768BIOS-provided physical RAM map:
bellard46907642003-07-07 12:17:46 +0000769 BIOS-e801: 0000000000000000 - 000000000009f000 (usable)
770 BIOS-e801: 0000000000100000 - 0000000002000000 (usable)
bellard1eb20522003-06-25 16:21:49 +000077132MB LOWMEM available.
772On node 0 totalpages: 8192
773zone(0): 4096 pages.
774zone(1): 4096 pages.
775zone(2): 0 pages.
bellard181f1552003-11-13 01:47:16 +0000776Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe console=ttyS0
bellard46907642003-07-07 12:17:46 +0000777ide_setup: ide2=noprobe
778ide_setup: ide3=noprobe
779ide_setup: ide4=noprobe
780ide_setup: ide5=noprobe
bellard1eb20522003-06-25 16:21:49 +0000781Initializing CPU#0
bellard181f1552003-11-13 01:47:16 +0000782Detected 2399.621 MHz processor.
783Console: colour EGA 80x25
784Calibrating delay loop... 4744.80 BogoMIPS
785Memory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, 0k highmem)
bellard1eb20522003-06-25 16:21:49 +0000786Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
787Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
bellard181f1552003-11-13 01:47:16 +0000788Mount cache hash table entries: 512 (order: 0, 4096 bytes)
bellard1eb20522003-06-25 16:21:49 +0000789Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
790Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
791CPU: Intel Pentium Pro stepping 03
792Checking 'hlt' instruction... OK.
793POSIX conformance testing by UNIFIX
794Linux NET4.0 for Linux 2.4
795Based upon Swansea University Computer Society NET3.039
796Initializing RT netlink socket
797apm: BIOS not found.
798Starting kswapd
bellard46907642003-07-07 12:17:46 +0000799Journalled Block Device driver loaded
bellard181f1552003-11-13 01:47:16 +0000800Detected PS/2 Mouse Port.
bellard1eb20522003-06-25 16:21:49 +0000801pty: 256 Unix98 ptys configured
802Serial driver version 5.05c (2001-07-08) with no serial options enabled
803ttyS00 at 0x03f8 (irq = 4) is a 16450
804ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com)
805Last modified Nov 1, 2000 by Paul Gortmaker
806NE*000 ethercard probe at 0x300: 52 54 00 12 34 56
807eth0: NE2000 found at 0x300, using IRQ 9.
bellard46907642003-07-07 12:17:46 +0000808RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
bellard181f1552003-11-13 01:47:16 +0000809Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
810ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
811hda: QEMU HARDDISK, ATA DISK drive
812ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
813hda: attached ide-disk driver.
814hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63
815Partition check:
816 hda:
817Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
bellard1eb20522003-06-25 16:21:49 +0000818NET4: Linux TCP/IP 1.0 for NET4.0
819IP Protocols: ICMP, UDP, TCP, IGMP
820IP: routing cache hash table of 512 buckets, 4Kbytes
bellard46907642003-07-07 12:17:46 +0000821TCP: Hash tables configured (established 2048 bind 4096)
bellard1eb20522003-06-25 16:21:49 +0000822NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
bellard46907642003-07-07 12:17:46 +0000823EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
bellard1eb20522003-06-25 16:21:49 +0000824VFS: Mounted root (ext2 filesystem).
bellard181f1552003-11-13 01:47:16 +0000825Freeing unused kernel memory: 64k freed
826
827Linux 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
828
829QEMU Linux test distribution (based on Redhat 9)
830
831Type 'exit' to halt the system
832
833sh-2.05b#
bellard1eb20522003-06-25 16:21:49 +0000834@end example
835
836@item
837Then you can play with the kernel inside the virtual serial console. You
838can launch @code{ls} for example. Type @key{Ctrl-a h} to have an help
839about the keys you can type inside the virtual serial console. In
bellardd5a0b502003-06-27 12:02:03 +0000840particular, use @key{Ctrl-a x} to exit QEMU and use @key{Ctrl-a b} as
841the Magic SysRq key.
bellard1eb20522003-06-25 16:21:49 +0000842
843@item
844If the network is enabled, launch the script @file{/etc/linuxrc} in the
845emulator (don't forget the leading dot):
846@example
847. /etc/linuxrc
848@end example
849
850Then enable X11 connections on your PC from the emulated Linux:
851@example
852xhost +172.20.0.2
853@end example
854
855You can now launch @file{xterm} or @file{xlogo} and verify that you have
856a real Virtual Linux system !
857
858@end enumerate
859
bellardd5a0b502003-06-27 12:02:03 +0000860NOTES:
861@enumerate
862@item
bellard0806e3f2003-10-01 00:15:32 +0000863A 2.5.74 kernel is also included in the archive. Just
864replace the bzImage in qemu.sh to try it.
bellardd5a0b502003-06-27 12:02:03 +0000865
866@item
bellard9d4520d2003-10-28 01:38:57 +0000867In order to exit cleanly from qemu, you can do a @emph{shutdown} inside
868qemu. qemu will automatically exit when the Linux shutdown is done.
bellard46907642003-07-07 12:17:46 +0000869
870@item
871You can boot slightly faster by disabling the probe of non present IDE
872interfaces. To do so, add the following options on the kernel command
873line:
874@example
875ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe
876@end example
877
878@item
879The example disk image is a modified version of the one made by Kevin
bellard1eb20522003-06-25 16:21:49 +0000880Lawton for the plex86 Project (@url{www.plex86.org}).
881
bellardd5a0b502003-06-27 12:02:03 +0000882@end enumerate
883
bellardb389dbf2005-11-06 16:49:55 +0000884@section USB emulation
885
886QEMU emulates a PCI UHCI USB controller and a 8 port USB hub connected
887to it. You can virtually plug to the hub virtual USB devices or real
888host USB devices (experimental, works only on Linux hosts).
889
890@subsection Using virtual USB devices
891
892A virtual USB mouse device is available for testing in QEMU.
893
894You can try it with the following monitor commands:
895
896@example
897# add the mouse device
898(qemu) usb_add mouse
899
900# show the virtual USB devices plugged on the QEMU Virtual USB hub
901(qemu) info usb
902 Device 0.3, speed 12 Mb/s
903
904# after some time you can try to remove the mouse
905(qemu) usb_del 0.3
906@end example
907
908The option @option{-usbdevice} is similar to the monitor command
909@code{usb_add}.
910
911@subsection Using host USB devices on a Linux host
912
913WARNING: this is an experimental feature. QEMU will slow down when
914using it. USB devices requiring real time streaming (i.e. USB Video
915Cameras) are not supported yet.
916
917@enumerate
918@item If you use an early Linux 2.4 kernel, verify that no Linux driver
919is actually using the USB device. A simple way to do that is simply to
920disable the corresponding kernel module by renaming it from @file{mydriver.o}
921to @file{mydriver.o.disabled}.
922
923@item Verify that @file{/proc/bus/usb} is working (most Linux distributions should enable it by default). You should see something like that:
924@example
925ls /proc/bus/usb
926001 devices drivers
927@end example
928
929@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:
930@example
931chown -R myuid /proc/bus/usb
932@end example
933
934@item Launch QEMU and do in the monitor:
935@example
936info usbhost
937 Device 1.2, speed 480 Mb/s
938 Class 00: USB device 1234:5678, USB DISK
939@end example
940You should see the list of the devices you can use (Never try to use
941hubs, it won't work).
942
943@item Add the device in QEMU by using:
944@example
945usb_add host:1234:5678
946@end example
947
948Normally the guest OS should report that a new USB device is
949plugged. You can use the option @option{-usbdevice} to do the same.
950
951@item Now you can try to use the host USB device in QEMU.
952
953@end enumerate
954
955When relaunching QEMU, you may have to unplug and plug again the USB
956device to make it work again (this is a bug).
957
bellard0806e3f2003-10-01 00:15:32 +0000958@node gdb_usage
bellardda415d52003-06-27 18:50:50 +0000959@section GDB usage
960
961QEMU has a primitive support to work with gdb, so that you can do
bellard0806e3f2003-10-01 00:15:32 +0000962'Ctrl-C' while the virtual machine is running and inspect its state.
bellardda415d52003-06-27 18:50:50 +0000963
bellard9d4520d2003-10-28 01:38:57 +0000964In order to use gdb, launch qemu with the '-s' option. It will wait for a
bellardda415d52003-06-27 18:50:50 +0000965gdb connection:
966@example
bellard6c9bf892004-01-24 13:46:56 +0000967> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
bellardda415d52003-06-27 18:50:50 +0000968Connected to host network interface: tun0
969Waiting gdb connection on port 1234
970@end example
971
972Then launch gdb on the 'vmlinux' executable:
973@example
974> gdb vmlinux
975@end example
976
977In gdb, connect to QEMU:
978@example
bellard6c9bf892004-01-24 13:46:56 +0000979(gdb) target remote localhost:1234
bellardda415d52003-06-27 18:50:50 +0000980@end example
981
982Then you can use gdb normally. For example, type 'c' to launch the kernel:
983@example
984(gdb) c
985@end example
986
bellard0806e3f2003-10-01 00:15:32 +0000987Here are some useful tips in order to use gdb on system code:
988
989@enumerate
990@item
991Use @code{info reg} to display all the CPU registers.
992@item
993Use @code{x/10i $eip} to display the code at the PC position.
994@item
995Use @code{set architecture i8086} to dump 16 bit code. Then use
996@code{x/10i $cs*16+*eip} to dump the code at the PC position.
997@end enumerate
998
bellard1a084f32004-05-13 22:34:49 +0000999@section Target OS specific information
1000
1001@subsection Linux
1002
bellard15a34c62004-07-08 21:26:26 +00001003To have access to SVGA graphic modes under X11, use the @code{vesa} or
1004the @code{cirrus} X11 driver. For optimal performances, use 16 bit
1005color depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001006
bellarde3371e62004-07-10 16:26:02 +00001007When using a 2.6 guest Linux kernel, you should add the option
1008@code{clock=pit} on the kernel command line because the 2.6 Linux
1009kernels make very strict real time clock checks by default that QEMU
1010cannot simulate exactly.
1011
bellard7c3fc842005-02-10 21:46:47 +00001012When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1013not activated because QEMU is slower with this patch. The QEMU
1014Accelerator Module is also much slower in this case. Earlier Fedora
1015Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1016patch by default. Newer kernels don't have it.
1017
bellard1a084f32004-05-13 22:34:49 +00001018@subsection Windows
1019
1020If you have a slow host, using Windows 95 is better as it gives the
1021best speed. Windows 2000 is also a good choice.
1022
bellarde3371e62004-07-10 16:26:02 +00001023@subsubsection SVGA graphic modes support
1024
1025QEMU emulates a Cirrus Logic GD5446 Video
bellard15a34c62004-07-08 21:26:26 +00001026card. All Windows versions starting from Windows 95 should recognize
1027and use this graphic card. For optimal performances, use 16 bit color
1028depth in the guest and the host OS.
bellard1a084f32004-05-13 22:34:49 +00001029
bellarde3371e62004-07-10 16:26:02 +00001030@subsubsection CPU usage reduction
1031
1032Windows 9x does not correctly use the CPU HLT
bellard15a34c62004-07-08 21:26:26 +00001033instruction. The result is that it takes host CPU cycles even when
1034idle. You can install the utility from
1035@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this
1036problem. Note that no such tool is needed for NT, 2000 or XP.
bellard1a084f32004-05-13 22:34:49 +00001037
bellard9d0a8e62005-07-03 17:34:05 +00001038@subsubsection Windows 2000 disk full problem
bellarde3371e62004-07-10 16:26:02 +00001039
bellard9d0a8e62005-07-03 17:34:05 +00001040Windows 2000 has a bug which gives a disk full problem during its
1041installation. When installing it, use the @option{-win2k-hack} QEMU
1042option to enable a specific workaround. After Windows 2000 is
1043installed, you no longer need this option (this option slows down the
1044IDE transfers).
bellarde3371e62004-07-10 16:26:02 +00001045
bellard6cc721c2005-07-28 22:27:28 +00001046@subsubsection Windows 2000 shutdown
1047
1048Windows 2000 cannot automatically shutdown in QEMU although Windows 98
1049can. It comes from the fact that Windows 2000 does not automatically
1050use the APM driver provided by the BIOS.
1051
1052In order to correct that, do the following (thanks to Struan
1053Bartlett): go to the Control Panel => Add/Remove Hardware & Next =>
1054Add/Troubleshoot a device => Add a new device & Next => No, select the
1055hardware from a list & Next => NT Apm/Legacy Support & Next => Next
1056(again) a few times. Now the driver is installed and Windows 2000 now
1057correctly instructs QEMU to shutdown at the appropriate moment.
1058
1059@subsubsection Share a directory between Unix and Windows
1060
1061See @ref{sec_invocation} about the help of the option @option{-smb}.
1062
bellarde3371e62004-07-10 16:26:02 +00001063@subsubsection Windows XP security problems
1064
1065Some releases of Windows XP install correctly but give a security
1066error when booting:
1067@example
1068A problem is preventing Windows from accurately checking the
1069license for this computer. Error code: 0x800703e6.
1070@end example
1071The only known workaround is to boot in Safe mode
1072without networking support.
1073
1074Future QEMU releases are likely to correct this bug.
1075
bellarda0a821a2004-07-14 17:38:57 +00001076@subsection MS-DOS and FreeDOS
1077
1078@subsubsection CPU usage reduction
1079
1080DOS does not correctly use the CPU HLT instruction. The result is that
1081it takes host CPU cycles even when idle. You can install the utility
1082from @url{http://www.vmware.com/software/dosidle210.zip} to solve this
1083problem.
1084
bellard15a34c62004-07-08 21:26:26 +00001085@chapter QEMU PowerPC System emulator invocation
bellard52c00a52004-04-25 21:27:03 +00001086
1087Use the executable @file{qemu-system-ppc} to simulate a complete PREP
bellard15a34c62004-07-08 21:26:26 +00001088or PowerMac PowerPC system.
1089
bellardb671f9e2005-04-30 15:08:33 +00001090QEMU emulates the following PowerMac peripherals:
bellard15a34c62004-07-08 21:26:26 +00001091
1092@itemize @minus
1093@item
1094UniNorth PCI Bridge
1095@item
1096PCI VGA compatible card with VESA Bochs Extensions
1097@item
10982 PMAC IDE interfaces with hard disk and CD-ROM support
1099@item
1100NE2000 PCI adapters
1101@item
1102Non Volatile RAM
1103@item
1104VIA-CUDA with ADB keyboard and mouse.
1105@end itemize
bellard52c00a52004-04-25 21:27:03 +00001106
bellardb671f9e2005-04-30 15:08:33 +00001107QEMU emulates the following PREP peripherals:
bellard52c00a52004-04-25 21:27:03 +00001108
1109@itemize @minus
1110@item
bellard15a34c62004-07-08 21:26:26 +00001111PCI Bridge
1112@item
1113PCI VGA compatible card with VESA Bochs Extensions
1114@item
bellard52c00a52004-04-25 21:27:03 +000011152 IDE interfaces with hard disk and CD-ROM support
1116@item
1117Floppy disk
1118@item
bellard15a34c62004-07-08 21:26:26 +00001119NE2000 network adapters
bellard52c00a52004-04-25 21:27:03 +00001120@item
1121Serial port
1122@item
1123PREP Non Volatile RAM
bellard15a34c62004-07-08 21:26:26 +00001124@item
1125PC compatible keyboard and mouse.
bellard52c00a52004-04-25 21:27:03 +00001126@end itemize
1127
bellard15a34c62004-07-08 21:26:26 +00001128QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
1129@url{http://site.voila.fr/jmayer/OpenHackWare/index.htm}.
1130
bellard52c00a52004-04-25 21:27:03 +00001131You can read the qemu PC system emulation chapter to have more
1132informations about QEMU usage.
1133
bellard15a34c62004-07-08 21:26:26 +00001134@c man begin OPTIONS
1135
1136The following options are specific to the PowerPC emulation:
1137
1138@table @option
1139
1140@item -prep
1141Simulate a PREP system (default is PowerMAC)
1142
1143@item -g WxH[xDEPTH]
1144
1145Set the initial VGA graphic mode. The default is 800x600x15.
1146
1147@end table
1148
1149@c man end
1150
1151
bellard52c00a52004-04-25 21:27:03 +00001152More information is available at
1153@url{http://jocelyn.mayer.free.fr/qemu-ppc/}.
1154
bellard34751872005-07-02 14:31:34 +00001155@chapter Sparc32 System emulator invocation
bellarde80cfcf2004-12-19 23:18:01 +00001156
1157Use the executable @file{qemu-system-sparc} to simulate a JavaStation
bellard34751872005-07-02 14:31:34 +00001158(sun4m architecture). The emulation is somewhat complete.
bellarde80cfcf2004-12-19 23:18:01 +00001159
bellardb671f9e2005-04-30 15:08:33 +00001160QEMU emulates the following sun4m peripherals:
bellarde80cfcf2004-12-19 23:18:01 +00001161
1162@itemize @minus
bellard34751872005-07-02 14:31:34 +00001163@item
bellarde80cfcf2004-12-19 23:18:01 +00001164IOMMU
1165@item
1166TCX Frame buffer
1167@item
1168Lance (Am7990) Ethernet
1169@item
1170Non Volatile RAM M48T08
1171@item
bellard34751872005-07-02 14:31:34 +00001172Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1173and power/reset logic
1174@item
1175ESP SCSI controller with hard disk and CD-ROM support
1176@item
1177Floppy drive
bellarde80cfcf2004-12-19 23:18:01 +00001178@end itemize
1179
bellard34751872005-07-02 14:31:34 +00001180The number of peripherals is fixed in the architecture.
bellarde80cfcf2004-12-19 23:18:01 +00001181
bellard34751872005-07-02 14:31:34 +00001182QEMU uses the Proll, a PROM replacement available at
1183@url{http://people.redhat.com/zaitcev/linux/}. The required
1184QEMU-specific patches are included with the sources.
1185
1186A sample Linux 2.6 series kernel and ram disk image are available on
1187the QEMU web site. Please note that currently neither Linux 2.4
1188series, NetBSD, nor OpenBSD kernels work.
1189
1190@c man begin OPTIONS
1191
1192The following options are specific to the Sparc emulation:
1193
1194@table @option
1195
1196@item -g WxH
1197
1198Set the initial TCX graphic mode. The default is 1024x768.
1199
1200@end table
1201
1202@c man end
1203
1204@chapter Sparc64 System emulator invocation
1205
1206Use the executable @file{qemu-system-sparc64} to simulate a Sun4u machine.
1207The emulator is not usable for anything yet.
bellardb7569212005-03-13 09:43:05 +00001208
bellard83469012005-07-23 14:27:54 +00001209QEMU emulates the following sun4u peripherals:
1210
1211@itemize @minus
1212@item
1213UltraSparc IIi APB PCI Bridge
1214@item
1215PCI VGA compatible card with VESA Bochs Extensions
1216@item
1217Non Volatile RAM M48T59
1218@item
1219PC-compatible serial ports
1220@end itemize
1221
bellard9d0a8e62005-07-03 17:34:05 +00001222@chapter MIPS System emulator invocation
1223
1224Use the executable @file{qemu-system-mips} to simulate a MIPS machine.
1225The emulator begins to launch a Linux kernel.
1226
bellard1f673132004-04-04 15:21:17 +00001227@chapter QEMU User space emulator invocation
bellard386405f2003-03-23 21:28:45 +00001228
bellard1f673132004-04-04 15:21:17 +00001229@section Quick Start
bellard386405f2003-03-23 21:28:45 +00001230
bellard1f673132004-04-04 15:21:17 +00001231In order to launch a Linux process, QEMU needs the process executable
1232itself and all the target (x86) dynamic libraries used by it.
bellard386405f2003-03-23 21:28:45 +00001233
bellard1f673132004-04-04 15:21:17 +00001234@itemize
bellard386405f2003-03-23 21:28:45 +00001235
bellard1f673132004-04-04 15:21:17 +00001236@item On x86, you can just try to launch any process by using the native
1237libraries:
bellard386405f2003-03-23 21:28:45 +00001238
bellard1f673132004-04-04 15:21:17 +00001239@example
1240qemu-i386 -L / /bin/ls
1241@end example
bellardfd429f22003-03-30 20:59:46 +00001242
bellard1f673132004-04-04 15:21:17 +00001243@code{-L /} tells that the x86 dynamic linker must be searched with a
1244@file{/} prefix.
bellard1eb20522003-06-25 16:21:49 +00001245
bellard1f673132004-04-04 15:21:17 +00001246@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):
bellard1eb20522003-06-25 16:21:49 +00001247
bellard1f673132004-04-04 15:21:17 +00001248@example
1249qemu-i386 -L / qemu-i386 -L / /bin/ls
1250@end example
bellard386405f2003-03-23 21:28:45 +00001251
bellard1f673132004-04-04 15:21:17 +00001252@item On non x86 CPUs, you need first to download at least an x86 glibc
1253(@file{qemu-runtime-i386-XXX-.tar.gz} on the QEMU web page). Ensure that
1254@code{LD_LIBRARY_PATH} is not set:
bellard386405f2003-03-23 21:28:45 +00001255
bellard1f673132004-04-04 15:21:17 +00001256@example
1257unset LD_LIBRARY_PATH
1258@end example
bellard386405f2003-03-23 21:28:45 +00001259
bellard1f673132004-04-04 15:21:17 +00001260Then you can launch the precompiled @file{ls} x86 executable:
bellard386405f2003-03-23 21:28:45 +00001261
bellard1f673132004-04-04 15:21:17 +00001262@example
1263qemu-i386 tests/i386/ls
1264@end example
1265You can look at @file{qemu-binfmt-conf.sh} so that
1266QEMU is automatically launched by the Linux kernel when you try to
1267launch x86 executables. It requires the @code{binfmt_misc} module in the
1268Linux kernel.
bellard386405f2003-03-23 21:28:45 +00001269
bellard1f673132004-04-04 15:21:17 +00001270@item The x86 version of QEMU is also included. You can try weird things such as:
1271@example
1272qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1273@end example
bellard386405f2003-03-23 21:28:45 +00001274
bellard1f673132004-04-04 15:21:17 +00001275@end itemize
bellard386405f2003-03-23 21:28:45 +00001276
bellard1f673132004-04-04 15:21:17 +00001277@section Wine launch
bellard386405f2003-03-23 21:28:45 +00001278
bellard1f673132004-04-04 15:21:17 +00001279@itemize
bellard386405f2003-03-23 21:28:45 +00001280
bellard1f673132004-04-04 15:21:17 +00001281@item Ensure that you have a working QEMU with the x86 glibc
1282distribution (see previous section). In order to verify it, you must be
1283able to do:
bellard386405f2003-03-23 21:28:45 +00001284
bellard1f673132004-04-04 15:21:17 +00001285@example
1286qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1287@end example
bellard386405f2003-03-23 21:28:45 +00001288
bellard1f673132004-04-04 15:21:17 +00001289@item Download the binary x86 Wine install
1290(@file{qemu-XXX-i386-wine.tar.gz} on the QEMU web page).
bellard386405f2003-03-23 21:28:45 +00001291
bellard1f673132004-04-04 15:21:17 +00001292@item Configure Wine on your account. Look at the provided script
1293@file{/usr/local/qemu-i386/bin/wine-conf.sh}. Your previous
1294@code{$@{HOME@}/.wine} directory is saved to @code{$@{HOME@}/.wine.org}.
bellard386405f2003-03-23 21:28:45 +00001295
bellard1f673132004-04-04 15:21:17 +00001296@item Then you can try the example @file{putty.exe}:
bellard386405f2003-03-23 21:28:45 +00001297
bellard1f673132004-04-04 15:21:17 +00001298@example
1299qemu-i386 /usr/local/qemu-i386/wine/bin/wine /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1300@end example
bellard386405f2003-03-23 21:28:45 +00001301
bellard1f673132004-04-04 15:21:17 +00001302@end itemize
bellard386405f2003-03-23 21:28:45 +00001303
bellard1f673132004-04-04 15:21:17 +00001304@section Command line options
bellard386405f2003-03-23 21:28:45 +00001305
bellard1f673132004-04-04 15:21:17 +00001306@example
1307usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1308@end example
bellard386405f2003-03-23 21:28:45 +00001309
bellard1f673132004-04-04 15:21:17 +00001310@table @option
1311@item -h
1312Print the help
1313@item -L path
1314Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1315@item -s size
1316Set the x86 stack size in bytes (default=524288)
bellard386405f2003-03-23 21:28:45 +00001317@end table
1318
bellard1f673132004-04-04 15:21:17 +00001319Debug options:
bellard386405f2003-03-23 21:28:45 +00001320
bellard1f673132004-04-04 15:21:17 +00001321@table @option
1322@item -d
1323Activate log (logfile=/tmp/qemu.log)
1324@item -p pagesize
1325Act as if the host page size was 'pagesize' bytes
1326@end table
bellard386405f2003-03-23 21:28:45 +00001327
bellard15a34c62004-07-08 21:26:26 +00001328@node compilation
1329@chapter Compilation from the sources
1330
bellard7c3fc842005-02-10 21:46:47 +00001331@section Linux/Unix
bellard15a34c62004-07-08 21:26:26 +00001332
bellard7c3fc842005-02-10 21:46:47 +00001333@subsection Compilation
1334
1335First you must decompress the sources:
1336@example
1337cd /tmp
1338tar zxvf qemu-x.y.z.tar.gz
1339cd qemu-x.y.z
1340@end example
1341
1342Then you configure QEMU and build it (usually no options are needed):
1343@example
1344./configure
1345make
1346@end example
1347
1348Then type as root user:
1349@example
1350make install
1351@end example
1352to install QEMU in @file{/usr/local}.
1353
bellard7c3fc842005-02-10 21:46:47 +00001354@subsection Tested tool versions
1355
1356In order to compile QEMU succesfully, it is very important that you
1357have the right tools. The most important one is gcc. I cannot guaranty
1358that QEMU works if you do not use a tested gcc version. Look at
1359'configure' and 'Makefile' if you want to make a different gcc
1360version work.
1361
1362@example
1363host gcc binutils glibc linux distribution
1364----------------------------------------------------------------------
1365x86 3.2 2.13.2 2.1.3 2.4.18
1366 2.96 2.11.93.0.2 2.2.5 2.4.18 Red Hat 7.3
1367 3.2.2 2.13.90.0.18 2.3.2 2.4.20 Red Hat 9
1368
1369PowerPC 3.3 [4] 2.13.90.0.18 2.3.1 2.4.20briq
1370 3.2
1371
1372Alpha 3.3 [1] 2.14.90.0.4 2.2.5 2.2.20 [2] Debian 3.0
1373
1374Sparc32 2.95.4 2.12.90.0.1 2.2.5 2.4.18 Debian 3.0
1375
1376ARM 2.95.4 2.12.90.0.1 2.2.5 2.4.9 [3] Debian 3.0
1377
1378[1] On Alpha, QEMU needs the gcc 'visibility' attribute only available
1379 for gcc version >= 3.3.
1380[2] Linux >= 2.4.20 is necessary for precise exception support
1381 (untested).
1382[3] 2.4.9-ac10-rmk2-np1-cerf2
1383
1384[4] gcc 2.95.x generates invalid code when using too many register
1385variables. You must use gcc 3.x on PowerPC.
1386@end example
bellard15a34c62004-07-08 21:26:26 +00001387
1388@section Windows
1389
1390@itemize
1391@item Install the current versions of MSYS and MinGW from
1392@url{http://www.mingw.org/}. You can find detailed installation
1393instructions in the download section and the FAQ.
1394
1395@item Download
1396the MinGW development library of SDL 1.2.x
1397(@file{SDL-devel-1.2.x-mingw32.tar.gz}) from
1398@url{http://www.libsdl.org}. Unpack it in a temporary place, and
1399unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
1400directory. Edit the @file{sdl-config} script so that it gives the
1401correct SDL directory when invoked.
1402
1403@item Extract the current version of QEMU.
1404
1405@item Start the MSYS shell (file @file{msys.bat}).
1406
1407@item Change to the QEMU directory. Launch @file{./configure} and
1408@file{make}. If you have problems using SDL, verify that
1409@file{sdl-config} can be launched from the MSYS command line.
1410
1411@item You can install QEMU in @file{Program Files/Qemu} by typing
1412@file{make install}. Don't forget to copy @file{SDL.dll} in
1413@file{Program Files/Qemu}.
1414
1415@end itemize
1416
1417@section Cross compilation for Windows with Linux
1418
1419@itemize
1420@item
1421Install the MinGW cross compilation tools available at
1422@url{http://www.mingw.org/}.
1423
1424@item
1425Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
1426unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
1427variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
1428the QEMU configuration script.
1429
1430@item
1431Configure QEMU for Windows cross compilation:
1432@example
1433./configure --enable-mingw32
1434@end example
1435If necessary, you can change the cross-prefix according to the prefix
1436choosen for the MinGW tools with --cross-prefix. You can also use
1437--prefix to set the Win32 install path.
1438
1439@item You can install QEMU in the installation directory by typing
1440@file{make install}. Don't forget to copy @file{SDL.dll} in the
1441installation directory.
1442
1443@end itemize
1444
1445Note: Currently, Wine does not seem able to launch
1446QEMU for Win32.
1447
1448@section Mac OS X
1449
1450The Mac OS X patches are not fully merged in QEMU, so you should look
1451at the QEMU mailing list archive to have all the necessary
1452information.
1453