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