source: postlfs/virtualization/qemu.xml@ 3fde159

12.1 gimp3 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18
Last change on this file since 3fde159 was 520f69df, checked in by Xi Ruoyao <xry111@…>, 9 months ago

qemu: Add pixman as required dependency

By the way, add a lot of optional and external dependencies.

Reported-by: wen zhang <zhw2101024@…>
Link: https://lists.linuxfromscratch.org/sympa/arc/blfs-dev/2023-10/msg00064.html

  • Property mode set to 100644
File size: 27.0 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
[75e93d0]7 <!ENTITY qemu-download-http "https://download.qemu.org/qemu-&qemu-version;.tar.xz">
[2f6053d]8 <!ENTITY qemu-download-ftp " ">
[ea4d812]9 <!ENTITY qemu-md5sum "f7e3443d5b62afa0c10771ad42c5e17a">
[ec5d9991]10 <!ENTITY qemu-size "118 MB">
[f5413e1]11 <!ENTITY qemu-buildsize "2.7 GB (563 MB installed)">
[ec5d9991]12 <!ENTITY qemu-time "1.2 SBU (add 0.8 SBU for tests, both using parallelism=4)">
[d28198d3]13]>
14
[2f6053d]15<sect1 id="qemu" xreflabel="qemu-&qemu-version;">
16 <?dbhtml filename="qemu.html"?>
[d28198d3]17
18
[2f6053d]19 <title>qemu-&qemu-version;</title>
[d28198d3]20
[2f6053d]21 <indexterm zone="qemu">
22 <primary sortas="a-qemu">qemu</primary>
[d28198d3]23 </indexterm>
24
25 <sect2 role="package">
[2f6053d]26 <title>Introduction to qemu</title>
[d28198d3]27
[47274444]28 <para>
29 <application>qemu</application> is a full virtualization solution for
30 Linux on x86 hardware containing virtualization extensions (Intel VT or
31 AMD-V).
32 </para>
[d28198d3]33
[ec5d9991]34 &lfs120_checked;
[27643d0f]35
[d28198d3]36 <bridgehead renderas="sect3">Package Information</bridgehead>
37 <itemizedlist spacing="compact">
38 <listitem>
[47274444]39 <para>
40 Download (HTTP): <ulink url="&qemu-download-http;"/>
41 </para>
[d28198d3]42 </listitem>
43 <listitem>
[47274444]44 <para>
45 Download (FTP): <ulink url="&qemu-download-ftp;"/>
46 </para>
[d28198d3]47 </listitem>
48 <listitem>
[47274444]49 <para>
50 Download MD5 sum: &qemu-md5sum;
51 </para>
[d28198d3]52 </listitem>
53 <listitem>
[47274444]54 <para>
55 Download size: &qemu-size;
56 </para>
[d28198d3]57 </listitem>
58 <listitem>
[47274444]59 <para>
60 Estimated disk space required: &qemu-buildsize;
61 </para>
[d28198d3]62 </listitem>
63 <listitem>
[47274444]64 <para>
65 Estimated build time: &qemu-time;
66 </para>
[d28198d3]67 </listitem>
68 </itemizedlist>
[54f740f]69
[2f6053d]70 <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
[d28198d3]71
72 <bridgehead renderas="sect4">Required</bridgehead>
73 <para role="required">
[520f69df]74 <xref linkend="glib2"/> and
75 <xref linkend="pixman"/>
[d28198d3]76 </para>
77
[c41b38f]78 <bridgehead renderas="sect4">Recommended</bridgehead>
79 <para role="recommended">
[50ba3b3]80 <xref linkend="alsa-lib"/>,
81 <xref linkend="libslirp"/>, and
[b4c31a6]82 <xref linkend="sdl2"/>
[c41b38f]83 </para>
84
[d28198d3]85 <bridgehead renderas="sect4">Optional</bridgehead>
86 <para role="optional">
[520f69df]87 <xref linkend="pipewire"/> or
88 <xref linkend="pulseaudio"/> (can be used instead of alsa-lib),
[8ade43b]89 <xref linkend="bluez"/>,
[d28198d3]90 <xref linkend="curl"/>,
[8ade43b]91 <xref linkend="cyrus-sasl"/>,
[520f69df]92 <xref linkend="fuse3"/>,
[10f9bb45]93 <xref linkend="gnutls"/>,
[8ade43b]94 <xref linkend="gtk3"/>,
[520f69df]95 <xref linkend="keyutils"/>,
96 <xref linkend="libaio"/>,
[8ade43b]97 <xref linkend="libusb"/>,
[10f9bb45]98 <xref linkend="libgcrypt"/>,
[520f69df]99 <xref linkend="libjpeg"/>,
100 <xref linkend="libseccomp"/>,
[fee79e2]101 <xref linkend="libssh2"/>,
[520f69df]102 <xref linkend="libpng"/>,
103 <xref linkend="libtasn1"/>,
104 <xref linkend="linux-pam"/>,
[8ade43b]105 <xref linkend="lzo"/>,
[10f9bb45]106 <xref linkend="nettle"/>,
107 <xref linkend="mesa"/>,
[520f69df]108 <xref role="nodep" linkend="vte"/>,
[b4c31a6]109<!-- libcacard has been a standalone project since qemu-2.5.-->
[520f69df]110 <ulink url="https://www.capstone-engine.org/">capstone</ulink>,
111 <ulink url="https://github.com/ceph/ceph/">ceph</ulink>,
112 <ulink url="https://pmem.io/daxctl/">daxctl</ulink>,
113 <ulink url="https://jackaudio.org/">JACK</ulink>,
114 <ulink url="https://github.com/gluster/glusterfs">glusterfs</ulink>,
115 <ulink url="https://github.com/libbpf/libbpf">libbpf</ulink>,
116 <ulink url="https://gitlab.freedesktop.org/spice/libcacard">libcacard</ulink>,
117 <ulink url="https://people.redhat.com/sgrubb/libcap-ng/">libcap-ng</ulink>,
118 <ulink url="https://sourceware.org/elfutils/">libdw</ulink>,
119 <ulink url="https://github.com/dgibson/dtc">libfdt</ulink>,
120 <ulink url="https://github.com/sahlberg/libiscsi">libiscsi</ulink>,
121 <ulink url="https://github.com/sahlberg/libnfs">libnfs</ulink>,
122 <ulink url="https://pmem.io/pmdk/libpmem/">libpmem</ulink>,
123 <ulink url="https://www.libssh.org/">libssh</ulink>,
124 <ulink url="https://github.com/Agnoctopus/libu2f-emu">libu2f-emu</ulink>,
125 <ulink url="https://github.com/lzfse/lzfse">lzfse</ulink>,
126 <ulink url="https://github.com/luigirizzo/netmap">netmap</ulink>,
127 <ulink url="https://github.com/numactl/numactl">numactl</ulink>,
128 <ulink url="https://github.com/linux-rdma/rdma-core">rdma-core</ulink>,
129 <ulink url="https://selinuxproject.org/">SELinux</ulink>,
130 <ulink url="https://google.github.io/snappy/">snappy</ulink>,
131 <ulink url="https://gitlab.freedesktop.org/spice/spice">spice</ulink>,
132 <ulink url="https://gitlab.freedesktop.org/spice/usbredir">usbredir</ulink>,
133 and <ulink url="https://github.com/virtualsquare/vde-2">VDE</ulink>
[d28198d3]134 </para>
135
[0fea832]136 <bridgehead renderas="sect4">Optional (Runtime)</bridgehead>
137 <para role="runtime">
138 &logind;
139 </para>
140
[402910e]141 <bridgehead renderas="sect4">Optional (for building the documentation)</bridgehead>
[a541e080]142 <para role="optional">
[402910e]143 <xref linkend="sphinx_rtd_theme"/>
[a541e080]144 </para>
145
[9b13441]146 <note>
147 <para>
148 This optional dependencies list is not comprehensive. See the output of
149 <command>./configure --help</command> for a more complete list.
150 </para>
151 </note>
152
[42ddc30]153 <para condition="html" role="usernotes">Editor Notes:
[2f6053d]154 <ulink url="&blfs-wiki;/qemu"/></para>
[d28198d3]155
156 </sect2>
157
[2f6053d]158 <sect2 id='qemu-prereq'>
[1eb4fcf]159 <title>KVM Prerequisites</title>
[d28198d3]160
[47274444]161 <para>
162 Before building <application>qemu</application>, check to see if
163 your processor supports Virtualization Technology (VT):
164 </para>
[d28198d3]165
[d6b45f7]166 <screen><userinput>grep -E '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
[d28198d3]167
[47274444]168 <para>
169 If you get any output, you have VT technology (vmx for Intel
170 processors and svm for AMD processors). You then need to go into your
[b9c353b]171 system BIOS and ensure it is enabled. After enabling, reboot back to your
[47274444]172 LFS instance.
173 </para>
[d28198d3]174
175 </sect2>
176
[2f6053d]177 <sect2 role="kernel" id='qemu-kernel'>
[d28198d3]178 <title>Kernel Configuration</title>
179
[47274444]180 <para>
181 Enable the following options in the kernel configuration and
182 recompile the kernel if necessary:
183 </para>
[d28198d3]184
[9cc0aba5]185 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
186 href="qemu-kvm-kernel.xml"/>
[d28198d3]187
[2f6053d]188 <indexterm zone="qemu qemu-kernel">
189 <primary sortas="d-qemu">qemu</primary>
[d28198d3]190 </indexterm>
191
[47274444]192 <para>
193 The Intel or AMD settings are not both required, but the one matching
194 your system processor is required.
195 </para>
[d28198d3]196
[b4c31a6]197 <para>
198 To use the <quote>bridge</quote> network device, as explained below,
199 check that <xref linkend='bridgeutils'/> is installed
200 and the following options in the kernel configuration are enabled:
201 </para>
[9b13441]202
[9cc0aba5]203 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
204 href="qemu-bridge-kernel.xml"/>
[d28198d3]205
206 </sect2>
207
208 <sect2 role="installation">
[2f6053d]209 <title>Installation of qemu</title>
[fdec60a]210<!-- group kvm is created in lfs chapter 7 even for sysv
[9f309be]211 <para revision="sysv">
[b4c31a6]212 You will need a dedicated group that will contain users (other than root)
213 allowed to access the KVM device. Create this group by running the
214 following command as the
215 <systemitem class="username">root</systemitem> user:
216 </para>
217
[9f309be]218<screen role="root" revision="sysv"><userinput>groupadd -g 61 kvm</userinput></screen>
[fdec60a]219-->
[b4c31a6]220 <para>
[0fea832]221 The udev rule of LFS only allows the &root; user, the users owning
222 a local login session supported by the optional runtime dependency
223 &logind;, or the users in the
224 <systemitem class="groupname">kvm</systemitem> group to use the KVM
225 device. As the &root; user, add any non-&root; users that might use
226 the KVM device either without &logind; installed or remotely (via a
227 SSH connection) to the
228 <systemitem class="groupname">kvm</systemitem> group:
[b4c31a6]229 </para>
230
231<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
232
[47274444]233 <para>
234 Install <application>qemu</application> by running the following
235 commands:
236 </para>
[d28198d3]237
[47274444]238 <note>
239 <para>
240 Qemu is capable of running many targets. The build process
241 is also capable of building multiple targets at one time in a
242 comma delimited list assigned to <option>--target-list</option>. Run
243 <command>./configure --help</command> to get a complete list of
244 available targets.
245 </para>
246 </note>
[aa9028e]247
248
249<screen><userinput>if [ $(uname -m) = i686 ]; then
250 QEMU_ARCH=i386-softmmu
251else
252 QEMU_ARCH=x86_64-softmmu
253fi
254
[a29d9e0]255
[10f9bb45]256mkdir -vp build &amp;&amp;
257cd build &amp;&amp;
258
[252e5bf]259../configure --prefix=/usr \
260 --sysconfdir=/etc \
[b0a073b]261 --localstatedir=/var \
[252e5bf]262 --target-list=$QEMU_ARCH \
263 --audio-drv-list=alsa \
[dff46c6]264 --disable-pa \
[9618962]265 --enable-slirp \
[252e5bf]266 --docdir=/usr/share/doc/qemu-&qemu-version; &amp;&amp;
267
[aa9028e]268unset QEMU_ARCH &amp;&amp;
269
[9b13441]270make</userinput></screen>
[d28198d3]271
[43ef29db]272 <para>
[6aa48d38]273 <application>qemu</application> uses <command>ninja</command> as
[542bb708]274 a subprocess when building. To run the tests, issue:
[e440af5]275 <command>ninja test</command>. One test, bios-tables-test, is
[ec5d9991]276 known to fail.
[43ef29db]277 </para>
[d28198d3]278
[9a04a8e9]279 <para>
[ca19f43]280 Now, as the &root; user:
[9a04a8e9]281 </para>
282
[b4c31a6]283<screen role="root"><userinput>make install</userinput></screen>
[9a04a8e9]284
[b4c31a6]285 <para>
286 Change the permissions and ownership of a helper script, which is needed
[1f1f2230]287 when using the <quote>bridge</quote> network device (see below). Again
288 as the &root; user, issue:
[b4c31a6]289 </para>
290
[d129835c]291 <note>
292 <para>
293 You need to add any users who might use the <quote>bridge</quote>
294 network device into the
295 <systemitem class="groupname">kvm</systemitem> group even if
296 &logind; is installed.
297 </para>
298 </note>
299
[b4c31a6]300<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
301chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
302
[8ee3e19c]303 <note>
[47274444]304 <para>
[542bb708]305 For convenience you may want to create a symbolic link to run
[1f1f2230]306 the installed program. For instance (as the &root; user):
[542bb708]307 </para>
[d28198d3]308
[10f9bb45]309<screen role="root"><userinput>ln -sv qemu-system-`uname -m` /usr/bin/qemu</userinput></screen>
[d28198d3]310 </note>
311
312 </sect2>
313
[6a54383]314 <sect2 role="commands">
315 <title>Command Explanations</title>
316
[a29d9e0]317 <para>
[1f1f2230]318 <parameter>--audio-drv-list=alsa --disable-pa</parameter>: This switch
319 sets the audio driver to ALSA. See below for enabling other audio drivers.
[9b13441]320 </para>
[6a54383]321
[9618962]322 <para>
323 <parameter>--enable-slirp</parameter>: This switch forces the building
324 system to check for <xref linkend='libslirp'/>. Remove it if you
325 don't need the <option>-netdev user</option> support.
326 </para>
327
[f9865e2]328 <para>
[1f1f2230]329 <option>--audio-drv-list=pa --disable-alsa</option>: This switch sets
330 the audio driver to pulseaudio. For other drivers see the
331 --audio-drv-list choices in the output of
332 <command>./configure --help</command>. The default audio driver is OSS.
333 To enable support for both alsa and pulseaudio, use
[f9865e2]334 <option>--audio-drv-list=alsa,pa</option>.
335 </para>
336
[9b13441]337 </sect2>
[6a54383]338
[b4c31a6]339 <sect2 role="using">
340 <title>Using Qemu</title>
341
342 <para>
343 Since using qemu means using a virtual computer, the steps to set up
344 the virtual machine are in close analogy with those to set up a real
345 computer. You'll need to decide about CPU, memory, disk, USB devices,
346 network card(s), screen size, etc. Once the <quote>hardware</quote> is
347 decided, you'll have for example to choose how to connect the machine
348 to internet, and/or to install an OS. In the following, we show basic
349 ways of performing those steps. But qemu is much more than this, and it
350 is strongly advised to read the qemu documentation in
351 <filename>/usr/share/doc/qemu-&qemu-version;/qemu-doc.html</filename>.
352 </para>
[d28198d3]353
[b4c31a6]354 <note>
355 <para>
356 It is standard practice to name the computer running qemu
357 <quote>host</quote> and the emulated machine running under qemu the
358 <quote>guest</quote>. We'll use those notations in the following.
359 </para>
360 </note>
[d28198d3]361
[b4c31a6]362 <note>
363 <para>
364 The following instructions assume the optional symbolic link,
365 <filename>qemu</filename>, has been created. Additionally,
[1f1f2230]366 <command>qemu</command> should be run in a graphical environment.
367 But it is possible to use qemu <quote>headless</quote> or through
368 SSH. See the documentation for the various possibilities.
[b4c31a6]369 </para>
370 </note>
[d28198d3]371
[b4c31a6]372 <bridgehead renderas="sect3">Disk</bridgehead>
373 <para>
374 A virtual disk may be set up in the following way:
375 </para>
[d28198d3]376
[b4c31a6]377<screen><userinput>VDISK_SIZE=<replaceable>50G</replaceable>
378VDISK_FILENAME=<replaceable>vdisk.img</replaceable>
379qemu-img create -f qcow2 $VDISK_FILENAME $VDISK_SIZE</userinput></screen>
[d28198d3]380
[b4c31a6]381 <para>
[9d6565bf]382 The virtual disk size and filename should be adjusted as desired. The
[b4c31a6]383 actual size of the file will be less than specified, but will expand as
384 needed, so it is safe to put a high value.
385 </para>
386
387 <bridgehead renderas="sect3">Operating System</bridgehead>
388 <para>
[0639bb6]389 To install an operating system, download an iso image from your preferred
[b4c31a6]390 Linux distribution. For the purposes of this example, we'll use
391 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
392 directory. Run the following:
393 </para>
[d28198d3]394
[b4c31a6]395<screen><userinput>qemu -enable-kvm \
396 -drive file=$VDISK_FILENAME \
[0d7900a]397 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
[d28198d3]398 -boot d \
[b4c31a6]399 -m <replaceable>1G</replaceable></userinput></screen>
400
401 <para>
402 Follow the normal installation procedures for the chosen distribution.
403 The <parameter>-boot</parameter> option specifies the boot order of
404 drives as a string of drive letters. Valid drive letters are: a, b
405 (floppy 1 and 2), c (first hard disk), d (first CD-ROM). The
406 <parameter>-m</parameter> option is the amount of memory to use for the
407 virtual machine. The choice depends on the load of the host. Modern
408 distributions should be comfortable with 1GB.
409 The <parameter>-enable-kvm</parameter> option allows hardware
410 acceleration. Without this switch, the emulation is much slower.
411 </para>
412
413 <bridgehead renderas="sect3">Defining the virtual hardware</bridgehead>
414 <para>
415 The virtual machine hardware is defined by the qemu command line.
416 An example command is given below:
417 </para>
418
419<screen><userinput>qemu -enable-kvm \
420 -smp 4 \
421 -cpu host \
422 -m 1G \
423 -drive file=$VDISK_FILENAME \
424 -cdrom grub-img.iso \
425 -boot order=c,once=d,menu=on \
426 -net nic,netdev=net0 \
427 -netdev user,id=net0 \
[42326ce]428 -device ac97 \
[b4c31a6]429 -vga std \
430 -serial mon:stdio \
431 -name "fedora-16"</userinput></screen>
432
433 <bridgehead renderas="sect3">Meaning of the command line options</bridgehead>
434 <para>
435 <parameter>-enable-kvm</parameter>: enable full KVM virtualization
436 support. On some hardware, it may be necessary to add the undocumented
437 <option>-machine smm=off</option> option in order to enable KVM.
438 </para>
439
440 <para>
441 <parameter>-smp &lt;N&gt;</parameter>: enable symmetric multiprocessing
442 with &lt;N&gt; CPUs.
443 </para>
444
445 <para>
446 <parameter>-cpu &lt;model&gt;</parameter>: simulate CPU &lt;model&gt;.
447 the list of supported models can be obtained with <option>-cpu
448 help</option>.
449 </para>
450
451 <para>
452 <parameter>-drive file=&lt;filename&gt;</parameter>: defines a virtual
453 disk whose image is stored in <filename>&lt;filename&gt;</filename>.
454 </para>
455
456 <para>
[b9c353b]457 <parameter>-cdrom grub-img.iso</parameter>: defines an iso formatted file
[b4c31a6]458 to use as a cdrom. Here we use a grub rescue disk, which may turn handy
459 when something goes wrong at boot time.
460 </para>
461
462 <para>
463 <parameter>-boot order=c,once=d,menu=on</parameter>: defines the boot
464 order for the virtual BIOS.
465 </para>
466
467 <para>
468 <parameter>-net nic,netdev=&lt;netid&gt;</parameter>: defines a network
469 card connected to the network device with id &lt;netid&gt;.
470 </para>
471
472 <para>
473 <parameter>-netdev user,id=&lt;netid&gt;</parameter>: defines the
474 network <quote>user</quote> device. This is a virtual local network
475 with addresses 10.0.2.0/24, where the host has address 10.0.2.2 and
476 acts as a gateway to internet, and with a name server at address
477 10.0.2.3, and an smb server at address 10.0.2.4. A builtin DHCP server
478 can allocate addresses between 10.0.2.15 and 10.0.2.31.
479 </para>
480
481 <para>
482 <parameter>-soundhw &lt;model&gt;</parameter>: defines the soundcard
483 model. The list may be obtained with <option>-soundhw help</option>.
484 </para>
485
486 <para>
[f1f1519]487 <parameter>-vga &lt;type&gt;</parameter>: defines the type of VGA card
488 to emulate. For <parameter>-vga std</parameter>, if you are building
489 a Linux kernel for the guest, it's recommended to enable
490 <option>CONFIG_DRM_BOCHS</option> (as a part of the kernel or a kernel
491 module) to drive all the features of the emulated VGA card, and
492 <option>CONFIG_FB</option> to display the Linux console on it. The
493 other <option>&lt;type&gt;</option> values are not tested by the
494 editors and may require additional dependencies.
[b4c31a6]495 </para>
496
497 <para>
498 <parameter>-serial mon:stdio</parameter>: sends the serial port of the
499 guest (<filename>/dev/ttyS0</filename> on linux guests), multiplexed with
500 the qemu monitor, to the standard input and output of the qemu
501 process.
502 </para>
503
504 <para>
505 <parameter>-name &lt;name&gt;</parameter>: sets the name of the guest.
506 This name is displayed in the guest window caption. It may be useful
507 if you run several guests at the same time.
508 </para>
509
[46a8304]510 <para>
[17b1ad9]511 <option>-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd</option>: Load a
[b38aed5]512 pre-built EDK2 UEFI firmware, instead of the default PC BIOS. Use
[46a8304]513 this option if you want to boot the guest OS with UEFI.
514 </para>
515
[10311fa]516 <para>
517 <option>-drive file=&lt;filename&gt;,if=virtio</option>: Provide
518 Virtio interface to the guest kernel for accessing the disk image,
519 instead of simulating a real disk hardware. This can improve disk I/O
520 performance, but it requires a Virtio driver in guest kernel. Use
521 it instead of a plain <option>-drive</option> if the guest kernel
[8cffdfa]522 supports Virtio. To build a Linux kernel with Virtio support for the
523 guest, use
524 <command>make defconfig &amp;&amp; make kvm_guest.config</command> to
525 create an initial kernel configuration with the Virtio drives enabled,
526 then make your customization. And, if the guest kernel is Linux, the
527 virtual disks using Virtio interface will be named
528 <filename>vdx</filename> in the devtmpfs, instead of
529 <filename>sdx</filename>.
[10311fa]530 </para>
531
532 <para>
533 <option>-net nic,netdev=net0,model=virtio-net-pci</option>: Provide
534 Virtio interface to the guest kernel for accessing the network
535 interface, instead of simulating a real network interface card. This
536 can improve network I/O performance, but it requires a Virtio driver
537 in guest kernel. Use it instead of a plain <option>-net</option> if
538 the guest kernel supports Virtio.
539 </para>
540
[0639bb6]541 <bridgehead renderas="sect3">Controlling the Emulated Display</bridgehead>
[b4c31a6]542 <para>
[5c7ad04]543 To set the resolution of the emulated display for a Xorg server
544 running in the guest Linux system, read <xref linkend='xdisplay'/>.
[b4c31a6]545 </para>
[d28198d3]546
[b4c31a6]547 <bridgehead renderas="sect3">Networking</bridgehead>
548 <para>
[449c552]549 The above solution for networking allows the guest to access the local
[b4c31a6]550 network through the host (and possibly to access internet through the
551 local routers), but the converse is not true. Not even the host can
552 access the guest, unless port forwarding is enabled. And in the case
553 several guests are running, they cannot communicate with each other.
554 Other network devices can be used for this purpose. For example, there
555 is the <quote>socket</quote> device, which allows several guests to
556 share a common virtual network. In the following, we describe in more
557 details how to set up the <quote>bridge</quote> device, which allows
558 the guests to appear as if connected to the local network. All the
559 commands below should be run as the <systemitem
560 class="username">root</systemitem> user.
561 </para>
[0d7900a]562
[b4c31a6]563 <para revision="sysv">
564 Set up bridging with <xref linkend="bridgeutils"/>. Only the physical
565 interface(s) should be set up at boot. The virtual interface(s) will be
566 added as needed when qemu is started.
567 </para>
568
[47274444]569 <para revision="systemd">
570 <!-- On SYS-V, IP_FORWARD is enabled by the bridge script. -->
[b4c31a6]571 Allow the host to forward IP packets:
572 </para>
[d28198d3]573
[b4c31a6]574<screen role="root"
575 revision="systemd"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
[d28198d3]576
[b4c31a6]577 <para revision="systemd">
578 To make this permanent, add the command to
579 <filename>/etc/sysctl.d/60-net-forward.conf:</filename>
580 </para>
[6e5e4d2]581
[b4c31a6]582<screen role="root"
583 revision="systemd"><userinput>cat &gt;&gt; /etc/sysctl.d/60-net-forward.conf &lt;&lt; EOF
[51dfb3e]584<literal>net.ipv4.ip_forward=1</literal>
[6e5e4d2]585EOF</userinput></screen>
586
[b4c31a6]587 <para>
588 Set up a required configuration file:
589 </para>
[670f775]590
[3a87232]591<!-- /etc/qemu has not been installed by "make install" since version 2.4 -->
592<screen role="root"><userinput>install -vdm 755 /etc/qemu &amp;&amp;
593echo allow br0 &gt; /etc/qemu/bridge.conf</userinput></screen>
[670f775]594
[b4c31a6]595 <para>
[1f1f2230]596 In the qemu command line above, replace the switch
597 <parameter>-netdev user,...</parameter> with
598 <parameter>-netdev bridge,...</parameter>.
[b4c31a6]599 </para>
[d28198d3]600
601 </sect2>
602
603 <sect2 role="content">
604 <title>Contents</title>
605
606 <segmentedlist>
[9b13441]607 <segtitle>Installed Programs</segtitle>
608 <segtitle>Installed Library</segtitle>
[d28198d3]609 <segtitle>Installed Directories</segtitle>
610
611 <seglistitem>
[9b13441]612 <seg>
[a541e080]613 elf2dmp,
[10f9bb45]614 qemu (symlink),
[a541e080]615 qemu-edid,
[9b13441]616 qemu-ga,
617 qemu-img,
618 qemu-io,
[a541e080]619 qemu-keymap,
[9b13441]620 qemu-nbd,
[a541e080]621 qemu-pr-helper,
622 qemu-storage-daemon, and
623 qemu-system-&lt;arch&gt;
[9b13441]624 </seg>
[b4c31a6]625 <seg>None</seg>
[9b13441]626 <seg>
[b4c31a6]627 /usr/share/qemu and
[a541e080]628 /usr/share/doc/qemu-&qemu-version; (optional)
[9b13441]629 </seg>
[d28198d3]630 </seglistitem>
631 </segmentedlist>
632
633 <variablelist>
634 <bridgehead renderas="sect3">Short Description</bridgehead>
635 <?dbfo list-presentation="list"?>
636 <?dbhtml list-presentation="table"?>
637
[a541e080]638 <varlistentry id="elf2dmp">
639 <term><command>elf2dmp</command></term>
640 <listitem>
641 <para>
642 Converts files from elf to dmp format
643 </para>
644 <indexterm zone="qemu elf2dmp">
645 <primary sortas="b-elf2dmp">elf2dmp</primary>
646 </indexterm>
647 </listitem>
648 </varlistentry>
[b4c31a6]649
[f9865e2]650 <varlistentry id="qemu-edid">
651 <term><command>qemu-edid</command></term>
652 <listitem>
[47274444]653 <para>
[4c24eb0a]654 is a test tool for the qemu EDID generator
[47274444]655 </para>
[f9865e2]656 <indexterm zone="qemu qemu-edid">
657 <primary sortas="b-qemu-edid">qemu-edid</primary>
658 </indexterm>
659 </listitem>
660 </varlistentry>
661
[d28198d3]662 <varlistentry id="qemu-ga">
663 <term><command>qemu-ga</command></term>
664 <listitem>
[47274444]665 <para>
666 implements support for QMP (QEMU Monitor Protocol) commands and
667 events that terminate and originate respectively within the guest
[4c24eb0a]668 using an agent built as part of QEMU
[47274444]669 </para>
[2f6053d]670 <indexterm zone="qemu qemu-ga">
[d28198d3]671 <primary sortas="b-qemu-ga">qemu-ga</primary>
672 </indexterm>
673 </listitem>
674 </varlistentry>
675
676 <varlistentry id="qemu-img">
677 <term><command>qemu-img</command></term>
678 <listitem>
[47274444]679 <para>
[4c24eb0a]680 provides commands to manage QEMU disk images
[47274444]681 </para>
[2f6053d]682 <indexterm zone="qemu qemu-img">
[d28198d3]683 <primary sortas="b-qemu-img">qemu-img</primary>
684 </indexterm>
685 </listitem>
686 </varlistentry>
687
688 <varlistentry id="qemu-io">
689 <term><command>qemu-io</command></term>
690 <listitem>
[47274444]691 <para>
692 is a diagnostic and manipulation program for (virtual) memory
[9d6565bf]693 media. It is still at an early stage of development
[47274444]694 </para>
[2f6053d]695 <indexterm zone="qemu qemu-io">
[d28198d3]696 <primary sortas="b-qemu-io">qemu-io</primary>
697 </indexterm>
698 </listitem>
699 </varlistentry>
700
[a541e080]701 <varlistentry id="qemu-keymap">
702 <term><command>qemu-keymap</command></term>
703 <listitem>
704 <para>
705 generates qemu reverse keymaps from xkb keymaps,
706 which can be used with the qemu "-k" command line switch
707 </para>
708 <indexterm zone="qemu qemu-keymap">
709 <primary sortas="b-qemu-keymap">qemu-keymap</primary>
710 </indexterm>
711 </listitem>
712 </varlistentry>
713
714
[d28198d3]715 <varlistentry id="qemu-nbd">
716 <term><command>qemu-nbd</command></term>
717 <listitem>
[47274444]718 <para>
719 exports Qemu disk images using the QEMU Disk Network Block
[4c24eb0a]720 Device (NBD) protocol
[47274444]721 </para>
[2f6053d]722 <indexterm zone="qemu qemu-nbd">
[d28198d3]723 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
724 </indexterm>
725 </listitem>
726 </varlistentry>
727
[a541e080]728 <varlistentry id="qemu-pr-helper">
729 <term><command>qemu-pr-helper</command></term>
730 <listitem>
731 <para>
732 Implements the persistent reservation helper for QEMU
733 </para>
734 <indexterm zone="qemu qemu-pr-helper">
735 <primary sortas="b-qemu-pr-helper">qemu-pr-helper</primary>
736 </indexterm>
737 </listitem>
738 </varlistentry>
739
740 <varlistentry id="qemu-storage-daemon">
741 <term><command>qemu-storage-daemon</command></term>
742 <listitem>
743 <para>
744 allows to modify disk images using the QEMU Monitor Protocol (QMP)
745 without running a VM
746 </para>
747 <indexterm zone="qemu qemu-storage-daemon">
748 <primary sortas="b-qemu-storage-daemon">qemu-storage-daemon</primary>
749 </indexterm>
750 </listitem>
751 </varlistentry>
752
[d28198d3]753 <varlistentry id="qemu-system">
754 <term><command>qemu-system-x86_64</command></term>
755 <listitem>
[47274444]756 <para>
[4c24eb0a]757 is the QEMU PC System emulator
[47274444]758 </para>
[2f6053d]759 <indexterm zone="qemu qemu-system">
[d28198d3]760 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
761 </indexterm>
762 </listitem>
763 </varlistentry>
[27ed278]764
[d28198d3]765 </variablelist>
766
767 </sect2>
768
769</sect1>
Note: See TracBrowser for help on using the repository browser.