source: postlfs/virtualization/qemu.xml@ 2f6053d

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.4 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 2f6053d was 2f6053d, checked in by Bruce Dubbs <bdubbs@…>, 11 years ago

Update to qemu-1.4.0

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

  • Property mode set to 100644
File size: 12.5 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 "78f13b774814b6b7ebcaf4f9b9204318">
10 <!ENTITY qemu-size "10 MB">
11 <!ENTITY qemu-buildsize "188 MB">
12 <!ENTITY qemu-time "1.5 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 &lfs73_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>patch -Np1 -i ../qemu-&qemu-version;-fixes-1.patch
148./configure --prefix=/usr \
149 --sysconfdir=/etc \
150 --target-list=x86_64-softmmu &amp;&amp;
151make</userinput></screen>
152
153 <para>To run the built in tests, run <command>make V=1 check</command>.</para>
154
155 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
156
157<screen role="root"><userinput>make install</userinput></screen>
158
159 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
160 make a distinction between i386 and x86_64 so even on an i386 system you
161 should use <emphasis>qemu-system-x86_64</emphasis></para>
162 -->
163
164 <para>For convenience you may want to create a symbolic link to run
165 <command>qemu-system-x86_64</command>:</para>
166
167 <screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
168 </note>
169
170 </sect2>
171
172 <sect2 role="commands">
173 <title>Command Explanations</title>
174
175 <para><parameter>--target-list=x86_64-softmmu</parameter>: This option
176 limits the build target to the x86_64 architecture. For other
177 hardware emulation see the --target-list list in <command>configure</command>'s
178 help output. Omitting this option will build all architectures.</para>
179
180 </sect2>
181
182
183
184 <sect2 role="configuration">
185 <title>Configuring qemu</title>
186
187 <para>To generate an image, run:</para>
188
189 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
190
191 <para>Adjust the virtual disk size and image filename as desired. The
192 actual size of the file will be less than specified, but will expand as it
193 is used.</para>
194
195 <note><para>The following instructions assume you have created the optional
196 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
197 <userinput>qemu</userinput> from an X-Windows based terminal.</para></note>
198
199 <para>To install an operating system, download an iso of your choice or use
200 a pre-intalled cdrom device. For the purposes of this example, use
201 Fedora 16 that is downloaded as
202 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
203 directory. Run the following:</para>
204
205<screen><userinput>qemu -enable-kvm -hda vdisk.img \
206 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
207 -boot d \
208 -m 384</userinput></screen>
209
210 <para>Follow the normal installation procedures for the chosen
211 distribution. The -boot option specifies the boot order of drives as a
212 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
213 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
214 to use for the virtual machine. If you have sufficient memory (2G or
215 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
216 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
217 for hardware acceleeration. Without this switch, the emulation is
218 relatively slow.</para>
219
220 <para>To run the newly installed operating system, run:</para>
221
222<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
223
224 <para>To add networking to the instance add "-net nic -net user" to the
225 command above. qemu provides a DHCP server for the VM and, depending on
226 the client system, sets up networking though the host.</para>
227
228 <para>One problem with the above networking solution is that it does not
229 provide the ability to connect with the local network. To do that, there are
230 several additional steps that need to be done, all as the <systemitem
231 class="username">root</systemitem> user:</para>
232
233 <itemizedlist spacing="compact">
234 <listitem>
235 <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
236 </listitem>
237
238 <listitem>
239 <para>Allow the host system to forward IP packets.</para>
240
241<screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
242
243 <para>To make this permanent, add the command to
244 <filename>/etc/syssysctl.conf:</filename></para>
245
246<screen><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
247net.ipv4.ip_forward=1
248EOF</userinput></screen>
249
250 </listitem>
251
252 <listitem>
253 <para>Create scripts for qemu to attach the client network
254 device, usually visible as tap0, to the host bridge.</para>
255
256<screen><userinput>cat &gt;&gt; /etc/qemu-ifup &lt;&lt; EOF
257#!/bin/bash
258
259switch=br0
260
261if [ -n "$1" ]; then
262 # Add new tap0 interface to bridge
263 /sbin/ip link set $1 up
264 sleep 0.5s
265 /usr/sbin/brctl addif $switch $1
266else
267 echo "Error: no interface specified"
268 exit 1
269fi
270
271exit 0
272EOF</userinput></screen>
273
274<screen><userinput>cat &gt;&gt; /etc/qemu-ifdown &lt;&lt; EOF
275#!/bin/bash
276
277switch=br0
278
279if [ -n "$1" ]; then
280 # Remove tap0 interface from bridge
281 /usr/sbin/brctl delif $switch $1
282else
283 echo "Error: no interface specified"
284 exit 1
285fi
286
287exit 0
288EOF</userinput></screen>
289
290 </listitem>
291
292 <listitem>
293 <para>Start qemu with "-net nic -net tap" options. </para>
294 </listitem>
295
296 <listitem>
297 <para>If a connection, such as ssh, from the local network to the
298 client VM is desired, the client should probably be configured
299 with a static IP address.</para>
300 </listitem>
301
302 </itemizedlist>
303
304 </sect2>
305
306 <sect2 role="content">
307 <title>Contents</title>
308
309 <segmentedlist>
310 <segtitle>Installed Program</segtitle>
311 <segtitle>Installed Libraries</segtitle>
312 <segtitle>Installed Directories</segtitle>
313
314 <seglistitem>
315 <seg>qemu-ga, qemu-img, qemu-io, qemu-nbd, qemu-system-x86_64</seg>
316 <seg>None</seg>
317 <seg>/etc/qemu, /usr/share/qemu, /usr/share/doc/qemu</seg>
318 </seglistitem>
319 </segmentedlist>
320
321 <variablelist>
322 <bridgehead renderas="sect3">Short Description</bridgehead>
323 <?dbfo list-presentation="list"?>
324 <?dbhtml list-presentation="table"?>
325
326 <varlistentry id="qemu-ga">
327 <term><command>qemu-ga</command></term>
328 <listitem>
329 <para>implements support for QMP (QEMU Monitor Protocol) commands and
330 events that terminate and originate respectively within the guest
331 using an agent built as part of QEMU.</para>
332 <indexterm zone="qemu qemu-ga">
333 <primary sortas="b-qemu-ga">qemu-ga</primary>
334 </indexterm>
335 </listitem>
336 </varlistentry>
337
338 <varlistentry id="qemu-img">
339 <term><command>qemu-img</command></term>
340 <listitem>
341 <para>provides commands to manage QEMU disk images.</para>
342 <indexterm zone="qemu qemu-img">
343 <primary sortas="b-qemu-img">qemu-img</primary>
344 </indexterm>
345 </listitem>
346 </varlistentry>
347
348 <varlistentry id="qemu-io">
349 <term><command>qemu-io</command></term>
350 <listitem>
351 <para>is a diagnostic and manipulation program for (virtual) memory
352 media. It is still at an early stage of development.</para>
353 <indexterm zone="qemu qemu-io">
354 <primary sortas="b-qemu-io">qemu-io</primary>
355 </indexterm>
356 </listitem>
357 </varlistentry>
358
359 <varlistentry id="qemu-nbd">
360 <term><command>qemu-nbd</command></term>
361 <listitem>
362 <para>exports Qemu disk images using the QEMU Disk Network Block
363 Device (NBD) protocol.</para>
364 <indexterm zone="qemu qemu-nbd">
365 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
366 </indexterm>
367 </listitem>
368 </varlistentry>
369
370 <varlistentry id="qemu-system">
371 <term><command>qemu-system-x86_64</command></term>
372 <listitem>
373 <para>is the QEMU PC System emulator.</para>
374 <indexterm zone="qemu qemu-system">
375 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
376 </indexterm>
377 </listitem>
378 </varlistentry>
379
380 </variablelist>
381
382 </sect2>
383
384</sect1>
Note: See TracBrowser for help on using the repository browser.