3 <!-- Created by texi2html 1.56k from qemu-doc.texi on 24 July 2005 -->
5 <TITLE>QEMU CPU Emulator User Documentation</TITLE>
8 <H1>QEMU CPU Emulator User Documentation</H1>
11 <H1>Table of Contents</H1>
13 <LI><A NAME="TOC1" HREF="qemu-doc.html#SEC1">1. Introduction</A>
15 <LI><A NAME="TOC2" HREF="qemu-doc.html#SEC2">1.1 Features</A>
17 <LI><A NAME="TOC3" HREF="qemu-doc.html#SEC3">2. Installation</A>
19 <LI><A NAME="TOC4" HREF="qemu-doc.html#SEC4">2.1 Linux</A>
20 <LI><A NAME="TOC5" HREF="qemu-doc.html#SEC5">2.2 Windows</A>
21 <LI><A NAME="TOC6" HREF="qemu-doc.html#SEC6">2.3 Mac OS X</A>
23 <LI><A NAME="TOC7" HREF="qemu-doc.html#SEC7">3. QEMU PC System emulator invocation</A>
25 <LI><A NAME="TOC8" HREF="qemu-doc.html#SEC8">3.1 Introduction</A>
26 <LI><A NAME="TOC9" HREF="qemu-doc.html#SEC9">3.2 Quick Start</A>
27 <LI><A NAME="TOC10" HREF="qemu-doc.html#SEC10">3.3 Invocation</A>
28 <LI><A NAME="TOC11" HREF="qemu-doc.html#SEC11">3.4 Keys</A>
29 <LI><A NAME="TOC12" HREF="qemu-doc.html#SEC12">3.5 QEMU Monitor</A>
31 <LI><A NAME="TOC13" HREF="qemu-doc.html#SEC13">3.5.1 Commands</A>
32 <LI><A NAME="TOC14" HREF="qemu-doc.html#SEC14">3.5.2 Integer expressions</A>
34 <LI><A NAME="TOC15" HREF="qemu-doc.html#SEC15">3.6 Disk Images</A>
36 <LI><A NAME="TOC16" HREF="qemu-doc.html#SEC16">3.6.1 Quick start for disk image creation</A>
37 <LI><A NAME="TOC17" HREF="qemu-doc.html#SEC17">3.6.2 Snapshot mode</A>
38 <LI><A NAME="TOC18" HREF="qemu-doc.html#SEC18">3.6.3 <CODE>qemu-img</CODE> Invocation</A>
40 <LI><A NAME="TOC19" HREF="qemu-doc.html#SEC19">3.7 Network emulation</A>
42 <LI><A NAME="TOC20" HREF="qemu-doc.html#SEC20">3.7.1 Using tun/tap network interface</A>
43 <LI><A NAME="TOC21" HREF="qemu-doc.html#SEC21">3.7.2 Using the user mode network stack</A>
45 <LI><A NAME="TOC22" HREF="qemu-doc.html#SEC22">3.8 Direct Linux Boot</A>
46 <LI><A NAME="TOC23" HREF="qemu-doc.html#SEC23">3.9 GDB usage</A>
47 <LI><A NAME="TOC24" HREF="qemu-doc.html#SEC24">3.10 Target OS specific information</A>
49 <LI><A NAME="TOC25" HREF="qemu-doc.html#SEC25">3.10.1 Linux</A>
50 <LI><A NAME="TOC26" HREF="qemu-doc.html#SEC26">3.10.2 Windows</A>
52 <LI><A NAME="TOC27" HREF="qemu-doc.html#SEC27">3.10.2.1 SVGA graphic modes support</A>
53 <LI><A NAME="TOC28" HREF="qemu-doc.html#SEC28">3.10.2.2 CPU usage reduction</A>
54 <LI><A NAME="TOC29" HREF="qemu-doc.html#SEC29">3.10.2.3 Windows 2000 disk full problem</A>
55 <LI><A NAME="TOC30" HREF="qemu-doc.html#SEC30">3.10.2.4 Windows XP security problems</A>
57 <LI><A NAME="TOC31" HREF="qemu-doc.html#SEC31">3.10.3 MS-DOS and FreeDOS</A>
59 <LI><A NAME="TOC32" HREF="qemu-doc.html#SEC32">3.10.3.1 CPU usage reduction</A>
63 <LI><A NAME="TOC33" HREF="qemu-doc.html#SEC33">4. QEMU PowerPC System emulator invocation</A>
64 <LI><A NAME="TOC34" HREF="qemu-doc.html#SEC34">5. Sparc32 System emulator invocation</A>
65 <LI><A NAME="TOC35" HREF="qemu-doc.html#SEC35">6. Sparc64 System emulator invocation</A>
66 <LI><A NAME="TOC36" HREF="qemu-doc.html#SEC36">7. MIPS System emulator invocation</A>
67 <LI><A NAME="TOC37" HREF="qemu-doc.html#SEC37">8. QEMU User space emulator invocation</A>
69 <LI><A NAME="TOC38" HREF="qemu-doc.html#SEC38">8.1 Quick Start</A>
70 <LI><A NAME="TOC39" HREF="qemu-doc.html#SEC39">8.2 Wine launch</A>
71 <LI><A NAME="TOC40" HREF="qemu-doc.html#SEC40">8.3 Command line options</A>
73 <LI><A NAME="TOC41" HREF="qemu-doc.html#SEC41">9. Compilation from the sources</A>
75 <LI><A NAME="TOC42" HREF="qemu-doc.html#SEC42">9.1 Linux/Unix</A>
77 <LI><A NAME="TOC43" HREF="qemu-doc.html#SEC43">9.1.1 Compilation</A>
78 <LI><A NAME="TOC44" HREF="qemu-doc.html#SEC44">9.1.2 Tested tool versions</A>
80 <LI><A NAME="TOC45" HREF="qemu-doc.html#SEC45">9.2 Windows</A>
81 <LI><A NAME="TOC46" HREF="qemu-doc.html#SEC46">9.3 Cross compilation for Windows with Linux</A>
82 <LI><A NAME="TOC47" HREF="qemu-doc.html#SEC47">9.4 Mac OS X</A>
88 QEMU CPU Emulator User Documentation
93 <H1><A NAME="SEC1" HREF="qemu-doc.html#TOC1">1. Introduction</A></H1>
97 <H2><A NAME="SEC2" HREF="qemu-doc.html#TOC2">1.1 Features</A></H2>
100 QEMU is a FAST! processor emulator using dynamic translation to
101 achieve good emulation speed.
105 QEMU has two operating modes:
113 Full system emulation. In this mode, QEMU emulates a full system (for
114 example a PC), including a processor and various peripherals. It can
115 be used to launch different Operating Systems without rebooting the
116 PC or to debug system code.
120 User mode emulation (Linux host only). In this mode, QEMU can launch
121 Linux processes compiled for one CPU on another CPU. It can be used to
122 launch the Wine Windows API emulator (<A HREF="http://www.winehq.org">http://www.winehq.org</A>) or
123 to ease cross-compilation and cross-debugging.
128 QEMU can run without an host kernel driver and yet gives acceptable
133 For system emulation, the following hardware targets are supported:
136 <LI>PC (x86 or x86_64 processor)
138 <LI>PREP (PowerPC processor)
140 <LI>G3 BW PowerMac (PowerPC processor)
142 <LI>Mac99 PowerMac (PowerPC processor, in progress)
144 <LI>Sun4m (32-bit Sparc processor)
146 <LI>Sun4u (64-bit Sparc processor, in progress)
148 <LI>Malta board (32-bit MIPS processor, in progress)
153 For user emulation, x86, PowerPC, ARM, and Sparc32/64 CPUs are supported.
158 <H1><A NAME="SEC3" HREF="qemu-doc.html#TOC3">2. Installation</A></H1>
161 If you want to compile QEMU yourself, see section <A HREF="qemu-doc.html#SEC41">9. Compilation from the sources</A>.
166 <H2><A NAME="SEC4" HREF="qemu-doc.html#TOC4">2.1 Linux</A></H2>
169 If a precompiled package is available for your distribution - you just
170 have to install it. Otherwise, see section <A HREF="qemu-doc.html#SEC41">9. Compilation from the sources</A>.
175 <H2><A NAME="SEC5" HREF="qemu-doc.html#TOC5">2.2 Windows</A></H2>
178 Download the experimental binary installer at
179 <A HREF="http://www.freeoszoo.org/download.php">http://www.freeoszoo.org/download.php</A>.
184 <H2><A NAME="SEC6" HREF="qemu-doc.html#TOC6">2.3 Mac OS X</A></H2>
187 Download the experimental binary installer at
188 <A HREF="http://www.freeoszoo.org/download.php">http://www.freeoszoo.org/download.php</A>.
193 <H1><A NAME="SEC7" HREF="qemu-doc.html#TOC7">3. QEMU PC System emulator invocation</A></H1>
197 <H2><A NAME="SEC8" HREF="qemu-doc.html#TOC8">3.1 Introduction</A></H2>
200 The QEMU System emulator simulates the
201 following PC peripherals:
208 i440FX host PCI bridge and PIIX3 PCI to ISA bridge
211 Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA
212 extensions (hardware level, including all non standard modes).
215 PS/2 mouse and keyboard
218 2 PCI IDE interfaces with hard disk and CD-ROM support
224 NE2000 PCI network adapters
234 QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
240 <H2><A NAME="SEC9" HREF="qemu-doc.html#TOC9">3.2 Quick Start</A></H2>
243 Download and uncompress the linux image (<TT>`linux.img'</TT>) and type:
252 Linux should boot and give you a prompt.
257 <H2><A NAME="SEC10" HREF="qemu-doc.html#TOC10">3.3 Invocation</A></H2>
261 usage: qemu [options] [disk_image]
265 <VAR>disk_image</VAR> is a raw hard disk image for IDE hard disk 0.
272 <DT><SAMP>`-fda file'</SAMP>
274 <DT><SAMP>`-fdb file'</SAMP>
276 Use <VAR>file</VAR> as floppy disk 0/1 image (See section <A HREF="qemu-doc.html#SEC15">3.6 Disk Images</A>). You can
277 use the host floppy by using <TT>`/dev/fd0'</TT> as filename.
279 <DT><SAMP>`-hda file'</SAMP>
281 <DT><SAMP>`-hdb file'</SAMP>
283 <DT><SAMP>`-hdc file'</SAMP>
285 <DT><SAMP>`-hdd file'</SAMP>
287 Use <VAR>file</VAR> as hard disk 0, 1, 2 or 3 image (See section <A HREF="qemu-doc.html#SEC15">3.6 Disk Images</A>).
289 <DT><SAMP>`-cdrom file'</SAMP>
291 Use <VAR>file</VAR> as CD-ROM image (you cannot use <SAMP>`-hdc'</SAMP> and and
292 <SAMP>`-cdrom'</SAMP> at the same time). You can use the host CD-ROM by
293 using <TT>`/dev/cdrom'</TT> as filename.
295 <DT><SAMP>`-boot [a|c|d]'</SAMP>
297 Boot on floppy (a), hard disk (c) or CD-ROM (d). Hard disk boot is
300 <DT><SAMP>`-snapshot'</SAMP>
302 Write to temporary files instead of disk image files. In this case,
303 the raw disk image you use is not written back. You can however force
304 the write back by pressing <KBD>C-a s</KBD> (See section <A HREF="qemu-doc.html#SEC15">3.6 Disk Images</A>).
306 <DT><SAMP>`-m megs'</SAMP>
308 Set virtual RAM size to <VAR>megs</VAR> megabytes. Default is 128 MB.
310 <DT><SAMP>`-nographic'</SAMP>
312 Normally, QEMU uses SDL to display the VGA output. With this option,
313 you can totally disable graphical output so that QEMU is a simple
314 command line application. The emulated serial port is redirected on
315 the console. Therefore, you can still use QEMU to debug a Linux kernel
316 with a serial console.
318 <DT><SAMP>`-k language'</SAMP>
320 Use keyboard layout <VAR>language</VAR> (for example <CODE>fr</CODE> for
321 French). This option is only needed where it is not easy to get raw PC
322 keycodes (e.g. on Macs or with some X11 servers). You don't need to
323 use it on PC/Linux or PC/Windows hosts.
325 The available layouts are:
328 ar de-ch es fo fr-ca hu ja mk no pt-br sv
329 da en-gb et fr fr-ch is lt nl pl ru th
330 de en-us fi fr-be hr it lv nl-be pt sl tr
333 The default is <CODE>en-us</CODE>.
335 <DT><SAMP>`-enable-audio'</SAMP>
337 The SB16 emulation is disabled by default as it may give problems with
338 Windows. You can enable it manually with this option.
340 <DT><SAMP>`-localtime'</SAMP>
342 Set the real time clock to local time (the default is to UTC
343 time). This option is needed to have correct date in MS-DOS or
346 <DT><SAMP>`-full-screen'</SAMP>
348 Start in full screen.
350 <DT><SAMP>`-pidfile file'</SAMP>
352 Store the QEMU process PID in <VAR>file</VAR>. It is useful if you launch QEMU
355 <DT><SAMP>`-win2k-hack'</SAMP>
357 Use it when installing Windows 2000 to avoid a disk full bug. After
358 Windows 2000 is installed, you no longer need this option (this option
359 slows down the IDE transfers).
369 <DT><SAMP>`-n script'</SAMP>
371 Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script
372 is launched to configure the host network interface (usually tun0)
373 corresponding to the virtual NE2000 card.
375 <DT><SAMP>`-nics n'</SAMP>
377 Simulate <VAR>n</VAR> network cards (the default is 1).
379 <DT><SAMP>`-macaddr addr'</SAMP>
381 Set the mac address of the first interface (the format is
382 aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each
383 new network interface.
385 <DT><SAMP>`-tun-fd fd'</SAMP>
387 Assumes <VAR>fd</VAR> talks to a tap/tun host network interface and use
388 it. Read <A HREF="http://bellard.org/qemu/tetrinet.html">http://bellard.org/qemu/tetrinet.html</A> to have an
391 <DT><SAMP>`-user-net'</SAMP>
393 Use the user mode network stack. This is the default if no tun/tap
394 network init script is found.
396 <DT><SAMP>`-tftp prefix'</SAMP>
398 When using the user mode network stack, activate a built-in TFTP
399 server. All filenames beginning with <VAR>prefix</VAR> can be downloaded
400 from the host to the guest using a TFTP client. The TFTP client on the
401 guest must be configured in binary mode (use the command <CODE>bin</CODE> of
402 the Unix TFTP client). The host IP address on the guest is as usual
405 <DT><SAMP>`-smb dir'</SAMP>
407 When using the user mode network stack, activate a built-in SMB
408 server so that Windows OSes can access to the host files in <TT>`dir'</TT>
411 In the guest Windows OS, the line:
417 must be added in the file <TT>`C:\WINDOWS\LMHOSTS'</TT> (for windows 9x/Me)
418 or <TT>`C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS'</TT> (Windows NT/2000).
420 Then <TT>`dir'</TT> can be accessed in <TT>`\\smbserver\qemu'</TT>.
422 Note that a SAMBA server must be installed on the host OS in
423 <TT>`/usr/sbin/smbd'</TT>. QEMU was tested succesfully with smbd version
424 2.2.7a from the Red Hat 9.
426 <DT><SAMP>`-redir [tcp|udp]:host-port:[guest-host]:guest-port'</SAMP>
428 When using the user mode network stack, redirect incoming TCP or UDP
429 connections to the host port <VAR>host-port</VAR> to the guest
430 <VAR>guest-host</VAR> on guest port <VAR>guest-port</VAR>. If <VAR>guest-host</VAR>
431 is not specified, its value is 10.0.2.15 (default address given by the
432 built-in DHCP server).
434 For example, to redirect host X11 connection from screen 1 to guest
435 screen 0, use the following:
440 qemu -redir tcp:6001::6000 [...]
441 # this host xterm should open in the guest X11 server
445 To redirect telnet connections from host port 5555 to telnet port on
446 the guest, use the following:
451 qemu -redir tcp:5555::23 [...]
452 telnet localhost 5555
455 Then when you use on the host <CODE>telnet localhost 5555</CODE>, you
456 connect to the guest telnet server.
458 <DT><SAMP>`-dummy-net'</SAMP>
460 Use the dummy network stack: no packet will be received by the network
466 Linux boot specific. When using this options, you can use a given
467 Linux kernel without installing it in the disk image. It can be useful
468 for easier testing of various kernels.
473 <DT><SAMP>`-kernel bzImage'</SAMP>
475 Use <VAR>bzImage</VAR> as kernel image.
477 <DT><SAMP>`-append cmdline'</SAMP>
479 Use <VAR>cmdline</VAR> as kernel command line
481 <DT><SAMP>`-initrd file'</SAMP>
483 Use <VAR>file</VAR> as initial ram disk.
488 Debug/Expert options:
491 <DT><SAMP>`-serial dev'</SAMP>
493 Redirect the virtual serial port to host device <VAR>dev</VAR>. Available
502 [Linux only] Pseudo TTY (a new PTY is automatically allocated)
503 <DT><CODE>null</CODE>
506 <DT><CODE>stdio</CODE>
508 [Unix only] standard input/output
510 The default device is <CODE>vc</CODE> in graphical mode and <CODE>stdio</CODE> in
513 This option can be used several times to simulate up to 4 serials
516 <DT><SAMP>`-monitor dev'</SAMP>
518 Redirect the monitor to host device <VAR>dev</VAR> (same devices as the
520 The default device is <CODE>vc</CODE> in graphical mode and <CODE>stdio</CODE> in
523 <DT><SAMP>`-s'</SAMP>
525 Wait gdb connection to port 1234 (See section <A HREF="qemu-doc.html#SEC23">3.9 GDB usage</A>).
526 <DT><SAMP>`-p port'</SAMP>
528 Change gdb connection port.
529 <DT><SAMP>`-S'</SAMP>
531 Do not start CPU at startup (you must type 'c' in the monitor).
532 <DT><SAMP>`-d'</SAMP>
534 Output log in /tmp/qemu.log
535 <DT><SAMP>`-hdachs c,h,s,[,t]'</SAMP>
537 Force hard disk 0 physical geometry (1 <= <VAR>c</VAR> <= 16383, 1 <=
538 <VAR>h</VAR> <= 16, 1 <= <VAR>s</VAR> <= 63) and optionally force the BIOS
539 translation mode (<VAR>t</VAR>=none, lba or auto). Usually QEMU can guess
540 all thoses parameters. This option is useful for old MS-DOS disk
543 <DT><SAMP>`-isa'</SAMP>
545 Simulate an ISA-only system (default is PCI system).
546 <DT><SAMP>`-std-vga'</SAMP>
548 Simulate a standard VGA card with Bochs VBE extensions (default is
549 Cirrus Logic GD5446 PCI VGA)
550 <DT><SAMP>`-loadvm file'</SAMP>
552 Start right away with a saved state (<CODE>loadvm</CODE> in monitor)
557 <H2><A NAME="SEC11" HREF="qemu-doc.html#TOC11">3.4 Keys</A></H2>
560 During the graphical emulation, you can use the following keys:
563 <DT><KBD>Ctrl-Alt-f</KBD>
567 <DT><KBD>Ctrl-Alt-n</KBD>
569 Switch to virtual console 'n'. Standard console mappings are:
574 Target system display
583 <DT><KBD>Ctrl-Alt</KBD>
585 Toggle mouse and keyboard grab.
589 In the virtual consoles, you can use <KBD>Ctrl-Up</KBD>, <KBD>Ctrl-Down</KBD>,
590 <KBD>Ctrl-PageUp</KBD> and <KBD>Ctrl-PageDown</KBD> to move in the back log.
594 During emulation, if you are using the <SAMP>`-nographic'</SAMP> option, use
595 <KBD>Ctrl-a h</KBD> to get terminal commands:
600 <DT><KBD>Ctrl-a h</KBD>
603 <DT><KBD>Ctrl-a x</KBD>
606 <DT><KBD>Ctrl-a s</KBD>
608 Save disk data back to file (if -snapshot)
609 <DT><KBD>Ctrl-a b</KBD>
611 Send break (magic sysrq in Linux)
612 <DT><KBD>Ctrl-a c</KBD>
614 Switch between console and monitor
615 <DT><KBD>Ctrl-a Ctrl-a</KBD>
622 <H2><A NAME="SEC12" HREF="qemu-doc.html#TOC12">3.5 QEMU Monitor</A></H2>
625 The QEMU monitor is used to give complex commands to the QEMU
626 emulator. You can use it to:
634 Remove or insert removable medias images
635 (such as CD-ROM or floppies)
639 Freeze/unfreeze the Virtual Machine (VM) and save or restore its state
642 <LI>Inspect the VM state without an external debugger.
648 <H3><A NAME="SEC13" HREF="qemu-doc.html#TOC13">3.5.1 Commands</A></H3>
651 The following commands are available:
656 <DT><SAMP>`help or ? [cmd]'</SAMP>
658 Show the help for all commands or just for command <VAR>cmd</VAR>.
660 <DT><SAMP>`commit'</SAMP>
662 Commit changes to the disk images (if -snapshot is used)
664 <DT><SAMP>`info subcommand'</SAMP>
666 show various information about the system state
670 <DT><SAMP>`info network'</SAMP>
672 show the network state
673 <DT><SAMP>`info block'</SAMP>
675 show the block devices
676 <DT><SAMP>`info registers'</SAMP>
678 show the cpu registers
679 <DT><SAMP>`info history'</SAMP>
681 show the command line history
684 <DT><SAMP>`q or quit'</SAMP>
688 <DT><SAMP>`eject [-f] device'</SAMP>
690 Eject a removable media (use -f to force it).
692 <DT><SAMP>`change device filename'</SAMP>
694 Change a removable media.
696 <DT><SAMP>`screendump filename'</SAMP>
698 Save screen into PPM image <VAR>filename</VAR>.
700 <DT><SAMP>`log item1[,...]'</SAMP>
702 Activate logging of the specified items to <TT>`/tmp/qemu.log'</TT>.
704 <DT><SAMP>`savevm filename'</SAMP>
706 Save the whole virtual machine state to <VAR>filename</VAR>.
708 <DT><SAMP>`loadvm filename'</SAMP>
710 Restore the whole virtual machine state from <VAR>filename</VAR>.
712 <DT><SAMP>`stop'</SAMP>
716 <DT><SAMP>`c or cont'</SAMP>
720 <DT><SAMP>`gdbserver [port]'</SAMP>
722 Start gdbserver session (default port=1234)
724 <DT><SAMP>`x/fmt addr'</SAMP>
726 Virtual memory dump starting at <VAR>addr</VAR>.
728 <DT><SAMP>`xp /fmt addr'</SAMP>
730 Physical memory dump starting at <VAR>addr</VAR>.
732 <VAR>fmt</VAR> is a format which tells the command how to format the
733 data. Its syntax is: <SAMP>`/{count}{format}{size}'</SAMP>
739 is the number of items to be dumped.
741 <DT><VAR>format</VAR>
743 can be x (hexa), d (signed decimal), u (unsigned decimal), o (octal),
744 c (char) or i (asm instruction).
748 can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits). On x86,
749 <CODE>h</CODE> or <CODE>w</CODE> can be specified with the <CODE>i</CODE> format to
750 respectively select 16 or 32 bit code instruction size.
759 Dump 10 instructions at the current instruction pointer:
765 0x90107065: lea 0x0(%esi,1),%esi
766 0x90107069: lea 0x0(%edi,1),%edi
768 0x90107071: jmp 0x90107080
777 Dump 80 16 bit values at the start of the video memory.
780 (qemu) xp/80hx 0xb8000
781 0x000b8000: 0x0b50 0x0b6c 0x0b65 0x0b78 0x0b38 0x0b36 0x0b2f 0x0b42
782 0x000b8010: 0x0b6f 0x0b63 0x0b68 0x0b73 0x0b20 0x0b56 0x0b47 0x0b41
783 0x000b8020: 0x0b42 0x0b69 0x0b6f 0x0b73 0x0b20 0x0b63 0x0b75 0x0b72
784 0x000b8030: 0x0b72 0x0b65 0x0b6e 0x0b74 0x0b2d 0x0b63 0x0b76 0x0b73
785 0x000b8040: 0x0b20 0x0b30 0x0b35 0x0b20 0x0b4e 0x0b6f 0x0b76 0x0b20
786 0x000b8050: 0x0b32 0x0b30 0x0b30 0x0b33 0x0720 0x0720 0x0720 0x0720
787 0x000b8060: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
788 0x000b8070: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
789 0x000b8080: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
790 0x000b8090: 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720 0x0720
795 <DT><SAMP>`p or print/fmt expr'</SAMP>
797 Print expression value. Only the <VAR>format</VAR> part of <VAR>fmt</VAR> is
800 <DT><SAMP>`sendkey keys'</SAMP>
802 Send <VAR>keys</VAR> to the emulator. Use <CODE>-</CODE> to press several keys
803 simultaneously. Example:
809 This command is useful to send keys that your graphical user interface
810 intercepts at low level, such as <CODE>ctrl-alt-f1</CODE> in X Window.
812 <DT><SAMP>`system_reset'</SAMP>
820 <H3><A NAME="SEC14" HREF="qemu-doc.html#TOC14">3.5.2 Integer expressions</A></H3>
823 The monitor understands integers expressions for every integer
824 argument. You can use register names to get the value of specifics
825 CPU registers by prefixing them with <EM>$</EM>.
830 <H2><A NAME="SEC15" HREF="qemu-doc.html#TOC15">3.6 Disk Images</A></H2>
833 Since version 0.6.1, QEMU supports many disk image formats, including
834 growable disk images (their size increase as non empty sectors are
835 written), compressed and encrypted disk images.
840 <H3><A NAME="SEC16" HREF="qemu-doc.html#TOC16">3.6.1 Quick start for disk image creation</A></H3>
843 You can create a disk image with the command:
846 qemu-img create myimage.img mysize
850 where <VAR>myimage.img</VAR> is the disk image filename and <VAR>mysize</VAR> is its
851 size in kilobytes. You can add an <CODE>M</CODE> suffix to give the size in
852 megabytes and a <CODE>G</CODE> suffix for gigabytes.
856 See section <A HREF="qemu-doc.html#SEC18">3.6.3 <CODE>qemu-img</CODE> Invocation</A> for more information.
861 <H3><A NAME="SEC17" HREF="qemu-doc.html#TOC17">3.6.2 Snapshot mode</A></H3>
864 If you use the option <SAMP>`-snapshot'</SAMP>, all disk images are
865 considered as read only. When sectors in written, they are written in
866 a temporary file created in <TT>`/tmp'</TT>. You can however force the
867 write back to the raw disk images by using the <CODE>commit</CODE> monitor
868 command (or <KBD>C-a s</KBD> in the serial console).
873 <H3><A NAME="SEC18" HREF="qemu-doc.html#TOC18">3.6.3 <CODE>qemu-img</CODE> Invocation</A></H3>
877 usage: qemu-img command [command options]
881 The following commands are supported:
884 <DT><SAMP>`create [-e] [-b <VAR>base_image</VAR>] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [<VAR>size</VAR>]'</SAMP>
886 <DT><SAMP>`commit [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP>
888 <DT><SAMP>`convert [-c] [-e] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [-O <VAR>output_fmt</VAR>] <VAR>output_filename</VAR>'</SAMP>
890 <DT><SAMP>`info [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP>
898 <DT><VAR>filename</VAR>
900 is a disk image filename
901 <DT><VAR>base_image</VAR>
903 is the read-only disk image which is used as base for a copy on
904 write image; the copy on write image only stores the modified data
908 is the disk image format. It is guessed automatically in most cases. The following formats are supported:
914 Raw disk image format (default). This format has the advantage of
915 being simple and easily exportable to all other emulators. If your file
916 system supports <EM>holes</EM> (for example in ext2 or ext3 on Linux),
917 then only the written sectors will reserve space. Use <CODE>qemu-img
918 info</CODE> to know the real size used by the image or <CODE>ls -ls</CODE> on
921 <DT><CODE>qcow</CODE>
923 QEMU image format, the most versatile format. Use it to have smaller
924 images (useful if your filesystem does not supports holes, for example
925 on Windows), optional AES encryption and zlib based compression.
928 User Mode Linux Copy On Write image format. Used to be the only growable
929 image format in QEMU. It is supported only for compatibility with
930 previous versions. It does not work on win32.
931 <DT><CODE>vmdk</CODE>
933 VMware 3 and 4 compatible image format.
934 <DT><CODE>cloop</CODE>
936 Linux Compressed Loop image, useful only to reuse directly compressed
937 CD-ROM images present for example in the Knoppix CD-ROMs.
942 is the disk image size in kilobytes. Optional suffixes <CODE>M</CODE>
943 (megabyte) and <CODE>G</CODE> (gigabyte) are supported
945 <DT><VAR>output_filename</VAR>
947 is the destination disk image filename
949 <DT><VAR>output_fmt</VAR>
951 is the destination format
955 indicates that target image must be compressed (qcow format only)
958 indicates that the target image must be encrypted (qcow format only)
967 <DT><SAMP>`create [-e] [-b <VAR>base_image</VAR>] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [<VAR>size</VAR>]'</SAMP>
969 Create the new disk image <VAR>filename</VAR> of size <VAR>size</VAR> and format
972 If <VAR>base_image</VAR> is specified, then the image will record only the
973 differences from <VAR>base_image</VAR>. No size needs to be specified in
974 this case. <VAR>base_image</VAR> will never be modified unless you use the
975 <CODE>commit</CODE> monitor command.
977 <DT><SAMP>`commit [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP>
979 Commit the changes recorded in <VAR>filename</VAR> in its base image.
981 <DT><SAMP>`convert [-c] [-e] [-f <VAR>fmt</VAR>] <VAR>filename</VAR> [-O <VAR>output_fmt</VAR>] <VAR>output_filename</VAR>'</SAMP>
983 Convert the disk image <VAR>filename</VAR> to disk image <VAR>output_filename</VAR>
984 using format <VAR>output_fmt</VAR>. It can be optionnaly encrypted
985 (<CODE>-e</CODE> option) or compressed (<CODE>-c</CODE> option).
987 Only the format <CODE>qcow</CODE> supports encryption or compression. The
988 compression is read-only. It means that if a compressed sector is
989 rewritten, then it is rewritten as uncompressed data.
991 Encryption uses the AES format which is very secure (128 bit keys). Use
992 a long password (16 characters) to get maximum protection.
994 Image conversion is also useful to get smaller image when using a
995 growable format such as <CODE>qcow</CODE> or <CODE>cow</CODE>: the empty sectors
996 are detected and suppressed from the destination image.
998 <DT><SAMP>`info [-f <VAR>fmt</VAR>] <VAR>filename</VAR>'</SAMP>
1000 Give information about the disk image <VAR>filename</VAR>. Use it in
1001 particular to know the size reserved on disk which can be different
1002 from the displayed size.
1007 <H2><A NAME="SEC19" HREF="qemu-doc.html#TOC19">3.7 Network emulation</A></H2>
1010 QEMU simulates up to 6 networks cards (NE2000 boards). Each card can
1011 be connected to a specific host network interface.
1016 <H3><A NAME="SEC20" HREF="qemu-doc.html#TOC20">3.7.1 Using tun/tap network interface</A></H3>
1019 This is the standard way to emulate network. QEMU adds a virtual
1020 network device on your host (called <CODE>tun0</CODE>), and you can then
1021 configure it as if it was a real ethernet card.
1025 As an example, you can download the <TT>`linux-test-xxx.tar.gz'</TT>
1026 archive and copy the script <TT>`qemu-ifup'</TT> in <TT>`/etc'</TT> and
1027 configure properly <CODE>sudo</CODE> so that the command <CODE>ifconfig</CODE>
1028 contained in <TT>`qemu-ifup'</TT> can be executed as root. You must verify
1029 that your host kernel supports the TUN/TAP network interfaces: the
1030 device <TT>`/dev/net/tun'</TT> must be present.
1034 See section <A HREF="qemu-doc.html#SEC22">3.8 Direct Linux Boot</A> to have an example of network use with a
1040 <H3><A NAME="SEC21" HREF="qemu-doc.html#TOC21">3.7.2 Using the user mode network stack</A></H3>
1043 By using the option <SAMP>`-user-net'</SAMP> or if you have no tun/tap init
1044 script, QEMU uses a completely user mode network stack (you don't need
1045 root priviledge to use the virtual network). The virtual network
1046 configuration is the following:
1052 QEMU Virtual Machine <------> Firewall/DHCP server <-----> Internet
1053 (10.0.2.x) | (10.0.2.2)
1055 ----> DNS server (10.0.2.3)
1057 ----> SMB server (10.0.2.4)
1061 The QEMU VM behaves as if it was behind a firewall which blocks all
1062 incoming connections. You can use a DHCP client to automatically
1063 configure the network in the QEMU VM.
1067 In order to check that the user mode network is working, you can ping
1068 the address 10.0.2.2 and verify that you got an address in the range
1069 10.0.2.x from the QEMU virtual DHCP server.
1073 Note that <CODE>ping</CODE> is not supported reliably to the internet as it
1074 would require root priviledges. It means you can only ping the local
1079 When using the built-in TFTP server, the router is also the TFTP
1084 When using the <SAMP>`-redir'</SAMP> option, TCP or UDP connections can be
1085 redirected from the host to the guest. It allows for example to
1086 redirect X11, telnet or SSH connections.
1091 <H2><A NAME="SEC22" HREF="qemu-doc.html#TOC22">3.8 Direct Linux Boot</A></H2>
1094 This section explains how to launch a Linux kernel inside QEMU without
1095 having to make a full bootable image. It is very useful for fast Linux
1096 kernel testing. The QEMU network configuration is also explained.
1103 Download the archive <TT>`linux-test-xxx.tar.gz'</TT> containing a Linux
1104 kernel and a disk image.
1106 <LI>Optional: If you want network support (for example to launch X11 examples), you
1108 must copy the script <TT>`qemu-ifup'</TT> in <TT>`/etc'</TT> and configure
1109 properly <CODE>sudo</CODE> so that the command <CODE>ifconfig</CODE> contained in
1110 <TT>`qemu-ifup'</TT> can be executed as root. You must verify that your host
1111 kernel supports the TUN/TAP network interfaces: the device
1112 <TT>`/dev/net/tun'</TT> must be present.
1114 When network is enabled, there is a virtual network connection between
1115 the host kernel and the emulated kernel. The emulated kernel is seen
1116 from the host kernel at IP address 172.20.0.2 and the host kernel is
1117 seen from the emulated kernel at IP address 172.20.0.1.
1119 <LI>Launch <CODE>qemu.sh</CODE>. You should have the following output:
1124 Connected to host network interface: tun0
1125 Linux version 2.4.21 (bellard@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003
1126 BIOS-provided physical RAM map:
1127 BIOS-e801: 0000000000000000 - 000000000009f000 (usable)
1128 BIOS-e801: 0000000000100000 - 0000000002000000 (usable)
1129 32MB LOWMEM available.
1130 On node 0 totalpages: 8192
1131 zone(0): 4096 pages.
1132 zone(1): 4096 pages.
1134 Kernel command line: root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe console=ttyS0
1135 ide_setup: ide2=noprobe
1136 ide_setup: ide3=noprobe
1137 ide_setup: ide4=noprobe
1138 ide_setup: ide5=noprobe
1140 Detected 2399.621 MHz processor.
1141 Console: colour EGA 80x25
1142 Calibrating delay loop... 4744.80 BogoMIPS
1143 Memory: 28872k/32768k available (1210k kernel code, 3508k reserved, 266k data, 64k init, 0k highmem)
1144 Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
1145 Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
1146 Mount cache hash table entries: 512 (order: 0, 4096 bytes)
1147 Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
1148 Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
1149 CPU: Intel Pentium Pro stepping 03
1150 Checking 'hlt' instruction... OK.
1151 POSIX conformance testing by UNIFIX
1152 Linux NET4.0 for Linux 2.4
1153 Based upon Swansea University Computer Society NET3.039
1154 Initializing RT netlink socket
1155 apm: BIOS not found.
1157 Journalled Block Device driver loaded
1158 Detected PS/2 Mouse Port.
1159 pty: 256 Unix98 ptys configured
1160 Serial driver version 5.05c (2001-07-08) with no serial options enabled
1161 ttyS00 at 0x03f8 (irq = 4) is a 16450
1162 ne.c:v1.10 9/23/94 Donald Becker (becker@scyld.com)
1163 Last modified Nov 1, 2000 by Paul Gortmaker
1164 NE*000 ethercard probe at 0x300: 52 54 00 12 34 56
1165 eth0: NE2000 found at 0x300, using IRQ 9.
1166 RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
1167 Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4
1168 ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
1169 hda: QEMU HARDDISK, ATA DISK drive
1170 ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
1171 hda: attached ide-disk driver.
1172 hda: 20480 sectors (10 MB) w/256KiB Cache, CHS=20/16/63
1175 Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
1176 NET4: Linux TCP/IP 1.0 for NET4.0
1177 IP Protocols: ICMP, UDP, TCP, IGMP
1178 IP: routing cache hash table of 512 buckets, 4Kbytes
1179 TCP: Hash tables configured (established 2048 bind 4096)
1180 NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
1181 EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
1182 VFS: Mounted root (ext2 filesystem).
1183 Freeing unused kernel memory: 64k freed
1185 Linux version 2.4.21 (bellard@voyager.localdomain) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #5 Tue Nov 11 18:18:53 CET 2003
1187 QEMU Linux test distribution (based on Redhat 9)
1189 Type 'exit' to halt the system
1196 Then you can play with the kernel inside the virtual serial console. You
1197 can launch <CODE>ls</CODE> for example. Type <KBD>Ctrl-a h</KBD> to have an help
1198 about the keys you can type inside the virtual serial console. In
1199 particular, use <KBD>Ctrl-a x</KBD> to exit QEMU and use <KBD>Ctrl-a b</KBD> as
1200 the Magic SysRq key.
1204 If the network is enabled, launch the script <TT>`/etc/linuxrc'</TT> in the
1205 emulator (don't forget the leading dot):
1211 Then enable X11 connections on your PC from the emulated Linux:
1217 You can now launch <TT>`xterm'</TT> or <TT>`xlogo'</TT> and verify that you have
1218 a real Virtual Linux system !
1228 A 2.5.74 kernel is also included in the archive. Just
1229 replace the bzImage in qemu.sh to try it.
1233 In order to exit cleanly from qemu, you can do a <EM>shutdown</EM> inside
1234 qemu. qemu will automatically exit when the Linux shutdown is done.
1238 You can boot slightly faster by disabling the probe of non present IDE
1239 interfaces. To do so, add the following options on the kernel command
1243 ide1=noprobe ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe
1248 The example disk image is a modified version of the one made by Kevin
1249 Lawton for the plex86 Project (<A HREF="www.plex86.org">www.plex86.org</A>).
1255 <H2><A NAME="SEC23" HREF="qemu-doc.html#TOC23">3.9 GDB usage</A></H2>
1258 QEMU has a primitive support to work with gdb, so that you can do
1259 'Ctrl-C' while the virtual machine is running and inspect its state.
1263 In order to use gdb, launch qemu with the '-s' option. It will wait for a
1267 > qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img -append "root=/dev/hda"
1268 Connected to host network interface: tun0
1269 Waiting gdb connection on port 1234
1273 Then launch gdb on the 'vmlinux' executable:
1280 In gdb, connect to QEMU:
1283 (gdb) target remote localhost:1234
1287 Then you can use gdb normally. For example, type 'c' to launch the kernel:
1294 Here are some useful tips in order to use gdb on system code:
1301 Use <CODE>info reg</CODE> to display all the CPU registers.
1304 Use <CODE>x/10i $eip</CODE> to display the code at the PC position.
1307 Use <CODE>set architecture i8086</CODE> to dump 16 bit code. Then use
1308 <CODE>x/10i $cs*16+*eip</CODE> to dump the code at the PC position.
1313 <H2><A NAME="SEC24" HREF="qemu-doc.html#TOC24">3.10 Target OS specific information</A></H2>
1317 <H3><A NAME="SEC25" HREF="qemu-doc.html#TOC25">3.10.1 Linux</A></H3>
1320 To have access to SVGA graphic modes under X11, use the <CODE>vesa</CODE> or
1321 the <CODE>cirrus</CODE> X11 driver. For optimal performances, use 16 bit
1322 color depth in the guest and the host OS.
1326 When using a 2.6 guest Linux kernel, you should add the option
1327 <CODE>clock=pit</CODE> on the kernel command line because the 2.6 Linux
1328 kernels make very strict real time clock checks by default that QEMU
1329 cannot simulate exactly.
1333 When using a 2.6 guest Linux kernel, verify that the 4G/4G patch is
1334 not activated because QEMU is slower with this patch. The QEMU
1335 Accelerator Module is also much slower in this case. Earlier Fedora
1336 Core 3 Linux kernel (< 2.6.9-1.724_FC3) were known to incorporte this
1337 patch by default. Newer kernels don't have it.
1342 <H3><A NAME="SEC26" HREF="qemu-doc.html#TOC26">3.10.2 Windows</A></H3>
1345 If you have a slow host, using Windows 95 is better as it gives the
1346 best speed. Windows 2000 is also a good choice.
1351 <H4><A NAME="SEC27" HREF="qemu-doc.html#TOC27">3.10.2.1 SVGA graphic modes support</A></H4>
1354 QEMU emulates a Cirrus Logic GD5446 Video
1355 card. All Windows versions starting from Windows 95 should recognize
1356 and use this graphic card. For optimal performances, use 16 bit color
1357 depth in the guest and the host OS.
1362 <H4><A NAME="SEC28" HREF="qemu-doc.html#TOC28">3.10.2.2 CPU usage reduction</A></H4>
1365 Windows 9x does not correctly use the CPU HLT
1366 instruction. The result is that it takes host CPU cycles even when
1367 idle. You can install the utility from
1368 <A HREF="http://www.user.cityline.ru/~maxamn/amnhltm.zip">http://www.user.cityline.ru/~maxamn/amnhltm.zip</A> to solve this
1369 problem. Note that no such tool is needed for NT, 2000 or XP.
1374 <H4><A NAME="SEC29" HREF="qemu-doc.html#TOC29">3.10.2.3 Windows 2000 disk full problem</A></H4>
1377 Windows 2000 has a bug which gives a disk full problem during its
1378 installation. When installing it, use the <SAMP>`-win2k-hack'</SAMP> QEMU
1379 option to enable a specific workaround. After Windows 2000 is
1380 installed, you no longer need this option (this option slows down the
1386 <H4><A NAME="SEC30" HREF="qemu-doc.html#TOC30">3.10.2.4 Windows XP security problems</A></H4>
1389 Some releases of Windows XP install correctly but give a security
1393 A problem is preventing Windows from accurately checking the
1394 license for this computer. Error code: 0x800703e6.
1398 The only known workaround is to boot in Safe mode
1399 without networking support.
1403 Future QEMU releases are likely to correct this bug.
1408 <H3><A NAME="SEC31" HREF="qemu-doc.html#TOC31">3.10.3 MS-DOS and FreeDOS</A></H3>
1412 <H4><A NAME="SEC32" HREF="qemu-doc.html#TOC32">3.10.3.1 CPU usage reduction</A></H4>
1415 DOS does not correctly use the CPU HLT instruction. The result is that
1416 it takes host CPU cycles even when idle. You can install the utility
1417 from <A HREF="http://www.vmware.com/software/dosidle210.zip">http://www.vmware.com/software/dosidle210.zip</A> to solve this
1423 <H1><A NAME="SEC33" HREF="qemu-doc.html#TOC33">4. QEMU PowerPC System emulator invocation</A></H1>
1426 Use the executable <TT>`qemu-system-ppc'</TT> to simulate a complete PREP
1427 or PowerMac PowerPC system.
1431 QEMU emulates the following PowerMac peripherals:
1441 PCI VGA compatible card with VESA Bochs Extensions
1444 2 PMAC IDE interfaces with hard disk and CD-ROM support
1453 VIA-CUDA with ADB keyboard and mouse.
1457 QEMU emulates the following PREP peripherals:
1467 PCI VGA compatible card with VESA Bochs Extensions
1470 2 IDE interfaces with hard disk and CD-ROM support
1476 NE2000 network adapters
1482 PREP Non Volatile RAM
1485 PC compatible keyboard and mouse.
1489 QEMU uses the Open Hack'Ware Open Firmware Compatible BIOS available at
1490 <A HREF="http://site.voila.fr/jmayer/OpenHackWare/index.htm">http://site.voila.fr/jmayer/OpenHackWare/index.htm</A>.
1494 You can read the qemu PC system emulation chapter to have more
1495 informations about QEMU usage.
1499 The following options are specific to the PowerPC emulation:
1504 <DT><SAMP>`-prep'</SAMP>
1506 Simulate a PREP system (default is PowerMAC)
1508 <DT><SAMP>`-g WxH[xDEPTH]'</SAMP>
1510 Set the initial VGA graphic mode. The default is 800x600x15.
1515 More information is available at
1516 <A HREF="http://jocelyn.mayer.free.fr/qemu-ppc/">http://jocelyn.mayer.free.fr/qemu-ppc/</A>.
1521 <H1><A NAME="SEC34" HREF="qemu-doc.html#TOC34">5. Sparc32 System emulator invocation</A></H1>
1524 Use the executable <TT>`qemu-system-sparc'</TT> to simulate a JavaStation
1525 (sun4m architecture). The emulation is somewhat complete.
1529 QEMU emulates the following sun4m peripherals:
1542 Lance (Am7990) Ethernet
1545 Non Volatile RAM M48T08
1548 Slave I/O: timers, interrupt controllers, Zilog serial ports, keyboard
1549 and power/reset logic
1552 ESP SCSI controller with hard disk and CD-ROM support
1559 The number of peripherals is fixed in the architecture.
1563 QEMU uses the Proll, a PROM replacement available at
1564 <A HREF="http://people.redhat.com/zaitcev/linux/">http://people.redhat.com/zaitcev/linux/</A>. The required
1565 QEMU-specific patches are included with the sources.
1569 A sample Linux 2.6 series kernel and ram disk image are available on
1570 the QEMU web site. Please note that currently neither Linux 2.4
1571 series, NetBSD, nor OpenBSD kernels work.
1575 The following options are specific to the Sparc emulation:
1580 <DT><SAMP>`-g WxH'</SAMP>
1582 Set the initial TCX graphic mode. The default is 1024x768.
1588 <H1><A NAME="SEC35" HREF="qemu-doc.html#TOC35">6. Sparc64 System emulator invocation</A></H1>
1591 Use the executable <TT>`qemu-system-sparc64'</TT> to simulate a Sun4u machine.
1592 The emulator is not usable for anything yet.
1596 QEMU emulates the following sun4u peripherals:
1603 UltraSparc IIi APB PCI Bridge
1606 PCI VGA compatible card with VESA Bochs Extensions
1609 Non Volatile RAM M48T59
1612 PC-compatible serial ports
1617 <H1><A NAME="SEC36" HREF="qemu-doc.html#TOC36">7. MIPS System emulator invocation</A></H1>
1620 Use the executable <TT>`qemu-system-mips'</TT> to simulate a MIPS machine.
1621 The emulator begins to launch a Linux kernel.
1626 <H1><A NAME="SEC37" HREF="qemu-doc.html#TOC37">8. QEMU User space emulator invocation</A></H1>
1630 <H2><A NAME="SEC38" HREF="qemu-doc.html#TOC38">8.1 Quick Start</A></H2>
1633 In order to launch a Linux process, QEMU needs the process executable
1634 itself and all the target (x86) dynamic libraries used by it.
1640 <LI>On x86, you can just try to launch any process by using the native
1646 qemu-i386 -L / /bin/ls
1649 <CODE>-L /</CODE> tells that the x86 dynamic linker must be searched with a
1650 <TT>`/'</TT> prefix.
1652 <LI>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):
1656 qemu-i386 -L / qemu-i386 -L / /bin/ls
1659 <LI>On non x86 CPUs, you need first to download at least an x86 glibc
1661 (<TT>`qemu-runtime-i386-XXX-.tar.gz'</TT> on the QEMU web page). Ensure that
1662 <CODE>LD_LIBRARY_PATH</CODE> is not set:
1666 unset LD_LIBRARY_PATH
1669 Then you can launch the precompiled <TT>`ls'</TT> x86 executable:
1673 qemu-i386 tests/i386/ls
1676 You can look at <TT>`qemu-binfmt-conf.sh'</TT> so that
1677 QEMU is automatically launched by the Linux kernel when you try to
1678 launch x86 executables. It requires the <CODE>binfmt_misc</CODE> module in the
1681 <LI>The x86 version of QEMU is also included. You can try weird things such as:
1685 qemu-i386 /usr/local/qemu-i386/bin/qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1692 <H2><A NAME="SEC39" HREF="qemu-doc.html#TOC39">8.2 Wine launch</A></H2>
1697 <LI>Ensure that you have a working QEMU with the x86 glibc
1699 distribution (see previous section). In order to verify it, you must be
1704 qemu-i386 /usr/local/qemu-i386/bin/ls-i386
1707 <LI>Download the binary x86 Wine install
1709 (<TT>`qemu-XXX-i386-wine.tar.gz'</TT> on the QEMU web page).
1711 <LI>Configure Wine on your account. Look at the provided script
1713 <TT>`/usr/local/qemu-i386/bin/wine-conf.sh'</TT>. Your previous
1714 <CODE>${HOME}/.wine</CODE> directory is saved to <CODE>${HOME}/.wine.org</CODE>.
1716 <LI>Then you can try the example <TT>`putty.exe'</TT>:
1720 qemu-i386 /usr/local/qemu-i386/wine/bin/wine /usr/local/qemu-i386/wine/c/Program\ Files/putty.exe
1727 <H2><A NAME="SEC40" HREF="qemu-doc.html#TOC40">8.3 Command line options</A></H2>
1731 usage: qemu-i386 [-h] [-d] [-L path] [-s size] program [arguments...]
1736 <DT><SAMP>`-h'</SAMP>
1739 <DT><SAMP>`-L path'</SAMP>
1741 Set the x86 elf interpreter prefix (default=/usr/local/qemu-i386)
1742 <DT><SAMP>`-s size'</SAMP>
1744 Set the x86 stack size in bytes (default=524288)
1753 <DT><SAMP>`-d'</SAMP>
1755 Activate log (logfile=/tmp/qemu.log)
1756 <DT><SAMP>`-p pagesize'</SAMP>
1758 Act as if the host page size was 'pagesize' bytes
1763 <H1><A NAME="SEC41" HREF="qemu-doc.html#TOC41">9. Compilation from the sources</A></H1>
1767 <H2><A NAME="SEC42" HREF="qemu-doc.html#TOC42">9.1 Linux/Unix</A></H2>
1771 <H3><A NAME="SEC43" HREF="qemu-doc.html#TOC43">9.1.1 Compilation</A></H3>
1774 First you must decompress the sources:
1778 tar zxvf qemu-x.y.z.tar.gz
1783 Then you configure QEMU and build it (usually no options are needed):
1791 Then type as root user:
1798 to install QEMU in <TT>`/usr/local'</TT>.
1803 <H3><A NAME="SEC44" HREF="qemu-doc.html#TOC44">9.1.2 Tested tool versions</A></H3>
1806 In order to compile QEMU succesfully, it is very important that you
1807 have the right tools. The most important one is gcc. I cannot guaranty
1808 that QEMU works if you do not use a tested gcc version. Look at
1809 'configure' and 'Makefile' if you want to make a different gcc
1815 host gcc binutils glibc linux distribution
1816 ----------------------------------------------------------------------
1817 x86 3.2 2.13.2 2.1.3 2.4.18
1818 2.96 2.11.93.0.2 2.2.5 2.4.18 Red Hat 7.3
1819 3.2.2 2.13.90.0.18 2.3.2 2.4.20 Red Hat 9
1821 PowerPC 3.3 [4] 2.13.90.0.18 2.3.1 2.4.20briq
1824 Alpha 3.3 [1] 2.14.90.0.4 2.2.5 2.2.20 [2] Debian 3.0
1826 Sparc32 2.95.4 2.12.90.0.1 2.2.5 2.4.18 Debian 3.0
1828 ARM 2.95.4 2.12.90.0.1 2.2.5 2.4.9 [3] Debian 3.0
1830 [1] On Alpha, QEMU needs the gcc 'visibility' attribute only available
1831 for gcc version >= 3.3.
1832 [2] Linux >= 2.4.20 is necessary for precise exception support
1834 [3] 2.4.9-ac10-rmk2-np1-cerf2
1836 [4] gcc 2.95.x generates invalid code when using too many register
1837 variables. You must use gcc 3.x on PowerPC.
1842 <H2><A NAME="SEC45" HREF="qemu-doc.html#TOC45">9.2 Windows</A></H2>
1846 <LI>Install the current versions of MSYS and MinGW from
1848 <A HREF="http://www.mingw.org/">http://www.mingw.org/</A>. You can find detailed installation
1849 instructions in the download section and the FAQ.
1853 the MinGW development library of SDL 1.2.x
1854 (<TT>`SDL-devel-1.2.x-mingw32.tar.gz'</TT>) from
1855 <A HREF="http://www.libsdl.org">http://www.libsdl.org</A>. Unpack it in a temporary place, and
1856 unpack the archive <TT>`i386-mingw32msvc.tar.gz'</TT> in the MinGW tool
1857 directory. Edit the <TT>`sdl-config'</TT> script so that it gives the
1858 correct SDL directory when invoked.
1860 <LI>Extract the current version of QEMU.
1863 <LI>Start the MSYS shell (file <TT>`msys.bat'</TT>).
1865 <LI>Change to the QEMU directory. Launch <TT>`./configure'</TT> and
1867 <TT>`make'</TT>. If you have problems using SDL, verify that
1868 <TT>`sdl-config'</TT> can be launched from the MSYS command line.
1870 <LI>You can install QEMU in <TT>`Program Files/Qemu'</TT> by typing
1872 <TT>`make install'</TT>. Don't forget to copy <TT>`SDL.dll'</TT> in
1873 <TT>`Program Files/Qemu'</TT>.
1879 <H2><A NAME="SEC46" HREF="qemu-doc.html#TOC46">9.3 Cross compilation for Windows with Linux</A></H2>
1885 Install the MinGW cross compilation tools available at
1886 <A HREF="http://www.mingw.org/">http://www.mingw.org/</A>.
1890 Install the Win32 version of SDL (<A HREF="http://www.libsdl.org">http://www.libsdl.org</A>) by
1891 unpacking <TT>`i386-mingw32msvc.tar.gz'</TT>. Set up the PATH environment
1892 variable so that <TT>`i386-mingw32msvc-sdl-config'</TT> can be launched by
1893 the QEMU configuration script.
1897 Configure QEMU for Windows cross compilation:
1900 ./configure --enable-mingw32
1903 If necessary, you can change the cross-prefix according to the prefix
1904 choosen for the MinGW tools with --cross-prefix. You can also use
1905 --prefix to set the Win32 install path.
1907 <LI>You can install QEMU in the installation directory by typing
1909 <TT>`make install'</TT>. Don't forget to copy <TT>`SDL.dll'</TT> in the
1910 installation directory.
1915 Note: Currently, Wine does not seem able to launch
1921 <H2><A NAME="SEC47" HREF="qemu-doc.html#TOC47">9.4 Mac OS X</A></H2>
1924 The Mac OS X patches are not fully merged in QEMU, so you should look
1925 at the QEMU mailing list archive to have all the necessary
1930 This document was generated on 24 July 2005 using
1931 <A HREF="http://wwwinfo.cern.ch/dis/texi2html/">texi2html</A> 1.56k.