source: postlfs/virtualization/qemu.xml@ 875b3b57

12.1 ken/TL2024 lazarus plabs/newcss python3.11 rahul/power-profiles-daemon trunk xry111/llvm18
Last change on this file since 875b3b57 was 875b3b57, checked in by Pierre Labastie <pierre.labastie@…>, 6 months ago

Fix various option vs parameter problems

Sometimes there is no really a problem, but alos avoids that
automatic detection with "make test-options" return false positives

  • Property mode set to 100644
File size: 27.2 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>
[875b3b57]318 <parameter>--audio-drv-list=alsa</parameter>: This switch
[1f1f2230]319 sets the audio driver to ALSA. See below for enabling other audio drivers.
[9b13441]320 </para>
[6a54383]321
[875b3b57]322 <para>
323 <parameter>--disable-pa</parameter>: even if <emphasis>pa</emphasis> is
324 not in <parameter>--audio-drv-list</parameter> list, the pulseaudio
325 driver is built, unless disabled by this parameter.
326 </para>
327
[9618962]328 <para>
329 <parameter>--enable-slirp</parameter>: This switch forces the building
330 system to check for <xref linkend='libslirp'/>. Remove it if you
331 don't need the <option>-netdev user</option> support.
332 </para>
333
[f9865e2]334 <para>
[1f1f2230]335 <option>--audio-drv-list=pa --disable-alsa</option>: This switch sets
336 the audio driver to pulseaudio. For other drivers see the
337 --audio-drv-list choices in the output of
338 <command>./configure --help</command>. The default audio driver is OSS.
339 To enable support for both alsa and pulseaudio, use
[f9865e2]340 <option>--audio-drv-list=alsa,pa</option>.
341 </para>
342
[9b13441]343 </sect2>
[6a54383]344
[b4c31a6]345 <sect2 role="using">
346 <title>Using Qemu</title>
347
348 <para>
349 Since using qemu means using a virtual computer, the steps to set up
350 the virtual machine are in close analogy with those to set up a real
351 computer. You'll need to decide about CPU, memory, disk, USB devices,
352 network card(s), screen size, etc. Once the <quote>hardware</quote> is
353 decided, you'll have for example to choose how to connect the machine
354 to internet, and/or to install an OS. In the following, we show basic
355 ways of performing those steps. But qemu is much more than this, and it
356 is strongly advised to read the qemu documentation in
357 <filename>/usr/share/doc/qemu-&qemu-version;/qemu-doc.html</filename>.
358 </para>
[d28198d3]359
[b4c31a6]360 <note>
361 <para>
362 It is standard practice to name the computer running qemu
363 <quote>host</quote> and the emulated machine running under qemu the
364 <quote>guest</quote>. We'll use those notations in the following.
365 </para>
366 </note>
[d28198d3]367
[b4c31a6]368 <note>
369 <para>
370 The following instructions assume the optional symbolic link,
371 <filename>qemu</filename>, has been created. Additionally,
[1f1f2230]372 <command>qemu</command> should be run in a graphical environment.
373 But it is possible to use qemu <quote>headless</quote> or through
374 SSH. See the documentation for the various possibilities.
[b4c31a6]375 </para>
376 </note>
[d28198d3]377
[b4c31a6]378 <bridgehead renderas="sect3">Disk</bridgehead>
379 <para>
380 A virtual disk may be set up in the following way:
381 </para>
[d28198d3]382
[b4c31a6]383<screen><userinput>VDISK_SIZE=<replaceable>50G</replaceable>
384VDISK_FILENAME=<replaceable>vdisk.img</replaceable>
385qemu-img create -f qcow2 $VDISK_FILENAME $VDISK_SIZE</userinput></screen>
[d28198d3]386
[b4c31a6]387 <para>
[9d6565bf]388 The virtual disk size and filename should be adjusted as desired. The
[b4c31a6]389 actual size of the file will be less than specified, but will expand as
390 needed, so it is safe to put a high value.
391 </para>
392
393 <bridgehead renderas="sect3">Operating System</bridgehead>
394 <para>
[0639bb6]395 To install an operating system, download an iso image from your preferred
[b4c31a6]396 Linux distribution. For the purposes of this example, we'll use
397 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
398 directory. Run the following:
399 </para>
[d28198d3]400
[b4c31a6]401<screen><userinput>qemu -enable-kvm \
402 -drive file=$VDISK_FILENAME \
[0d7900a]403 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
[d28198d3]404 -boot d \
[b4c31a6]405 -m <replaceable>1G</replaceable></userinput></screen>
406
407 <para>
408 Follow the normal installation procedures for the chosen distribution.
409 The <parameter>-boot</parameter> option specifies the boot order of
410 drives as a string of drive letters. Valid drive letters are: a, b
411 (floppy 1 and 2), c (first hard disk), d (first CD-ROM). The
412 <parameter>-m</parameter> option is the amount of memory to use for the
413 virtual machine. The choice depends on the load of the host. Modern
414 distributions should be comfortable with 1GB.
415 The <parameter>-enable-kvm</parameter> option allows hardware
416 acceleration. Without this switch, the emulation is much slower.
417 </para>
418
419 <bridgehead renderas="sect3">Defining the virtual hardware</bridgehead>
420 <para>
421 The virtual machine hardware is defined by the qemu command line.
422 An example command is given below:
423 </para>
424
425<screen><userinput>qemu -enable-kvm \
426 -smp 4 \
427 -cpu host \
428 -m 1G \
429 -drive file=$VDISK_FILENAME \
430 -cdrom grub-img.iso \
431 -boot order=c,once=d,menu=on \
432 -net nic,netdev=net0 \
433 -netdev user,id=net0 \
[42326ce]434 -device ac97 \
[b4c31a6]435 -vga std \
436 -serial mon:stdio \
437 -name "fedora-16"</userinput></screen>
438
439 <bridgehead renderas="sect3">Meaning of the command line options</bridgehead>
440 <para>
441 <parameter>-enable-kvm</parameter>: enable full KVM virtualization
442 support. On some hardware, it may be necessary to add the undocumented
443 <option>-machine smm=off</option> option in order to enable KVM.
444 </para>
445
446 <para>
447 <parameter>-smp &lt;N&gt;</parameter>: enable symmetric multiprocessing
448 with &lt;N&gt; CPUs.
449 </para>
450
451 <para>
452 <parameter>-cpu &lt;model&gt;</parameter>: simulate CPU &lt;model&gt;.
453 the list of supported models can be obtained with <option>-cpu
454 help</option>.
455 </para>
456
457 <para>
458 <parameter>-drive file=&lt;filename&gt;</parameter>: defines a virtual
459 disk whose image is stored in <filename>&lt;filename&gt;</filename>.
460 </para>
461
462 <para>
[b9c353b]463 <parameter>-cdrom grub-img.iso</parameter>: defines an iso formatted file
[b4c31a6]464 to use as a cdrom. Here we use a grub rescue disk, which may turn handy
465 when something goes wrong at boot time.
466 </para>
467
468 <para>
469 <parameter>-boot order=c,once=d,menu=on</parameter>: defines the boot
470 order for the virtual BIOS.
471 </para>
472
473 <para>
474 <parameter>-net nic,netdev=&lt;netid&gt;</parameter>: defines a network
475 card connected to the network device with id &lt;netid&gt;.
476 </para>
477
478 <para>
479 <parameter>-netdev user,id=&lt;netid&gt;</parameter>: defines the
480 network <quote>user</quote> device. This is a virtual local network
481 with addresses 10.0.2.0/24, where the host has address 10.0.2.2 and
482 acts as a gateway to internet, and with a name server at address
483 10.0.2.3, and an smb server at address 10.0.2.4. A builtin DHCP server
484 can allocate addresses between 10.0.2.15 and 10.0.2.31.
485 </para>
486
487 <para>
488 <parameter>-soundhw &lt;model&gt;</parameter>: defines the soundcard
489 model. The list may be obtained with <option>-soundhw help</option>.
490 </para>
491
492 <para>
[f1f1519]493 <parameter>-vga &lt;type&gt;</parameter>: defines the type of VGA card
494 to emulate. For <parameter>-vga std</parameter>, if you are building
495 a Linux kernel for the guest, it's recommended to enable
496 <option>CONFIG_DRM_BOCHS</option> (as a part of the kernel or a kernel
497 module) to drive all the features of the emulated VGA card, and
498 <option>CONFIG_FB</option> to display the Linux console on it. The
499 other <option>&lt;type&gt;</option> values are not tested by the
500 editors and may require additional dependencies.
[b4c31a6]501 </para>
502
503 <para>
504 <parameter>-serial mon:stdio</parameter>: sends the serial port of the
505 guest (<filename>/dev/ttyS0</filename> on linux guests), multiplexed with
506 the qemu monitor, to the standard input and output of the qemu
507 process.
508 </para>
509
510 <para>
511 <parameter>-name &lt;name&gt;</parameter>: sets the name of the guest.
512 This name is displayed in the guest window caption. It may be useful
513 if you run several guests at the same time.
514 </para>
515
[46a8304]516 <para>
[17b1ad9]517 <option>-drive if=pflash,format=raw,readonly=on,file=/usr/share/qemu/edk2-x86_64-code.fd</option>: Load a
[b38aed5]518 pre-built EDK2 UEFI firmware, instead of the default PC BIOS. Use
[46a8304]519 this option if you want to boot the guest OS with UEFI.
520 </para>
521
[10311fa]522 <para>
523 <option>-drive file=&lt;filename&gt;,if=virtio</option>: Provide
524 Virtio interface to the guest kernel for accessing the disk image,
525 instead of simulating a real disk hardware. This can improve disk I/O
526 performance, but it requires a Virtio driver in guest kernel. Use
527 it instead of a plain <option>-drive</option> if the guest kernel
[8cffdfa]528 supports Virtio. To build a Linux kernel with Virtio support for the
529 guest, use
530 <command>make defconfig &amp;&amp; make kvm_guest.config</command> to
531 create an initial kernel configuration with the Virtio drives enabled,
532 then make your customization. And, if the guest kernel is Linux, the
533 virtual disks using Virtio interface will be named
534 <filename>vdx</filename> in the devtmpfs, instead of
535 <filename>sdx</filename>.
[10311fa]536 </para>
537
538 <para>
539 <option>-net nic,netdev=net0,model=virtio-net-pci</option>: Provide
540 Virtio interface to the guest kernel for accessing the network
541 interface, instead of simulating a real network interface card. This
542 can improve network I/O performance, but it requires a Virtio driver
543 in guest kernel. Use it instead of a plain <option>-net</option> if
544 the guest kernel supports Virtio.
545 </para>
546
[0639bb6]547 <bridgehead renderas="sect3">Controlling the Emulated Display</bridgehead>
[b4c31a6]548 <para>
[5c7ad04]549 To set the resolution of the emulated display for a Xorg server
550 running in the guest Linux system, read <xref linkend='xdisplay'/>.
[b4c31a6]551 </para>
[d28198d3]552
[b4c31a6]553 <bridgehead renderas="sect3">Networking</bridgehead>
554 <para>
[449c552]555 The above solution for networking allows the guest to access the local
[b4c31a6]556 network through the host (and possibly to access internet through the
557 local routers), but the converse is not true. Not even the host can
558 access the guest, unless port forwarding is enabled. And in the case
559 several guests are running, they cannot communicate with each other.
560 Other network devices can be used for this purpose. For example, there
561 is the <quote>socket</quote> device, which allows several guests to
562 share a common virtual network. In the following, we describe in more
563 details how to set up the <quote>bridge</quote> device, which allows
564 the guests to appear as if connected to the local network. All the
565 commands below should be run as the <systemitem
566 class="username">root</systemitem> user.
567 </para>
[0d7900a]568
[b4c31a6]569 <para revision="sysv">
570 Set up bridging with <xref linkend="bridgeutils"/>. Only the physical
571 interface(s) should be set up at boot. The virtual interface(s) will be
572 added as needed when qemu is started.
573 </para>
574
[47274444]575 <para revision="systemd">
576 <!-- On SYS-V, IP_FORWARD is enabled by the bridge script. -->
[b4c31a6]577 Allow the host to forward IP packets:
578 </para>
[d28198d3]579
[b4c31a6]580<screen role="root"
581 revision="systemd"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
[d28198d3]582
[b4c31a6]583 <para revision="systemd">
584 To make this permanent, add the command to
585 <filename>/etc/sysctl.d/60-net-forward.conf:</filename>
586 </para>
[6e5e4d2]587
[b4c31a6]588<screen role="root"
589 revision="systemd"><userinput>cat &gt;&gt; /etc/sysctl.d/60-net-forward.conf &lt;&lt; EOF
[51dfb3e]590<literal>net.ipv4.ip_forward=1</literal>
[6e5e4d2]591EOF</userinput></screen>
592
[b4c31a6]593 <para>
594 Set up a required configuration file:
595 </para>
[670f775]596
[3a87232]597<!-- /etc/qemu has not been installed by "make install" since version 2.4 -->
598<screen role="root"><userinput>install -vdm 755 /etc/qemu &amp;&amp;
599echo allow br0 &gt; /etc/qemu/bridge.conf</userinput></screen>
[670f775]600
[b4c31a6]601 <para>
[1f1f2230]602 In the qemu command line above, replace the switch
603 <parameter>-netdev user,...</parameter> with
604 <parameter>-netdev bridge,...</parameter>.
[b4c31a6]605 </para>
[d28198d3]606
607 </sect2>
608
609 <sect2 role="content">
610 <title>Contents</title>
611
612 <segmentedlist>
[9b13441]613 <segtitle>Installed Programs</segtitle>
614 <segtitle>Installed Library</segtitle>
[d28198d3]615 <segtitle>Installed Directories</segtitle>
616
617 <seglistitem>
[9b13441]618 <seg>
[a541e080]619 elf2dmp,
[10f9bb45]620 qemu (symlink),
[a541e080]621 qemu-edid,
[9b13441]622 qemu-ga,
623 qemu-img,
624 qemu-io,
[a541e080]625 qemu-keymap,
[9b13441]626 qemu-nbd,
[a541e080]627 qemu-pr-helper,
628 qemu-storage-daemon, and
629 qemu-system-&lt;arch&gt;
[9b13441]630 </seg>
[b4c31a6]631 <seg>None</seg>
[9b13441]632 <seg>
[b4c31a6]633 /usr/share/qemu and
[a541e080]634 /usr/share/doc/qemu-&qemu-version; (optional)
[9b13441]635 </seg>
[d28198d3]636 </seglistitem>
637 </segmentedlist>
638
639 <variablelist>
640 <bridgehead renderas="sect3">Short Description</bridgehead>
641 <?dbfo list-presentation="list"?>
642 <?dbhtml list-presentation="table"?>
643
[a541e080]644 <varlistentry id="elf2dmp">
645 <term><command>elf2dmp</command></term>
646 <listitem>
647 <para>
648 Converts files from elf to dmp format
649 </para>
650 <indexterm zone="qemu elf2dmp">
651 <primary sortas="b-elf2dmp">elf2dmp</primary>
652 </indexterm>
653 </listitem>
654 </varlistentry>
[b4c31a6]655
[f9865e2]656 <varlistentry id="qemu-edid">
657 <term><command>qemu-edid</command></term>
658 <listitem>
[47274444]659 <para>
[4c24eb0a]660 is a test tool for the qemu EDID generator
[47274444]661 </para>
[f9865e2]662 <indexterm zone="qemu qemu-edid">
663 <primary sortas="b-qemu-edid">qemu-edid</primary>
664 </indexterm>
665 </listitem>
666 </varlistentry>
667
[d28198d3]668 <varlistentry id="qemu-ga">
669 <term><command>qemu-ga</command></term>
670 <listitem>
[47274444]671 <para>
672 implements support for QMP (QEMU Monitor Protocol) commands and
673 events that terminate and originate respectively within the guest
[4c24eb0a]674 using an agent built as part of QEMU
[47274444]675 </para>
[2f6053d]676 <indexterm zone="qemu qemu-ga">
[d28198d3]677 <primary sortas="b-qemu-ga">qemu-ga</primary>
678 </indexterm>
679 </listitem>
680 </varlistentry>
681
682 <varlistentry id="qemu-img">
683 <term><command>qemu-img</command></term>
684 <listitem>
[47274444]685 <para>
[4c24eb0a]686 provides commands to manage QEMU disk images
[47274444]687 </para>
[2f6053d]688 <indexterm zone="qemu qemu-img">
[d28198d3]689 <primary sortas="b-qemu-img">qemu-img</primary>
690 </indexterm>
691 </listitem>
692 </varlistentry>
693
694 <varlistentry id="qemu-io">
695 <term><command>qemu-io</command></term>
696 <listitem>
[47274444]697 <para>
698 is a diagnostic and manipulation program for (virtual) memory
[9d6565bf]699 media. It is still at an early stage of development
[47274444]700 </para>
[2f6053d]701 <indexterm zone="qemu qemu-io">
[d28198d3]702 <primary sortas="b-qemu-io">qemu-io</primary>
703 </indexterm>
704 </listitem>
705 </varlistentry>
706
[a541e080]707 <varlistentry id="qemu-keymap">
708 <term><command>qemu-keymap</command></term>
709 <listitem>
710 <para>
711 generates qemu reverse keymaps from xkb keymaps,
712 which can be used with the qemu "-k" command line switch
713 </para>
714 <indexterm zone="qemu qemu-keymap">
715 <primary sortas="b-qemu-keymap">qemu-keymap</primary>
716 </indexterm>
717 </listitem>
718 </varlistentry>
719
720
[d28198d3]721 <varlistentry id="qemu-nbd">
722 <term><command>qemu-nbd</command></term>
723 <listitem>
[47274444]724 <para>
725 exports Qemu disk images using the QEMU Disk Network Block
[4c24eb0a]726 Device (NBD) protocol
[47274444]727 </para>
[2f6053d]728 <indexterm zone="qemu qemu-nbd">
[d28198d3]729 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
730 </indexterm>
731 </listitem>
732 </varlistentry>
733
[a541e080]734 <varlistentry id="qemu-pr-helper">
735 <term><command>qemu-pr-helper</command></term>
736 <listitem>
737 <para>
738 Implements the persistent reservation helper for QEMU
739 </para>
740 <indexterm zone="qemu qemu-pr-helper">
741 <primary sortas="b-qemu-pr-helper">qemu-pr-helper</primary>
742 </indexterm>
743 </listitem>
744 </varlistentry>
745
746 <varlistentry id="qemu-storage-daemon">
747 <term><command>qemu-storage-daemon</command></term>
748 <listitem>
749 <para>
750 allows to modify disk images using the QEMU Monitor Protocol (QMP)
751 without running a VM
752 </para>
753 <indexterm zone="qemu qemu-storage-daemon">
754 <primary sortas="b-qemu-storage-daemon">qemu-storage-daemon</primary>
755 </indexterm>
756 </listitem>
757 </varlistentry>
758
[d28198d3]759 <varlistentry id="qemu-system">
760 <term><command>qemu-system-x86_64</command></term>
761 <listitem>
[47274444]762 <para>
[4c24eb0a]763 is the QEMU PC System emulator
[47274444]764 </para>
[2f6053d]765 <indexterm zone="qemu qemu-system">
[d28198d3]766 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
767 </indexterm>
768 </listitem>
769 </varlistentry>
[27ed278]770
[d28198d3]771 </variablelist>
772
773 </sect2>
774
775</sect1>
Note: See TracBrowser for help on using the repository browser.