1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY qemu-download-http "http://wiki.qemu.org/download/qemu-&qemu-version;.tar.bz2">
|
---|
8 | <!ENTITY qemu-download-ftp " ">
|
---|
9 | <!ENTITY qemu-md5sum "f3f39308472d629aca57a255a0c91ba9">
|
---|
10 | <!ENTITY qemu-size "11.5 MB">
|
---|
11 | <!ENTITY qemu-buildsize "192 MB">
|
---|
12 | <!ENTITY qemu-time "1.7 SBU">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="qemu" xreflabel="qemu-&qemu-version;">
|
---|
16 | <?dbhtml filename="qemu.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>qemu-&qemu-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="qemu">
|
---|
26 | <primary sortas="a-qemu">qemu</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to qemu</title>
|
---|
31 |
|
---|
32 | <para><application>qemu</application> is a full virtualization solution
|
---|
33 | for Linux on x86 hardware containing virtualization extensions (Intel VT or
|
---|
34 | AMD-V).</para>
|
---|
35 |
|
---|
36 | &lfs74_checked;
|
---|
37 |
|
---|
38 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
39 | <itemizedlist spacing="compact">
|
---|
40 | <listitem>
|
---|
41 | <para>Download (HTTP): <ulink url="&qemu-download-http;"/></para>
|
---|
42 | </listitem>
|
---|
43 | <listitem>
|
---|
44 | <para>Download (FTP): <ulink url="&qemu-download-ftp;"/></para>
|
---|
45 | </listitem>
|
---|
46 | <listitem>
|
---|
47 | <para>Download MD5 sum: &qemu-md5sum;</para>
|
---|
48 | </listitem>
|
---|
49 | <listitem>
|
---|
50 | <para>Download size: &qemu-size;</para>
|
---|
51 | </listitem>
|
---|
52 | <listitem>
|
---|
53 | <para>Estimated disk space required: &qemu-buildsize;</para>
|
---|
54 | </listitem>
|
---|
55 | <listitem>
|
---|
56 | <para>Estimated build time: &qemu-time;</para>
|
---|
57 | </listitem>
|
---|
58 | </itemizedlist>
|
---|
59 | <!--
|
---|
60 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
61 | <itemizedlist spacing='compact'>
|
---|
62 | <listitem>
|
---|
63 | <para>Required Patch: <ulink
|
---|
64 | url="&patch-root;/qemu-&qemu-version;-fixes-1.patch"/></para>
|
---|
65 | </listitem>
|
---|
66 | </itemizedlist>
|
---|
67 | -->
|
---|
68 | <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
|
---|
69 |
|
---|
70 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
71 | <para role="required">
|
---|
72 | <xref linkend="glib2"/>,
|
---|
73 | <xref linkend="python2"/>,
|
---|
74 | <xref linkend="sdl"/>, and
|
---|
75 | <xref linkend="x-window-system"/>
|
---|
76 | </para>
|
---|
77 |
|
---|
78 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
79 | <para role="optional">
|
---|
80 | <xref linkend="alsa"/>,
|
---|
81 | <xref linkend="attr"/>,
|
---|
82 | <xref linkend="check"/>,
|
---|
83 | <xref linkend="curl"/>,
|
---|
84 | <xref linkend="esound"/>,
|
---|
85 | <xref linkend="mesalib"/>, and
|
---|
86 | <xref linkend="cyrus-sasl"/>.
|
---|
87 | Note that this optional dependencies list is not comprehensive. See the
|
---|
88 | output of <command>./configure --help</command> for a more complete list.
|
---|
89 | </para>
|
---|
90 |
|
---|
91 | <para condition="html" role="usernotes">User Notes:
|
---|
92 | <ulink url="&blfs-wiki;/qemu"/></para>
|
---|
93 |
|
---|
94 | </sect2>
|
---|
95 |
|
---|
96 | <sect2 id='qemu-prereq'>
|
---|
97 | <title>KVM Prerequsites</title>
|
---|
98 |
|
---|
99 | <para>Before building <application>qemu</application>, check to see if
|
---|
100 | your processor supports Virtualization Technology (VT):</para>
|
---|
101 |
|
---|
102 | <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
---|
103 |
|
---|
104 | <para>If you get any output, you have VT technology (vmx for Intel
|
---|
105 | processors and svm for AMD processors). You then need to go into your
|
---|
106 | system BIOS and ensure it is enabled. After enabing, reboot back to your
|
---|
107 | LFS instance.</para>
|
---|
108 |
|
---|
109 | </sect2>
|
---|
110 |
|
---|
111 | <sect2 role="kernel" id='qemu-kernel'>
|
---|
112 | <title>Kernel Configuration</title>
|
---|
113 |
|
---|
114 | <para>Enable the following options in the kernel configuration
|
---|
115 | and recompile the kernel if necessary:</para>
|
---|
116 |
|
---|
117 | <screen><literal>Virtualization: Y
|
---|
118 | Kernel-based Virtual Machine (KVM) support: M or Y
|
---|
119 | KVM for Intel processors support: M or Y
|
---|
120 | KVM for AMD processors support: M or Y</literal></screen>
|
---|
121 |
|
---|
122 | <indexterm zone="qemu qemu-kernel">
|
---|
123 | <primary sortas="d-qemu">qemu</primary>
|
---|
124 | </indexterm>
|
---|
125 |
|
---|
126 | <para>The Intel or AMD settings are not both required, but the one matching
|
---|
127 | your system processor is required.</para>
|
---|
128 |
|
---|
129 | <para>For networking, check that the settings CONFIG_BRIDGE, CONFIG_STP,
|
---|
130 | CONFIG_TUN are enabled and <xref linkend='bridgeutils'/> is
|
---|
131 | installed.</para>
|
---|
132 |
|
---|
133 | </sect2>
|
---|
134 |
|
---|
135 | <sect2 role="installation">
|
---|
136 | <title>Installation of qemu</title>
|
---|
137 |
|
---|
138 | <para>If <application>xorg</application> is not installed in
|
---|
139 | <filename class='directory'>/usr</filename>, then the linker needs to
|
---|
140 | be told where it is. For example:</para>
|
---|
141 |
|
---|
142 | <screen><userinput>export LIBRARY_PATH=/opt/xorg/lib</userinput></screen>
|
---|
143 |
|
---|
144 | <para>Install <application>qemu</application> by running the following
|
---|
145 | commands:</para>
|
---|
146 |
|
---|
147 | <screen><userinput>./configure --prefix=/usr \
|
---|
148 | --sysconfdir=/etc \
|
---|
149 | --target-list=x86_64-softmmu &&
|
---|
150 | make</userinput></screen>
|
---|
151 |
|
---|
152 | <para>To run the built in tests, run <command>make V=1 check</command>.</para>
|
---|
153 |
|
---|
154 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
155 |
|
---|
156 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
157 |
|
---|
158 | <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
|
---|
159 | make a distinction between i386 and x86_64 so even on an i386 system you
|
---|
160 | should use <emphasis>qemu-system-x86_64</emphasis></para>
|
---|
161 | -->
|
---|
162 |
|
---|
163 | <para>For convenience you may want to create a symbolic link to run
|
---|
164 | <command>qemu-system-x86_64</command>:</para>
|
---|
165 |
|
---|
166 | <screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
|
---|
167 | </note>
|
---|
168 |
|
---|
169 | </sect2>
|
---|
170 |
|
---|
171 | <sect2 role="commands">
|
---|
172 | <title>Command Explanations</title>
|
---|
173 |
|
---|
174 | <para><parameter>--target-list=x86_64-softmmu</parameter>: This option
|
---|
175 | limits the build target to the x86_64 architecture. For other
|
---|
176 | hardware emulation see the --target-list list in <command>configure</command>'s
|
---|
177 | help output. Omitting this option will build all architectures.</para>
|
---|
178 |
|
---|
179 | </sect2>
|
---|
180 |
|
---|
181 |
|
---|
182 |
|
---|
183 | <sect2 role="configuration">
|
---|
184 | <title>Configuring qemu</title>
|
---|
185 |
|
---|
186 | <para>To generate an image, run:</para>
|
---|
187 |
|
---|
188 | <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
|
---|
189 |
|
---|
190 | <para>Adjust the virtual disk size and image filename as desired. The
|
---|
191 | actual size of the file will be less than specified, but will expand as it
|
---|
192 | is used.</para>
|
---|
193 |
|
---|
194 | <note><para>The following instructions assume you have created the optional
|
---|
195 | symbolic link, <userinput>qemu</userinput>. Additionally, you must run
|
---|
196 | <userinput>qemu</userinput> from an X-Windows based terminal.</para></note>
|
---|
197 |
|
---|
198 | <para>To install an operating system, download an iso of your choice or use
|
---|
199 | a pre-intalled cdrom device. For the purposes of this example, use
|
---|
200 | Fedora 16 that is downloaded as
|
---|
201 | <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
|
---|
202 | directory. Run the following:</para>
|
---|
203 |
|
---|
204 | <screen><userinput>qemu -enable-kvm -hda vdisk.img \
|
---|
205 | -cdrom Fedora-16-x86_64-Live-LXDE.iso \
|
---|
206 | -boot d \
|
---|
207 | -m 384</userinput></screen>
|
---|
208 |
|
---|
209 | <para>Follow the normal installation procedures for the chosen
|
---|
210 | distribution. The -boot option specifies the boot order of drives as a
|
---|
211 | string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
|
---|
212 | (first hard disk), d (first CD-ROM). The -m option is the amount of memory
|
---|
213 | to use for the virtual machine. If you have sufficient memory (2G or
|
---|
214 | more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
|
---|
215 | to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
|
---|
216 | for hardware acceleeration. Without this switch, the emulation is
|
---|
217 | relatively slow.</para>
|
---|
218 |
|
---|
219 | <para>To run the newly installed operating system, run:</para>
|
---|
220 |
|
---|
221 | <screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
|
---|
222 |
|
---|
223 | <para>To add networking to the instance add "-net nic -net user" to the
|
---|
224 | command above. qemu provides a DHCP server for the VM and, depending on
|
---|
225 | the client system, sets up networking though the host.</para>
|
---|
226 |
|
---|
227 | <para>One problem with the above networking solution is that it does not
|
---|
228 | provide the ability to connect with the local network. To do that, there are
|
---|
229 | several additional steps that need to be done, all as the <systemitem
|
---|
230 | class="username">root</systemitem> user:</para>
|
---|
231 |
|
---|
232 | <itemizedlist spacing="compact">
|
---|
233 | <listitem>
|
---|
234 | <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
|
---|
235 | </listitem>
|
---|
236 |
|
---|
237 | <listitem>
|
---|
238 | <para>Allow the host system to forward IP packets.</para>
|
---|
239 |
|
---|
240 | <screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
|
---|
241 |
|
---|
242 | <para>To make this permanent, add the command to
|
---|
243 | <filename>/etc/syssysctl.conf:</filename></para>
|
---|
244 |
|
---|
245 | <screen><userinput>cat >> /etc/sysctl.conf << EOF
|
---|
246 | net.ipv4.ip_forward=1
|
---|
247 | EOF</userinput></screen>
|
---|
248 |
|
---|
249 | </listitem>
|
---|
250 |
|
---|
251 | <listitem>
|
---|
252 | <para>Create scripts for qemu to attach the client network
|
---|
253 | device, usually visible as tap0, to the host bridge.</para>
|
---|
254 |
|
---|
255 | <screen><userinput>cat > /etc/qemu-ifup << EOF
|
---|
256 | #!/bin/bash
|
---|
257 |
|
---|
258 | switch=br0
|
---|
259 |
|
---|
260 | if [ -n "\$1" ]; then
|
---|
261 | # Add new tap0 interface to bridge
|
---|
262 | /sbin/ip link set \$1 up
|
---|
263 | sleep 0.5s
|
---|
264 | /usr/sbin/brctl addif \$switch \$1
|
---|
265 | else
|
---|
266 | echo "Error: no interface specified"
|
---|
267 | exit 1
|
---|
268 | fi
|
---|
269 |
|
---|
270 | exit 0
|
---|
271 | EOF
|
---|
272 |
|
---|
273 | chmod +x /etc/qemu-ifup</userinput></screen>
|
---|
274 |
|
---|
275 | <screen><userinput>cat > /etc/qemu-ifdown << EOF
|
---|
276 | #!/bin/bash
|
---|
277 |
|
---|
278 | switch=br0
|
---|
279 |
|
---|
280 | if [ -n "\$1" ]; then
|
---|
281 | # Remove tap0 interface from bridge
|
---|
282 | /usr/sbin/brctl delif \$switch \$1
|
---|
283 | else
|
---|
284 | echo "Error: no interface specified"
|
---|
285 | exit 1
|
---|
286 | fi
|
---|
287 |
|
---|
288 | exit 0
|
---|
289 | EOF
|
---|
290 |
|
---|
291 | chmod +x /etc/qemu-ifdown</userinput></screen>
|
---|
292 |
|
---|
293 | </listitem>
|
---|
294 | </itemizedlist>
|
---|
295 |
|
---|
296 | <note><para>The backslashes in the abouve script are for convenience
|
---|
297 | for cut/paste operations. The backslashes should <emphasis>not</emphasis>
|
---|
298 | appear in the final scripts.</para></note>
|
---|
299 |
|
---|
300 | <itemizedlist spacing="compact">
|
---|
301 | <listitem>
|
---|
302 | <para>Start qemu with "-net nic -net tap" options. </para>
|
---|
303 | </listitem>
|
---|
304 |
|
---|
305 | <listitem>
|
---|
306 | <para>If a connection, such as ssh, from the local network to the
|
---|
307 | client VM is desired, the client should probably be configured
|
---|
308 | with a static IP address.</para>
|
---|
309 | </listitem>
|
---|
310 |
|
---|
311 | </itemizedlist>
|
---|
312 |
|
---|
313 | </sect2>
|
---|
314 |
|
---|
315 | <sect2 role="content">
|
---|
316 | <title>Contents</title>
|
---|
317 |
|
---|
318 | <segmentedlist>
|
---|
319 | <segtitle>Installed Program</segtitle>
|
---|
320 | <segtitle>Installed Libraries</segtitle>
|
---|
321 | <segtitle>Installed Directories</segtitle>
|
---|
322 |
|
---|
323 | <seglistitem>
|
---|
324 | <seg>qemu-ga, qemu-img, qemu-io, qemu-nbd, qemu-system-x86_64</seg>
|
---|
325 | <seg>None</seg>
|
---|
326 | <seg>/etc/qemu, /usr/share/qemu, /usr/share/doc/qemu</seg>
|
---|
327 | </seglistitem>
|
---|
328 | </segmentedlist>
|
---|
329 |
|
---|
330 | <variablelist>
|
---|
331 | <bridgehead renderas="sect3">Short Description</bridgehead>
|
---|
332 | <?dbfo list-presentation="list"?>
|
---|
333 | <?dbhtml list-presentation="table"?>
|
---|
334 |
|
---|
335 | <varlistentry id="qemu-ga">
|
---|
336 | <term><command>qemu-ga</command></term>
|
---|
337 | <listitem>
|
---|
338 | <para>implements support for QMP (QEMU Monitor Protocol) commands and
|
---|
339 | events that terminate and originate respectively within the guest
|
---|
340 | using an agent built as part of QEMU.</para>
|
---|
341 | <indexterm zone="qemu qemu-ga">
|
---|
342 | <primary sortas="b-qemu-ga">qemu-ga</primary>
|
---|
343 | </indexterm>
|
---|
344 | </listitem>
|
---|
345 | </varlistentry>
|
---|
346 |
|
---|
347 | <varlistentry id="qemu-img">
|
---|
348 | <term><command>qemu-img</command></term>
|
---|
349 | <listitem>
|
---|
350 | <para>provides commands to manage QEMU disk images.</para>
|
---|
351 | <indexterm zone="qemu qemu-img">
|
---|
352 | <primary sortas="b-qemu-img">qemu-img</primary>
|
---|
353 | </indexterm>
|
---|
354 | </listitem>
|
---|
355 | </varlistentry>
|
---|
356 |
|
---|
357 | <varlistentry id="qemu-io">
|
---|
358 | <term><command>qemu-io</command></term>
|
---|
359 | <listitem>
|
---|
360 | <para>is a diagnostic and manipulation program for (virtual) memory
|
---|
361 | media. It is still at an early stage of development.</para>
|
---|
362 | <indexterm zone="qemu qemu-io">
|
---|
363 | <primary sortas="b-qemu-io">qemu-io</primary>
|
---|
364 | </indexterm>
|
---|
365 | </listitem>
|
---|
366 | </varlistentry>
|
---|
367 |
|
---|
368 | <varlistentry id="qemu-nbd">
|
---|
369 | <term><command>qemu-nbd</command></term>
|
---|
370 | <listitem>
|
---|
371 | <para>exports Qemu disk images using the QEMU Disk Network Block
|
---|
372 | Device (NBD) protocol.</para>
|
---|
373 | <indexterm zone="qemu qemu-nbd">
|
---|
374 | <primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
---|
375 | </indexterm>
|
---|
376 | </listitem>
|
---|
377 | </varlistentry>
|
---|
378 |
|
---|
379 | <varlistentry id="qemu-system">
|
---|
380 | <term><command>qemu-system-x86_64</command></term>
|
---|
381 | <listitem>
|
---|
382 | <para>is the QEMU PC System emulator.</para>
|
---|
383 | <indexterm zone="qemu qemu-system">
|
---|
384 | <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
---|
385 | </indexterm>
|
---|
386 | </listitem>
|
---|
387 | </varlistentry>
|
---|
388 |
|
---|
389 | </variablelist>
|
---|
390 |
|
---|
391 | </sect2>
|
---|
392 |
|
---|
393 | </sect1>
|
---|