source: postlfs/virtualization/qemu.xml@ bfdd32ae

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since bfdd32ae was bfdd32ae, checked in by Bruce Dubbs <bdubbs@…>, 8 years ago

Update to stunnel-5.26.
Update to qemu-2.4.1.
Update to libassuan-2.4.0.
Update to xkbcomp-1.3.1.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@16614 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 17.1 KB
RevLine 
[d28198d3]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
[2f6053d]7 <!ENTITY qemu-download-http "http://wiki.qemu.org/download/qemu-&qemu-version;.tar.bz2">
8 <!ENTITY qemu-download-ftp " ">
[bfdd32ae]9 <!ENTITY qemu-md5sum "a895e93ec1dafc34bc64ed676f0d55a6">
[1ddddef]10 <!ENTITY qemu-size "24 MB">
[bfdd32ae]11 <!ENTITY qemu-buildsize "303 MB (additional 91 MB for tests)">
12 <!ENTITY qemu-time "1.7 SBU (additional 1.0 SBU for tests)">
[d28198d3]13]>
14
[2f6053d]15<sect1 id="qemu" xreflabel="qemu-&qemu-version;">
16 <?dbhtml filename="qemu.html"?>
[d28198d3]17
18 <sect1info>
[c4a1934a]19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
[d28198d3]21 </sect1info>
22
[2f6053d]23 <title>qemu-&qemu-version;</title>
[d28198d3]24
[2f6053d]25 <indexterm zone="qemu">
26 <primary sortas="a-qemu">qemu</primary>
[d28198d3]27 </indexterm>
28
29 <sect2 role="package">
[2f6053d]30 <title>Introduction to qemu</title>
[d28198d3]31
[2f6053d]32 <para><application>qemu</application> is a full virtualization solution
[d28198d3]33 for Linux on x86 hardware containing virtualization extensions (Intel VT or
34 AMD-V).</para>
35
[90cb5d6]36 &lfs78_checked;
[27643d0f]37
[d28198d3]38 <bridgehead renderas="sect3">Package Information</bridgehead>
39 <itemizedlist spacing="compact">
40 <listitem>
[2f6053d]41 <para>Download (HTTP): <ulink url="&qemu-download-http;"/></para>
[d28198d3]42 </listitem>
43 <listitem>
[2f6053d]44 <para>Download (FTP): <ulink url="&qemu-download-ftp;"/></para>
[d28198d3]45 </listitem>
46 <listitem>
[2f6053d]47 <para>Download MD5 sum: &qemu-md5sum;</para>
[d28198d3]48 </listitem>
49 <listitem>
[2f6053d]50 <para>Download size: &qemu-size;</para>
[d28198d3]51 </listitem>
52 <listitem>
[2f6053d]53 <para>Estimated disk space required: &qemu-buildsize;</para>
[d28198d3]54 </listitem>
55 <listitem>
[2f6053d]56 <para>Estimated build time: &qemu-time;</para>
[d28198d3]57 </listitem>
58 </itemizedlist>
[54f740f]59
[2f6053d]60 <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
[d28198d3]61
62 <bridgehead renderas="sect4">Required</bridgehead>
63 <para role="required">
[aa4778c4]64 <xref linkend="glib2"/>,
[c41b38f]65 <xref linkend="python2"/>, and
[d28198d3]66 <xref linkend="x-window-system"/>
67 </para>
68
[c41b38f]69 <bridgehead renderas="sect4">Recommended</bridgehead>
70 <para role="recommended">
71 <xref linkend="sdl"/>
72 </para>
73
[d28198d3]74 <bridgehead renderas="sect4">Optional</bridgehead>
75 <para role="optional">
76 <xref linkend="alsa"/>,
[8ade43b]77 <xref linkend="bluez"/>,
[d28198d3]78 <xref linkend="check"/>,
79 <xref linkend="curl"/>,
[8ade43b]80 <xref linkend="cyrus-sasl"/>,
81 <xref linkend="gtk2"/>,
82 <xref linkend="gtk3"/>,
83 <xref linkend="libusb"/>,
84 <xref linkend="lzo"/>,
85 <xref linkend="nss"/> (for libcacard.so),
[7a395d1]86 <xref linkend="mesa"/>, and
[8ade43b]87 <xref linkend="vte"/>
[d28198d3]88 </para>
89
[9b13441]90 <note>
91 <para>
92 This optional dependencies list is not comprehensive. See the output of
93 <command>./configure --help</command> for a more complete list.
94 </para>
95 </note>
96
[d28198d3]97 <para condition="html" role="usernotes">User Notes:
[2f6053d]98 <ulink url="&blfs-wiki;/qemu"/></para>
[d28198d3]99
100 </sect2>
101
[2f6053d]102 <sect2 id='qemu-prereq'>
[1eb4fcf]103 <title>KVM Prerequisites</title>
[d28198d3]104
[2f6053d]105 <para>Before building <application>qemu</application>, check to see if
[d28198d3]106 your processor supports Virtualization Technology (VT):</para>
107
108 <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
109
110 <para>If you get any output, you have VT technology (vmx for Intel
111 processors and svm for AMD processors). You then need to go into your
112 system BIOS and ensure it is enabled. After enabing, reboot back to your
113 LFS instance.</para>
114
115 </sect2>
116
[2f6053d]117 <sect2 role="kernel" id='qemu-kernel'>
[d28198d3]118 <title>Kernel Configuration</title>
119
[421128a1]120 <para>Enable the following options in the kernel configuration and
121 recompile the kernel if necessary:</para>
[d28198d3]122
[421128a1]123<screen><literal>[*] Virtualization: ---&gt; [CONFIG_VIRTUALIZATION]
124 &lt;*/M&gt; Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
125 &lt;*/M&gt; KVM for Intel processors support [CONFIG_KVM_INTEL]
126 &lt;*/M&gt; KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
[d28198d3]127
[2f6053d]128 <indexterm zone="qemu qemu-kernel">
129 <primary sortas="d-qemu">qemu</primary>
[d28198d3]130 </indexterm>
131
132 <para>The Intel or AMD settings are not both required, but the one matching
133 your system processor is required.</para>
134
[9b13441]135 <para>For networking, check that <xref linkend='bridgeutils'/> is installed
136 and the following options in the kernel configuration are enabled:</para>
137
[421128a1]138<screen><literal>[*] Networking support ---&gt; [CONFIG_NET]
[9b13441]139 Networking options ---&gt;
[421128a1]140 &lt;*/M&gt; 802.1d Ethernet Bridging [CONFIG_BRIDGE]
[9b13441]141Device Drivers ---&gt;
[421128a1]142 [*] Network device support ---&gt; [CONFIG_NETDEVICES]
143 &lt;*/M&gt; Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
[d28198d3]144
145 </sect2>
146
147 <sect2 role="installation">
[2f6053d]148 <title>Installation of qemu</title>
[0d7900a]149
[2f6053d]150 <para>Install <application>qemu</application> by running the following
[d28198d3]151 commands:</para>
152
[5ee1266]153<screen><userinput>./configure --prefix=/usr \
154 --sysconfdir=/etc \
155 --libexecdir=/usr/lib/qemu \
156 $([ $(uname -m) = i686 ] &amp;&amp;
157 echo --target-list=i386-softmmu) \
158 $([ $(uname -m) = x86_64 ] &amp;&amp;
159 echo --target-list=x86_64-softmmu) \
160 --docdir=/usr/share/doc/qemu-&qemu-version; &amp;&amp;
[9b13441]161make</userinput></screen>
[d28198d3]162
[bfdd32ae]163 <para>To run the built in tests, run <command>make V=1 -k check</command>.
164 One test is known to fail.</para>
[d28198d3]165
166 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
167
[9b13441]168<screen role="root"><userinput>make install &amp;&amp;
[5ee1266]169[ -e /usr/lib/libcacard.so ] &amp;&amp;
170chmod -v 755 /usr/lib/libcacard.so</userinput></screen>
[9a04a8e9]171
172 <para>
173 You will need a dedicated group that will contain users (other than root)
[5ee1266]174 allowed to access the KVM device. Create this group by running the
175 following command as the
176 <systemitem class="username">root</systemitem> user:
[9a04a8e9]177 </para>
178
[92cd4cad]179<screen role="root"><userinput>groupadd -g 61 kvm</userinput></screen>
[9a04a8e9]180
181 <para>
182 Add any users that might use the KVM device to that group:
183 </para>
184
185<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
186
187 <para>
[6463c3c]188 You will also need to add a Udev rule so that the KVM device gets correct
[9a04a8e9]189 permissions:
190 </para>
191
192<screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules &lt;&lt; "EOF"
[009eb04]193<literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
[9a04a8e9]194EOF</userinput></screen>
195
[2f6053d]196 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
[d28198d3]197 make a distinction between i386 and x86_64 so even on an i386 system you
198 should use <emphasis>qemu-system-x86_64</emphasis></para>
[2f6053d]199 -->
[0d7900a]200
[d28198d3]201 <para>For convenience you may want to create a symbolic link to run
202 <command>qemu-system-x86_64</command>:</para>
203
[c612fc3]204 <screen role="root"><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
[d28198d3]205 </note>
206
207 </sect2>
208
[6a54383]209 <sect2 role="commands">
210 <title>Command Explanations</title>
211
[5ee1266]212 <para><parameter>$([ $(uname -m) = i686 ] &amp;&amp;
213 echo --target-list=i386-softmmu)</parameter>: This switch
214 tests and, if true, limits the build target to the i386 architecture. For
215 other hardware emulation see the --target-list list in
216 <command>configure</command>'s help output. Omitting the target option will
217 build all architectures.</para>
218
219 <para><parameter>$([ $(uname -m) = x86_64 ] &amp;&amp;
220 echo --target-list=x86_64-softmmu)</parameter>: This switch
221 tests and, if true, limits the build target to the x86_64 architecture. For
222 other hardware emulation see the --target-list list in
223 <command>configure</command>'s help output. Omitting the target option will
224 build all architectures.</para>
[6a54383]225
[9b13441]226 <para>
227 <option>--audio-drv-list=alsa</option>: This switch sets the audio driver
228 to ALSA. For other drivers see the --audio-drv-list list in
229 <command>configure</command>'s help output. The default audio driver is
230 OSS.
231 </para>
[6a54383]232
[9b13441]233 </sect2>
[6a54383]234
[d28198d3]235 <sect2 role="configuration">
[2f6053d]236 <title>Configuring qemu</title>
[d28198d3]237
238 <para>To generate an image, run:</para>
239
240 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
241
242 <para>Adjust the virtual disk size and image filename as desired. The
243 actual size of the file will be less than specified, but will expand as it
244 is used.</para>
245
246 <note><para>The following instructions assume you have created the optional
247 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
[ef5a37b]248 <userinput>qemu</userinput> from an X Window System based terminal.</para></note>
[d28198d3]249
250 <para>To install an operating system, download an iso of your choice or use
[1659792]251 a pre-installed cdrom device. For the purposes of this example, use
[d28198d3]252 Fedora 16 that is downloaded as
253 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
254 directory. Run the following:</para>
255
[2f6053d]256<screen><userinput>qemu -enable-kvm -hda vdisk.img \
[0d7900a]257 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
[d28198d3]258 -boot d \
259 -m 384</userinput></screen>
260
261 <para>Follow the normal installation procedures for the chosen
[2f6053d]262 distribution. The -boot option specifies the boot order of drives as a
263 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
264 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
265 to use for the virtual machine. If you have sufficient memory (2G or
266 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
267 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
[f584e7c]268 for hardware acceleration. Without this switch, the emulation is
[2f6053d]269 relatively slow.</para>
[d28198d3]270
271 <para>To run the newly installed operating system, run:</para>
272
[2f6053d]273<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
[d28198d3]274
275 <para>To add networking to the instance add "-net nic -net user" to the
276 command above. qemu provides a DHCP server for the VM and, depending on
277 the client system, sets up networking though the host.</para>
278
279 <para>One problem with the above networking solution is that it does not
[0d7900a]280 provide the ability to connect with the local network. To do that, there are
[d28198d3]281 several additional steps that need to be done, all as the <systemitem
282 class="username">root</systemitem> user:</para>
283
284 <itemizedlist spacing="compact">
285 <listitem>
286 <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
287 </listitem>
288
289 <listitem>
290 <para>Allow the host system to forward IP packets.</para>
291
[58196bbf]292<screen role="root"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
[0d7900a]293
294 <para>To make this permanent, add the command to
[f584e7c]295 <filename>/etc/sysctl.conf:</filename></para>
[d28198d3]296
[58196bbf]297<screen role="root"><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
[0d7900a]298net.ipv4.ip_forward=1
[d28198d3]299EOF</userinput></screen>
300
301 </listitem>
302
[670f775]303 <listitem>
[5ee1266]304 <para>Allow the network connection when running as a part of the
[670f775]305 kvm group:</para>
306
307<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
308chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
309
310 </listitem>
311
312 <listitem>
313 <para>Set up a required configuration file:</para>
314
315<screen role="root"><userinput>echo 'allow br0' &gt; /etc/qemu/bridge.conf</userinput></screen>
316
317 </listitem>
318
319<!--
[d28198d3]320 <listitem>
[0d7900a]321 <para>Create scripts for qemu to attach the client network
[d28198d3]322 device, usually visible as tap0, to the host bridge.</para>
323
[58196bbf]324<screen role="root"><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; EOF
[d28198d3]325#!/bin/bash
326
327switch=br0
328
[71e6ae5]329if [ -n "\$1" ]; then
[d28198d3]330 # Add new tap0 interface to bridge
[71e6ae5]331 /sbin/ip link set \$1 up
[d28198d3]332 sleep 0.5s
[71e6ae5]333 /usr/sbin/brctl addif \$switch \$1
[d28198d3]334else
335 echo "Error: no interface specified"
336 exit 1
337fi
338
[0d7900a]339exit 0
[71e6ae5]340EOF
341
342chmod +x /etc/qemu-ifup</userinput></screen>
[d28198d3]343
[58196bbf]344<screen role="root"><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; EOF
[d28198d3]345#!/bin/bash
346
347switch=br0
348
[71e6ae5]349if [ -n "\$1" ]; then
[d28198d3]350 # Remove tap0 interface from bridge
[71e6ae5]351 /usr/sbin/brctl delif \$switch \$1
[d28198d3]352else
353 echo "Error: no interface specified"
354 exit 1
355fi
356
[0d7900a]357exit 0
[71e6ae5]358EOF
359
360chmod +x /etc/qemu-ifdown</userinput></screen>
[d28198d3]361
362 </listitem>
[71e6ae5]363 </itemizedlist>
364
[e88d7000]365 <note><para>The backslashes in the above script are for convenience
[71e6ae5]366 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
367 appear in the final scripts.</para></note>
[d28198d3]368
[670f775]369 <itemizedlist spacing="compact"> -->
[d28198d3]370 <listitem>
[670f775]371 <!--<para>Start qemu with "-net nic -net tap" options. </para>-->
372 <para>Start qemu with "-net nic -net bridge" options. </para>
[d28198d3]373 </listitem>
374
375 <listitem>
[0d7900a]376 <para>If a connection, such as ssh, from the local network to the
[670f775]377 client VM is desired, the client should be configured
[d28198d3]378 with a static IP address.</para>
379 </listitem>
380
381 </itemizedlist>
382
383 </sect2>
384
385 <sect2 role="content">
386 <title>Contents</title>
387
388 <segmentedlist>
[9b13441]389 <segtitle>Installed Programs</segtitle>
390 <segtitle>Installed Library</segtitle>
[d28198d3]391 <segtitle>Installed Directories</segtitle>
392
393 <seglistitem>
[9b13441]394 <seg>
395 qemu-ga,
396 qemu-img,
397 qemu-io,
398 qemu-nbd,
399 qemu-system-x86_64,
400 virtfs-proxy-helper, and
401 vscclient
402 </seg>
[8ade43b]403 <seg>libcacard.so</seg>
[9b13441]404 <seg>
405 /etc/qemu,
406 /usr/include/cacard,
407 /usr/lib/qemu,
408 /usr/share/qemu, and
409 /usr/share/doc/qemu-&qemu-version;
410 </seg>
[d28198d3]411 </seglistitem>
412 </segmentedlist>
413
414 <variablelist>
415 <bridgehead renderas="sect3">Short Description</bridgehead>
416 <?dbfo list-presentation="list"?>
417 <?dbhtml list-presentation="table"?>
418
419 <varlistentry id="qemu-ga">
420 <term><command>qemu-ga</command></term>
421 <listitem>
422 <para>implements support for QMP (QEMU Monitor Protocol) commands and
423 events that terminate and originate respectively within the guest
424 using an agent built as part of QEMU.</para>
[2f6053d]425 <indexterm zone="qemu qemu-ga">
[d28198d3]426 <primary sortas="b-qemu-ga">qemu-ga</primary>
427 </indexterm>
428 </listitem>
429 </varlistentry>
430
431 <varlistentry id="qemu-img">
432 <term><command>qemu-img</command></term>
433 <listitem>
434 <para>provides commands to manage QEMU disk images.</para>
[2f6053d]435 <indexterm zone="qemu qemu-img">
[d28198d3]436 <primary sortas="b-qemu-img">qemu-img</primary>
437 </indexterm>
438 </listitem>
439 </varlistentry>
440
441 <varlistentry id="qemu-io">
442 <term><command>qemu-io</command></term>
443 <listitem>
444 <para>is a diagnostic and manipulation program for (virtual) memory
445 media. It is still at an early stage of development.</para>
[2f6053d]446 <indexterm zone="qemu qemu-io">
[d28198d3]447 <primary sortas="b-qemu-io">qemu-io</primary>
448 </indexterm>
449 </listitem>
450 </varlistentry>
451
452 <varlistentry id="qemu-nbd">
453 <term><command>qemu-nbd</command></term>
454 <listitem>
455 <para>exports Qemu disk images using the QEMU Disk Network Block
456 Device (NBD) protocol.</para>
[2f6053d]457 <indexterm zone="qemu qemu-nbd">
[d28198d3]458 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
459 </indexterm>
460 </listitem>
461 </varlistentry>
462
463 <varlistentry id="qemu-system">
464 <term><command>qemu-system-x86_64</command></term>
465 <listitem>
466 <para>is the QEMU PC System emulator.</para>
[2f6053d]467 <indexterm zone="qemu qemu-system">
[d28198d3]468 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
469 </indexterm>
470 </listitem>
471 </varlistentry>
[8ade43b]472
[72d90b67]473 <varlistentry id="virtfs-proxy-helper">
474 <term><command>virtfs-proxy-helper</command></term>
475 <listitem>
476 <para>creates a socket pair or a named socket. QEMU and proxy helper
477 communicate using this socket. QEMU proxy fs driver sends
478 filesystem request to proxy helper and receives the response
479 from it.</para>
480 <indexterm zone="qemu virtfs-proxy-helper">
481 <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
482 </indexterm>
483 </listitem>
484 </varlistentry>
485
486 <varlistentry id="vscclient">
487 <term><command>vscclient</command></term>
488 <listitem>
489 <para>implements a sockets interface to the virtual CCID reader
490 on the guest.</para>
491 <indexterm zone="qemu vscclient">
492 <primary sortas="b-vscclient">vscclient</primary>
493 </indexterm>
494 </listitem>
495 </varlistentry>
496
[9b13441]497 <varlistentry id="libcacard">
498 <term><filename class="libraryfile">libcacard.so</filename></term>
499 <listitem>
500 <para>is the Virtual Smart Card Emulator library.</para>
501 <indexterm zone="qemu libcacard">
502 <primary sortas="c-libcacard">libcacard.so</primary>
503 </indexterm>
504 </listitem>
505 </varlistentry>
[8ade43b]506
[d28198d3]507 </variablelist>
508
509 </sect2>
510
511</sect1>
Note: See TracBrowser for help on using the repository browser.