source: postlfs/virtualization/qemu.xml@ 510d254

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 510d254 was 510d254, checked in by Bruce Dubbs <bdubbs@…>, 11 years ago

Update to qemu-1.5.0

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

  • Property mode set to 100644
File size: 12.8 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 " ">
[510d254]9 <!ENTITY qemu-md5sum "b6f3265b8ed39d77e8f354f35cc26e16">
10 <!ENTITY qemu-size "11.4 MB">
11 <!ENTITY qemu-buildsize "189 MB">
12 <!ENTITY qemu-time "2.0 SBU">
[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
[6a54383]36 &lfs73_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>
[510d254]59<!--
[6a54383]60 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
61 <itemizedlist spacing='compact'>
62 <listitem>
63 <para>Required Patch: <ulink
[2f6053d]64 url="&patch-root;/qemu-&qemu-version;-fixes-1.patch"/></para>
[6a54383]65 </listitem>
66 </itemizedlist>
[510d254]67-->
[2f6053d]68 <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
[d28198d3]69
70 <bridgehead renderas="sect4">Required</bridgehead>
71 <para role="required">
[aa4778c4]72 <xref linkend="glib2"/>,
[4716d52]73 <xref linkend="python2"/>,
[d28198d3]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:
[2f6053d]92 <ulink url="&blfs-wiki;/qemu"/></para>
[d28198d3]93
94 </sect2>
95
[2f6053d]96 <sect2 id='qemu-prereq'>
[d28198d3]97 <title>KVM Prerequsites</title>
98
[2f6053d]99 <para>Before building <application>qemu</application>, check to see if
[d28198d3]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
[2f6053d]111 <sect2 role="kernel" id='qemu-kernel'>
[d28198d3]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
[2f6053d]122 <indexterm zone="qemu qemu-kernel">
123 <primary sortas="d-qemu">qemu</primary>
[d28198d3]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">
[2f6053d]136 <title>Installation of qemu</title>
[0d7900a]137
[d28198d3]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
[2f6053d]144 <para>Install <application>qemu</application> by running the following
[d28198d3]145 commands:</para>
146
[510d254]147<screen><userinput>./configure --prefix=/usr \
[2f6053d]148 --sysconfdir=/etc \
149 --target-list=x86_64-softmmu &amp;&amp;
150make</userinput></screen>
[d28198d3]151
[2f6053d]152 <para>To run the built in tests, run <command>make V=1 check</command>.</para>
[d28198d3]153
154 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
155
156<screen role="root"><userinput>make install</userinput></screen>
[2f6053d]157
158 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
[d28198d3]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>
[2f6053d]161 -->
[0d7900a]162
[d28198d3]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
[6a54383]171 <sect2 role="commands">
172 <title>Command Explanations</title>
173
[2f6053d]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>
[6a54383]178
179 </sect2>
180
181
182
[d28198d3]183 <sect2 role="configuration">
[2f6053d]184 <title>Configuring qemu</title>
[d28198d3]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
[2f6053d]196 <userinput>qemu</userinput> from an X-Windows based terminal.</para></note>
[d28198d3]197
198 <para>To install an operating system, download an iso of your choice or use
[ec64d28]199 a pre-intalled cdrom device. For the purposes of this example, use
[d28198d3]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
[2f6053d]204<screen><userinput>qemu -enable-kvm -hda vdisk.img \
[0d7900a]205 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
[d28198d3]206 -boot d \
207 -m 384</userinput></screen>
208
209 <para>Follow the normal installation procedures for the chosen
[2f6053d]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>
[d28198d3]218
219 <para>To run the newly installed operating system, run:</para>
220
[2f6053d]221<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
[d28198d3]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
[0d7900a]228 provide the ability to connect with the local network. To do that, there are
[d28198d3]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>
[0d7900a]241
242 <para>To make this permanent, add the command to
[d28198d3]243 <filename>/etc/syssysctl.conf:</filename></para>
244
245<screen><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
[0d7900a]246net.ipv4.ip_forward=1
[d28198d3]247EOF</userinput></screen>
248
249 </listitem>
250
251 <listitem>
[0d7900a]252 <para>Create scripts for qemu to attach the client network
[d28198d3]253 device, usually visible as tap0, to the host bridge.</para>
254
255<screen><userinput>cat &gt;&gt; /etc/qemu-ifup &lt;&lt; EOF
256#!/bin/bash
257
258switch=br0
259
[71e6ae5]260if [ -n "\$1" ]; then
[d28198d3]261 # Add new tap0 interface to bridge
[71e6ae5]262 /sbin/ip link set \$1 up
[d28198d3]263 sleep 0.5s
[71e6ae5]264 /usr/sbin/brctl addif \$switch \$1
[d28198d3]265else
266 echo "Error: no interface specified"
267 exit 1
268fi
269
[0d7900a]270exit 0
[71e6ae5]271EOF
272
273chmod +x /etc/qemu-ifup</userinput></screen>
[d28198d3]274
275<screen><userinput>cat &gt;&gt; /etc/qemu-ifdown &lt;&lt; EOF
276#!/bin/bash
277
278switch=br0
279
[71e6ae5]280if [ -n "\$1" ]; then
[d28198d3]281 # Remove tap0 interface from bridge
[71e6ae5]282 /usr/sbin/brctl delif \$switch \$1
[d28198d3]283else
284 echo "Error: no interface specified"
285 exit 1
286fi
287
[0d7900a]288exit 0
[71e6ae5]289EOF
290
291chmod +x /etc/qemu-ifdown</userinput></screen>
[d28198d3]292
293 </listitem>
[71e6ae5]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>
[d28198d3]299
[71e6ae5]300 <itemizedlist spacing="compact">
[d28198d3]301 <listitem>
302 <para>Start qemu with "-net nic -net tap" options. </para>
303 </listitem>
304
305 <listitem>
[0d7900a]306 <para>If a connection, such as ssh, from the local network to the
[d28198d3]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>
[2f6053d]341 <indexterm zone="qemu qemu-ga">
[d28198d3]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>
[2f6053d]351 <indexterm zone="qemu qemu-img">
[d28198d3]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>
[2f6053d]362 <indexterm zone="qemu qemu-io">
[d28198d3]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>
[2f6053d]373 <indexterm zone="qemu qemu-nbd">
[d28198d3]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>
[2f6053d]383 <indexterm zone="qemu qemu-system">
[d28198d3]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>
Note: See TracBrowser for help on using the repository browser.