source: postlfs/virtualization/qemu.xml@ 9b13441

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 9b13441 was 9b13441, checked in by Igor Živković <igor@…>, 10 years ago

update to qemu-1.7.0

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

  • Property mode set to 100644
File size: 13.8 KB
Line 
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 "32893941d40d052a5e649efcf06aca06">
10 <!ENTITY qemu-size "12 MB">
11 <!ENTITY qemu-buildsize "215 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">Qemu Dependencies</bridgehead>
61
62 <bridgehead renderas="sect4">Required</bridgehead>
63 <para role="required">
64 <xref linkend="glib2"/>,
65 <xref linkend="python2"/>,
66 <xref linkend="sdl"/>, and
67 <xref linkend="x-window-system"/>
68 </para>
69
70 <bridgehead renderas="sect4">Optional</bridgehead>
71 <para role="optional">
72 <xref linkend="alsa"/>,
73 <xref linkend="attr"/>,
74 <xref linkend="check"/>,
75 <xref linkend="curl"/>,
76 <xref linkend="mesalib"/>, and
77 <xref linkend="cyrus-sasl"/>
78 </para>
79
80 <note>
81 <para>
82 This optional dependencies list is not comprehensive. See the output of
83 <command>./configure --help</command> for a more complete list.
84 </para>
85 </note>
86
87 <para condition="html" role="usernotes">User Notes:
88 <ulink url="&blfs-wiki;/qemu"/></para>
89
90 </sect2>
91
92 <sect2 id='qemu-prereq'>
93 <title>KVM Prerequsites</title>
94
95 <para>Before building <application>qemu</application>, check to see if
96 your processor supports Virtualization Technology (VT):</para>
97
98 <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
99
100 <para>If you get any output, you have VT technology (vmx for Intel
101 processors and svm for AMD processors). You then need to go into your
102 system BIOS and ensure it is enabled. After enabing, reboot back to your
103 LFS instance.</para>
104
105 </sect2>
106
107 <sect2 role="kernel" id='qemu-kernel'>
108 <title>Kernel Configuration</title>
109
110 <para>Enable the following options in the kernel configuration
111 and recompile the kernel if necessary:</para>
112
113<screen><literal>Virtualization: ---&gt;
114 Kernel-based Virtual Machine (KVM) support: Y or M
115 KVM for Intel processors support: Y or M
116 KVM for AMD processors support: Y or M</literal></screen>
117
118 <indexterm zone="qemu qemu-kernel">
119 <primary sortas="d-qemu">qemu</primary>
120 </indexterm>
121
122 <para>The Intel or AMD settings are not both required, but the one matching
123 your system processor is required.</para>
124
125 <para>For networking, check that <xref linkend='bridgeutils'/> is installed
126 and the following options in the kernel configuration are enabled:</para>
127
128<screen><literal>Networking support ---&gt;
129 Networking options ---&gt;
130 802.1d Ethernet Bridging: Y or M
131Device Drivers ---&gt;
132 Network device support ---&gt;
133 Universal TUN/TAP device driver support: Y or M</literal></screen>
134
135 </sect2>
136
137 <sect2 role="installation">
138 <title>Installation of qemu</title>
139
140 <para>If <application>xorg</application> is not installed in
141 <filename class='directory'>/usr</filename>, then the linker needs to
142 be told where it is. For example:</para>
143
144<screen><userinput>export LIBRARY_PATH=/opt/xorg/lib</userinput></screen>
145
146 <para>Install <application>qemu</application> by running the following
147 commands:</para>
148
149<screen><userinput>./configure --prefix=/usr \
150 --sysconfdir=/etc \
151 --libexecdir=/usr/lib/qemu \
152 --docdir=/usr/share/doc/qemu-&qemu-version; \
153 --target-list=x86_64-softmmu &amp;&amp;
154make</userinput></screen>
155
156 <para>To run the built in tests, run <command>make V=1 check</command>.</para>
157
158 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
159
160<screen role="root"><userinput>make install &amp;&amp;
161chmod -v 755 /usr/lib/libcacard.so</userinput></screen>
162
163 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
164 make a distinction between i386 and x86_64 so even on an i386 system you
165 should use <emphasis>qemu-system-x86_64</emphasis></para>
166 -->
167
168 <para>For convenience you may want to create a symbolic link to run
169 <command>qemu-system-x86_64</command>:</para>
170
171 <screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
172 </note>
173
174 </sect2>
175
176 <sect2 role="commands">
177 <title>Command Explanations</title>
178
179 <para><parameter>--target-list=x86_64-softmmu</parameter>: This switch
180 limits the build target to the x86_64 architecture. For other
181 hardware emulation see the --target-list list in <command>configure</command>'s
182 help output. Omitting this option will build all architectures.</para>
183
184 <para><parameter>export ARFLAGS="rv"</parameter> : this works around a problem
185 in the <command>configure</command> script exposed by make-4.0.</para>
186
187 <para>
188 <option>--audio-drv-list=alsa</option>: This switch sets the audio driver
189 to ALSA. For other drivers see the --audio-drv-list list in
190 <command>configure</command>'s help output. The default audio driver is
191 OSS.
192 </para>
193
194 </sect2>
195
196 <sect2 role="configuration">
197 <title>Configuring qemu</title>
198
199 <para>To generate an image, run:</para>
200
201 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
202
203 <para>Adjust the virtual disk size and image filename as desired. The
204 actual size of the file will be less than specified, but will expand as it
205 is used.</para>
206
207 <note><para>The following instructions assume you have created the optional
208 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
209 <userinput>qemu</userinput> from an X-Windows based terminal.</para></note>
210
211 <para>To install an operating system, download an iso of your choice or use
212 a pre-intalled cdrom device. For the purposes of this example, use
213 Fedora 16 that is downloaded as
214 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
215 directory. Run the following:</para>
216
217<screen><userinput>qemu -enable-kvm -hda vdisk.img \
218 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
219 -boot d \
220 -m 384</userinput></screen>
221
222 <para>Follow the normal installation procedures for the chosen
223 distribution. The -boot option specifies the boot order of drives as a
224 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
225 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
226 to use for the virtual machine. If you have sufficient memory (2G or
227 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
228 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
229 for hardware acceleeration. Without this switch, the emulation is
230 relatively slow.</para>
231
232 <para>To run the newly installed operating system, run:</para>
233
234<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
235
236 <para>To add networking to the instance add "-net nic -net user" to the
237 command above. qemu provides a DHCP server for the VM and, depending on
238 the client system, sets up networking though the host.</para>
239
240 <para>One problem with the above networking solution is that it does not
241 provide the ability to connect with the local network. To do that, there are
242 several additional steps that need to be done, all as the <systemitem
243 class="username">root</systemitem> user:</para>
244
245 <itemizedlist spacing="compact">
246 <listitem>
247 <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
248 </listitem>
249
250 <listitem>
251 <para>Allow the host system to forward IP packets.</para>
252
253<screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
254
255 <para>To make this permanent, add the command to
256 <filename>/etc/syssysctl.conf:</filename></para>
257
258<screen><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
259net.ipv4.ip_forward=1
260EOF</userinput></screen>
261
262 </listitem>
263
264 <listitem>
265 <para>Create scripts for qemu to attach the client network
266 device, usually visible as tap0, to the host bridge.</para>
267
268<screen><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; EOF
269#!/bin/bash
270
271switch=br0
272
273if [ -n "\$1" ]; then
274 # Add new tap0 interface to bridge
275 /sbin/ip link set \$1 up
276 sleep 0.5s
277 /usr/sbin/brctl addif \$switch \$1
278else
279 echo "Error: no interface specified"
280 exit 1
281fi
282
283exit 0
284EOF
285
286chmod +x /etc/qemu-ifup</userinput></screen>
287
288<screen><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; EOF
289#!/bin/bash
290
291switch=br0
292
293if [ -n "\$1" ]; then
294 # Remove tap0 interface from bridge
295 /usr/sbin/brctl delif \$switch \$1
296else
297 echo "Error: no interface specified"
298 exit 1
299fi
300
301exit 0
302EOF
303
304chmod +x /etc/qemu-ifdown</userinput></screen>
305
306 </listitem>
307 </itemizedlist>
308
309 <note><para>The backslashes in the above script are for convenience
310 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
311 appear in the final scripts.</para></note>
312
313 <itemizedlist spacing="compact">
314 <listitem>
315 <para>Start qemu with "-net nic -net tap" options. </para>
316 </listitem>
317
318 <listitem>
319 <para>If a connection, such as ssh, from the local network to the
320 client VM is desired, the client should probably be configured
321 with a static IP address.</para>
322 </listitem>
323
324 </itemizedlist>
325
326 </sect2>
327
328 <sect2 role="content">
329 <title>Contents</title>
330
331 <segmentedlist>
332 <segtitle>Installed Programs</segtitle>
333 <segtitle>Installed Library</segtitle>
334 <segtitle>Installed Directories</segtitle>
335
336 <seglistitem>
337 <seg>
338 qemu-ga,
339 qemu-img,
340 qemu-io,
341 qemu-nbd,
342 qemu-system-x86_64,
343 virtfs-proxy-helper, and
344 vscclient
345 </seg>
346 <seg>libcacard.so</seg>
347 <seg>
348 /etc/qemu,
349 /usr/include/cacard,
350 /usr/lib/qemu,
351 /usr/share/qemu, and
352 /usr/share/doc/qemu-&qemu-version;
353 </seg>
354 </seglistitem>
355 </segmentedlist>
356
357 <variablelist>
358 <bridgehead renderas="sect3">Short Description</bridgehead>
359 <?dbfo list-presentation="list"?>
360 <?dbhtml list-presentation="table"?>
361
362 <varlistentry id="qemu-ga">
363 <term><command>qemu-ga</command></term>
364 <listitem>
365 <para>implements support for QMP (QEMU Monitor Protocol) commands and
366 events that terminate and originate respectively within the guest
367 using an agent built as part of QEMU.</para>
368 <indexterm zone="qemu qemu-ga">
369 <primary sortas="b-qemu-ga">qemu-ga</primary>
370 </indexterm>
371 </listitem>
372 </varlistentry>
373
374 <varlistentry id="qemu-img">
375 <term><command>qemu-img</command></term>
376 <listitem>
377 <para>provides commands to manage QEMU disk images.</para>
378 <indexterm zone="qemu qemu-img">
379 <primary sortas="b-qemu-img">qemu-img</primary>
380 </indexterm>
381 </listitem>
382 </varlistentry>
383
384 <varlistentry id="qemu-io">
385 <term><command>qemu-io</command></term>
386 <listitem>
387 <para>is a diagnostic and manipulation program for (virtual) memory
388 media. It is still at an early stage of development.</para>
389 <indexterm zone="qemu qemu-io">
390 <primary sortas="b-qemu-io">qemu-io</primary>
391 </indexterm>
392 </listitem>
393 </varlistentry>
394
395 <varlistentry id="qemu-nbd">
396 <term><command>qemu-nbd</command></term>
397 <listitem>
398 <para>exports Qemu disk images using the QEMU Disk Network Block
399 Device (NBD) protocol.</para>
400 <indexterm zone="qemu qemu-nbd">
401 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
402 </indexterm>
403 </listitem>
404 </varlistentry>
405
406 <varlistentry id="qemu-system">
407 <term><command>qemu-system-x86_64</command></term>
408 <listitem>
409 <para>is the QEMU PC System emulator.</para>
410 <indexterm zone="qemu qemu-system">
411 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
412 </indexterm>
413 </listitem>
414 </varlistentry>
415
416 <varlistentry id="libcacard">
417 <term><filename class="libraryfile">libcacard.so</filename></term>
418 <listitem>
419 <para>is the Virtual Smart Card Emulator library.</para>
420 <indexterm zone="qemu libcacard">
421 <primary sortas="c-libcacard">libcacard.so</primary>
422 </indexterm>
423 </listitem>
424 </varlistentry>
425
426 </variablelist>
427
428 </sect2>
429
430</sect1>
Note: See TracBrowser for help on using the repository browser.