[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 " ">
|
---|
[e29b55b2] | 9 | <!ENTITY qemu-md5sum "7630d6a9eba7ab2bcb9979d6d24c2697">
|
---|
| 10 | <!ENTITY qemu-size "117 MB">
|
---|
| 11 | <!ENTITY qemu-buildsize "2.1 GB">
|
---|
| 12 | <!ENTITY qemu-time "1.3 SBU (add 2.0 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 |
|
---|
[3032882] | 34 | &lfs112_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">
|
---|
[f9865e2] | 74 | <xref linkend="glib2"/>, and
|
---|
[d28198d3] | 75 | <xref linkend="x-window-system"/>
|
---|
| 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">
|
---|
[80a314c] | 87 | Depending on the sound system, various packages in <xref linkend="alsa"/>,
|
---|
[2d7c53d] | 88 | <xref linkend="python3"/>,
|
---|
[11b931a6] | 89 | <xref linkend="pulseaudio"/>,
|
---|
[8ade43b] | 90 | <xref linkend="bluez"/>,
|
---|
[d28198d3] | 91 | <xref linkend="curl"/>,
|
---|
[8ade43b] | 92 | <xref linkend="cyrus-sasl"/>,
|
---|
[10f9bb45] | 93 | <xref linkend="gnutls"/>,
|
---|
[8ade43b] | 94 | <xref linkend="gtk2"/>,
|
---|
| 95 | <xref linkend="gtk3"/>,
|
---|
| 96 | <xref linkend="libusb"/>,
|
---|
[10f9bb45] | 97 | <xref linkend="libgcrypt"/>,
|
---|
[fee79e2] | 98 | <xref linkend="libssh2"/>,
|
---|
[8ade43b] | 99 | <xref linkend="lzo"/>,
|
---|
[10f9bb45] | 100 | <xref linkend="nettle"/>,
|
---|
| 101 | <xref linkend="mesa"/>,
|
---|
| 102 | <xref linkend="sdl"/>,
|
---|
[cac7f93] | 103 | <xref role="nodep" linkend="vte"/> or <xref linkend="vte2"/>, and
|
---|
[b4c31a6] | 104 | <!-- libcacard has been a standalone project since qemu-2.5.-->
|
---|
[fefc5d54] | 105 | <ulink url="https://gitlab.freedesktop.org/spice/libcacard">libcacard</ulink>
|
---|
[d28198d3] | 106 | </para>
|
---|
| 107 |
|
---|
[402910e] | 108 | <bridgehead renderas="sect4">Optional (for building the documentation)</bridgehead>
|
---|
[a541e080] | 109 | <para role="optional">
|
---|
[402910e] | 110 | <xref linkend="sphinx_rtd_theme"/>
|
---|
[a541e080] | 111 | </para>
|
---|
| 112 |
|
---|
[9b13441] | 113 | <note>
|
---|
| 114 | <para>
|
---|
| 115 | This optional dependencies list is not comprehensive. See the output of
|
---|
| 116 | <command>./configure --help</command> for a more complete list.
|
---|
| 117 | </para>
|
---|
| 118 | </note>
|
---|
| 119 |
|
---|
[d28198d3] | 120 | <para condition="html" role="usernotes">User Notes:
|
---|
[2f6053d] | 121 | <ulink url="&blfs-wiki;/qemu"/></para>
|
---|
[d28198d3] | 122 |
|
---|
| 123 | </sect2>
|
---|
| 124 |
|
---|
[2f6053d] | 125 | <sect2 id='qemu-prereq'>
|
---|
[1eb4fcf] | 126 | <title>KVM Prerequisites</title>
|
---|
[d28198d3] | 127 |
|
---|
[47274444] | 128 | <para>
|
---|
| 129 | Before building <application>qemu</application>, check to see if
|
---|
| 130 | your processor supports Virtualization Technology (VT):
|
---|
| 131 | </para>
|
---|
[d28198d3] | 132 |
|
---|
[d6b45f7] | 133 | <screen><userinput>grep -E '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
---|
[d28198d3] | 134 |
|
---|
[47274444] | 135 | <para>
|
---|
| 136 | If you get any output, you have VT technology (vmx for Intel
|
---|
| 137 | processors and svm for AMD processors). You then need to go into your
|
---|
[b9c353b] | 138 | system BIOS and ensure it is enabled. After enabling, reboot back to your
|
---|
[47274444] | 139 | LFS instance.
|
---|
| 140 | </para>
|
---|
[d28198d3] | 141 |
|
---|
| 142 | </sect2>
|
---|
| 143 |
|
---|
[2f6053d] | 144 | <sect2 role="kernel" id='qemu-kernel'>
|
---|
[d28198d3] | 145 | <title>Kernel Configuration</title>
|
---|
| 146 |
|
---|
[47274444] | 147 | <para>
|
---|
| 148 | Enable the following options in the kernel configuration and
|
---|
| 149 | recompile the kernel if necessary:
|
---|
| 150 | </para>
|
---|
[d28198d3] | 151 |
|
---|
[f39cf0d0] | 152 | <screen><literal>[*] Virtualization: ---> [CONFIG_VIRTUALIZATION]
|
---|
[421128a1] | 153 | <*/M> Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
|
---|
[f39cf0d0] | 154 | <*/M> KVM for Intel (and compatible) processors support [CONFIG_KVM_INTEL]
|
---|
| 155 | <*/M> KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
|
---|
[d28198d3] | 156 |
|
---|
[2f6053d] | 157 | <indexterm zone="qemu qemu-kernel">
|
---|
| 158 | <primary sortas="d-qemu">qemu</primary>
|
---|
[d28198d3] | 159 | </indexterm>
|
---|
| 160 |
|
---|
[47274444] | 161 | <para>
|
---|
| 162 | The Intel or AMD settings are not both required, but the one matching
|
---|
| 163 | your system processor is required.
|
---|
| 164 | </para>
|
---|
[d28198d3] | 165 |
|
---|
[b4c31a6] | 166 | <para>
|
---|
| 167 | To use the <quote>bridge</quote> network device, as explained below,
|
---|
| 168 | check that <xref linkend='bridgeutils'/> is installed
|
---|
| 169 | and the following options in the kernel configuration are enabled:
|
---|
| 170 | </para>
|
---|
[9b13441] | 171 |
|
---|
[421128a1] | 172 | <screen><literal>[*] Networking support ---> [CONFIG_NET]
|
---|
[9b13441] | 173 | Networking options --->
|
---|
[421128a1] | 174 | <*/M> 802.1d Ethernet Bridging [CONFIG_BRIDGE]
|
---|
[9b13441] | 175 | Device Drivers --->
|
---|
[421128a1] | 176 | [*] Network device support ---> [CONFIG_NETDEVICES]
|
---|
| 177 | <*/M> Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
|
---|
[d28198d3] | 178 |
|
---|
| 179 | </sect2>
|
---|
| 180 |
|
---|
| 181 | <sect2 role="installation">
|
---|
[2f6053d] | 182 | <title>Installation of qemu</title>
|
---|
[fdec60a] | 183 | <!-- group kvm is created in lfs chapter 7 even for sysv
|
---|
[9f309be] | 184 | <para revision="sysv">
|
---|
[b4c31a6] | 185 | You will need a dedicated group that will contain users (other than root)
|
---|
| 186 | allowed to access the KVM device. Create this group by running the
|
---|
| 187 | following command as the
|
---|
| 188 | <systemitem class="username">root</systemitem> user:
|
---|
| 189 | </para>
|
---|
| 190 |
|
---|
[9f309be] | 191 | <screen role="root" revision="sysv"><userinput>groupadd -g 61 kvm</userinput></screen>
|
---|
[fdec60a] | 192 | -->
|
---|
[b4c31a6] | 193 | <para>
|
---|
[1f1f2230] | 194 | As the &root; user, add any users that might use the KVM device to that
|
---|
| 195 | group:
|
---|
[b4c31a6] | 196 | </para>
|
---|
| 197 |
|
---|
| 198 | <screen role="root"><userinput>usermod -a -G kvm <replaceable><username></replaceable></userinput></screen>
|
---|
| 199 |
|
---|
[47274444] | 200 | <para>
|
---|
| 201 | Install <application>qemu</application> by running the following
|
---|
| 202 | commands:
|
---|
| 203 | </para>
|
---|
[d28198d3] | 204 |
|
---|
[47274444] | 205 | <note>
|
---|
| 206 | <para>
|
---|
| 207 | Qemu is capable of running many targets. The build process
|
---|
| 208 | is also capable of building multiple targets at one time in a
|
---|
| 209 | comma delimited list assigned to <option>--target-list</option>. Run
|
---|
| 210 | <command>./configure --help</command> to get a complete list of
|
---|
| 211 | available targets.
|
---|
| 212 | </para>
|
---|
| 213 | </note>
|
---|
[aa9028e] | 214 |
|
---|
| 215 |
|
---|
| 216 | <screen><userinput>if [ $(uname -m) = i686 ]; then
|
---|
| 217 | QEMU_ARCH=i386-softmmu
|
---|
| 218 | else
|
---|
| 219 | QEMU_ARCH=x86_64-softmmu
|
---|
| 220 | fi
|
---|
| 221 |
|
---|
[a29d9e0] | 222 |
|
---|
[10f9bb45] | 223 | mkdir -vp build &&
|
---|
| 224 | cd build &&
|
---|
| 225 |
|
---|
[252e5bf] | 226 | ../configure --prefix=/usr \
|
---|
| 227 | --sysconfdir=/etc \
|
---|
[b0a073b] | 228 | --localstatedir=/var \
|
---|
[252e5bf] | 229 | --target-list=$QEMU_ARCH \
|
---|
| 230 | --audio-drv-list=alsa \
|
---|
[dff46c6] | 231 | --disable-pa \
|
---|
[252e5bf] | 232 | --docdir=/usr/share/doc/qemu-&qemu-version; &&
|
---|
| 233 |
|
---|
[aa9028e] | 234 | unset QEMU_ARCH &&
|
---|
| 235 |
|
---|
[9b13441] | 236 | make</userinput></screen>
|
---|
[d28198d3] | 237 |
|
---|
[43ef29db] | 238 | <para>
|
---|
[6aa48d38] | 239 | <application>qemu</application> uses <command>ninja</command> as
|
---|
[542bb708] | 240 | a subprocess when building. To run the tests, issue:
|
---|
| 241 | <command>ninja test</command>.
|
---|
[43ef29db] | 242 | </para>
|
---|
[d28198d3] | 243 |
|
---|
[9a04a8e9] | 244 | <para>
|
---|
[b4c31a6] | 245 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
[9a04a8e9] | 246 | </para>
|
---|
| 247 |
|
---|
[b4c31a6] | 248 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
[9a04a8e9] | 249 |
|
---|
| 250 | <para>
|
---|
[b4c31a6] | 251 | You will also need to add an Udev rule so that the KVM device gets correct
|
---|
[1f1f2230] | 252 | permissions. As the &root; user, issue:
|
---|
[9a04a8e9] | 253 | </para>
|
---|
| 254 |
|
---|
| 255 | <screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules << "EOF"
|
---|
[009eb04] | 256 | <literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
|
---|
[9a04a8e9] | 257 | EOF</userinput></screen>
|
---|
| 258 |
|
---|
[b4c31a6] | 259 | <para>
|
---|
| 260 | Change the permissions and ownership of a helper script, which is needed
|
---|
[1f1f2230] | 261 | when using the <quote>bridge</quote> network device (see below). Again
|
---|
| 262 | as the &root; user, issue:
|
---|
[b4c31a6] | 263 | </para>
|
---|
| 264 |
|
---|
| 265 | <screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &&
|
---|
| 266 | chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
|
---|
| 267 |
|
---|
[8ee3e19c] | 268 | <note>
|
---|
[47274444] | 269 | <para>
|
---|
[542bb708] | 270 | For convenience you may want to create a symbolic link to run
|
---|
[1f1f2230] | 271 | the installed program. For instance (as the &root; user):
|
---|
[542bb708] | 272 | </para>
|
---|
[d28198d3] | 273 |
|
---|
[10f9bb45] | 274 | <screen role="root"><userinput>ln -sv qemu-system-`uname -m` /usr/bin/qemu</userinput></screen>
|
---|
[d28198d3] | 275 | </note>
|
---|
| 276 |
|
---|
| 277 | </sect2>
|
---|
| 278 |
|
---|
[6a54383] | 279 | <sect2 role="commands">
|
---|
| 280 | <title>Command Explanations</title>
|
---|
| 281 |
|
---|
[a29d9e0] | 282 | <para>
|
---|
[1f1f2230] | 283 | <parameter>--audio-drv-list=alsa --disable-pa</parameter>: This switch
|
---|
| 284 | sets the audio driver to ALSA. See below for enabling other audio drivers.
|
---|
[9b13441] | 285 | </para>
|
---|
[6a54383] | 286 |
|
---|
[f9865e2] | 287 | <para>
|
---|
[1f1f2230] | 288 | <option>--audio-drv-list=pa --disable-alsa</option>: This switch sets
|
---|
| 289 | the audio driver to pulseaudio. For other drivers see the
|
---|
| 290 | --audio-drv-list choices in the output of
|
---|
| 291 | <command>./configure --help</command>. The default audio driver is OSS.
|
---|
| 292 | To enable support for both alsa and pulseaudio, use
|
---|
[f9865e2] | 293 | <option>--audio-drv-list=alsa,pa</option>.
|
---|
| 294 | </para>
|
---|
| 295 |
|
---|
[9b13441] | 296 | </sect2>
|
---|
[6a54383] | 297 |
|
---|
[b4c31a6] | 298 | <sect2 role="using">
|
---|
| 299 | <title>Using Qemu</title>
|
---|
| 300 |
|
---|
| 301 | <para>
|
---|
| 302 | Since using qemu means using a virtual computer, the steps to set up
|
---|
| 303 | the virtual machine are in close analogy with those to set up a real
|
---|
| 304 | computer. You'll need to decide about CPU, memory, disk, USB devices,
|
---|
| 305 | network card(s), screen size, etc. Once the <quote>hardware</quote> is
|
---|
| 306 | decided, you'll have for example to choose how to connect the machine
|
---|
| 307 | to internet, and/or to install an OS. In the following, we show basic
|
---|
| 308 | ways of performing those steps. But qemu is much more than this, and it
|
---|
| 309 | is strongly advised to read the qemu documentation in
|
---|
| 310 | <filename>/usr/share/doc/qemu-&qemu-version;/qemu-doc.html</filename>.
|
---|
| 311 | </para>
|
---|
[d28198d3] | 312 |
|
---|
[b4c31a6] | 313 | <note>
|
---|
| 314 | <para>
|
---|
| 315 | It is standard practice to name the computer running qemu
|
---|
| 316 | <quote>host</quote> and the emulated machine running under qemu the
|
---|
| 317 | <quote>guest</quote>. We'll use those notations in the following.
|
---|
| 318 | </para>
|
---|
| 319 | </note>
|
---|
[d28198d3] | 320 |
|
---|
[b4c31a6] | 321 | <note>
|
---|
| 322 | <para>
|
---|
| 323 | The following instructions assume the optional symbolic link,
|
---|
| 324 | <filename>qemu</filename>, has been created. Additionally,
|
---|
[1f1f2230] | 325 | <command>qemu</command> should be run in a graphical environment.
|
---|
| 326 | But it is possible to use qemu <quote>headless</quote> or through
|
---|
| 327 | SSH. See the documentation for the various possibilities.
|
---|
[b4c31a6] | 328 | </para>
|
---|
| 329 | </note>
|
---|
[d28198d3] | 330 |
|
---|
[b4c31a6] | 331 | <bridgehead renderas="sect3">Disk</bridgehead>
|
---|
| 332 | <para>
|
---|
| 333 | A virtual disk may be set up in the following way:
|
---|
| 334 | </para>
|
---|
[d28198d3] | 335 |
|
---|
[b4c31a6] | 336 | <screen><userinput>VDISK_SIZE=<replaceable>50G</replaceable>
|
---|
| 337 | VDISK_FILENAME=<replaceable>vdisk.img</replaceable>
|
---|
| 338 | qemu-img create -f qcow2 $VDISK_FILENAME $VDISK_SIZE</userinput></screen>
|
---|
[d28198d3] | 339 |
|
---|
[b4c31a6] | 340 | <para>
|
---|
[9d6565bf] | 341 | The virtual disk size and filename should be adjusted as desired. The
|
---|
[b4c31a6] | 342 | actual size of the file will be less than specified, but will expand as
|
---|
| 343 | needed, so it is safe to put a high value.
|
---|
| 344 | </para>
|
---|
| 345 |
|
---|
| 346 | <bridgehead renderas="sect3">Operating System</bridgehead>
|
---|
| 347 | <para>
|
---|
[0639bb6] | 348 | To install an operating system, download an iso image from your preferred
|
---|
[b4c31a6] | 349 | Linux distribution. For the purposes of this example, we'll use
|
---|
| 350 | <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
|
---|
| 351 | directory. Run the following:
|
---|
| 352 | </para>
|
---|
[d28198d3] | 353 |
|
---|
[b4c31a6] | 354 | <screen><userinput>qemu -enable-kvm \
|
---|
| 355 | -drive file=$VDISK_FILENAME \
|
---|
[0d7900a] | 356 | -cdrom Fedora-16-x86_64-Live-LXDE.iso \
|
---|
[d28198d3] | 357 | -boot d \
|
---|
[b4c31a6] | 358 | -m <replaceable>1G</replaceable></userinput></screen>
|
---|
| 359 |
|
---|
| 360 | <para>
|
---|
| 361 | Follow the normal installation procedures for the chosen distribution.
|
---|
| 362 | The <parameter>-boot</parameter> option specifies the boot order of
|
---|
| 363 | drives as a string of drive letters. Valid drive letters are: a, b
|
---|
| 364 | (floppy 1 and 2), c (first hard disk), d (first CD-ROM). The
|
---|
| 365 | <parameter>-m</parameter> option is the amount of memory to use for the
|
---|
| 366 | virtual machine. The choice depends on the load of the host. Modern
|
---|
| 367 | distributions should be comfortable with 1GB.
|
---|
| 368 | The <parameter>-enable-kvm</parameter> option allows hardware
|
---|
| 369 | acceleration. Without this switch, the emulation is much slower.
|
---|
| 370 | </para>
|
---|
| 371 |
|
---|
| 372 | <bridgehead renderas="sect3">Defining the virtual hardware</bridgehead>
|
---|
| 373 | <para>
|
---|
| 374 | The virtual machine hardware is defined by the qemu command line.
|
---|
| 375 | An example command is given below:
|
---|
| 376 | </para>
|
---|
| 377 |
|
---|
| 378 | <screen><userinput>qemu -enable-kvm \
|
---|
| 379 | -smp 4 \
|
---|
| 380 | -cpu host \
|
---|
| 381 | -m 1G \
|
---|
| 382 | -drive file=$VDISK_FILENAME \
|
---|
| 383 | -cdrom grub-img.iso \
|
---|
| 384 | -boot order=c,once=d,menu=on \
|
---|
| 385 | -net nic,netdev=net0 \
|
---|
| 386 | -netdev user,id=net0 \
|
---|
[42326ce] | 387 | -device ac97 \
|
---|
[b4c31a6] | 388 | -vga std \
|
---|
| 389 | -serial mon:stdio \
|
---|
| 390 | -name "fedora-16"</userinput></screen>
|
---|
| 391 |
|
---|
| 392 | <bridgehead renderas="sect3">Meaning of the command line options</bridgehead>
|
---|
| 393 | <para>
|
---|
| 394 | <parameter>-enable-kvm</parameter>: enable full KVM virtualization
|
---|
| 395 | support. On some hardware, it may be necessary to add the undocumented
|
---|
| 396 | <option>-machine smm=off</option> option in order to enable KVM.
|
---|
| 397 | </para>
|
---|
| 398 |
|
---|
| 399 | <para>
|
---|
| 400 | <parameter>-smp <N></parameter>: enable symmetric multiprocessing
|
---|
| 401 | with <N> CPUs.
|
---|
| 402 | </para>
|
---|
| 403 |
|
---|
| 404 | <para>
|
---|
| 405 | <parameter>-cpu <model></parameter>: simulate CPU <model>.
|
---|
| 406 | the list of supported models can be obtained with <option>-cpu
|
---|
| 407 | help</option>.
|
---|
| 408 | </para>
|
---|
| 409 |
|
---|
| 410 | <para>
|
---|
| 411 | <parameter>-drive file=<filename></parameter>: defines a virtual
|
---|
| 412 | disk whose image is stored in <filename><filename></filename>.
|
---|
| 413 | </para>
|
---|
| 414 |
|
---|
| 415 | <para>
|
---|
[b9c353b] | 416 | <parameter>-cdrom grub-img.iso</parameter>: defines an iso formatted file
|
---|
[b4c31a6] | 417 | to use as a cdrom. Here we use a grub rescue disk, which may turn handy
|
---|
| 418 | when something goes wrong at boot time.
|
---|
| 419 | </para>
|
---|
| 420 |
|
---|
| 421 | <para>
|
---|
| 422 | <parameter>-boot order=c,once=d,menu=on</parameter>: defines the boot
|
---|
| 423 | order for the virtual BIOS.
|
---|
| 424 | </para>
|
---|
| 425 |
|
---|
| 426 | <para>
|
---|
| 427 | <parameter>-net nic,netdev=<netid></parameter>: defines a network
|
---|
| 428 | card connected to the network device with id <netid>.
|
---|
| 429 | </para>
|
---|
| 430 |
|
---|
| 431 | <para>
|
---|
| 432 | <parameter>-netdev user,id=<netid></parameter>: defines the
|
---|
| 433 | network <quote>user</quote> device. This is a virtual local network
|
---|
| 434 | with addresses 10.0.2.0/24, where the host has address 10.0.2.2 and
|
---|
| 435 | acts as a gateway to internet, and with a name server at address
|
---|
| 436 | 10.0.2.3, and an smb server at address 10.0.2.4. A builtin DHCP server
|
---|
| 437 | can allocate addresses between 10.0.2.15 and 10.0.2.31.
|
---|
| 438 | </para>
|
---|
| 439 |
|
---|
| 440 | <para>
|
---|
| 441 | <parameter>-soundhw <model></parameter>: defines the soundcard
|
---|
| 442 | model. The list may be obtained with <option>-soundhw help</option>.
|
---|
| 443 | </para>
|
---|
| 444 |
|
---|
| 445 | <para>
|
---|
| 446 | <parameter>-vga <type></parameter>: defines the type of vga card
|
---|
| 447 | to emulate.
|
---|
| 448 | </para>
|
---|
| 449 |
|
---|
| 450 | <para>
|
---|
| 451 | <parameter>-serial mon:stdio</parameter>: sends the serial port of the
|
---|
| 452 | guest (<filename>/dev/ttyS0</filename> on linux guests), multiplexed with
|
---|
| 453 | the qemu monitor, to the standard input and output of the qemu
|
---|
| 454 | process.
|
---|
| 455 | </para>
|
---|
| 456 |
|
---|
| 457 | <para>
|
---|
| 458 | <parameter>-name <name></parameter>: sets the name of the guest.
|
---|
| 459 | This name is displayed in the guest window caption. It may be useful
|
---|
| 460 | if you run several guests at the same time.
|
---|
| 461 | </para>
|
---|
| 462 |
|
---|
[46a8304] | 463 | <para>
|
---|
| 464 | <option>-pflash /usr/share/qemu/edk2-x86_64-code.fd</option>: Load a
|
---|
[b38aed5] | 465 | pre-built EDK2 UEFI firmware, instead of the default PC BIOS. Use
|
---|
[46a8304] | 466 | this option if you want to boot the guest OS with UEFI.
|
---|
| 467 | </para>
|
---|
| 468 |
|
---|
[10311fa] | 469 | <para>
|
---|
| 470 | <option>-drive file=<filename>,if=virtio</option>: Provide
|
---|
| 471 | Virtio interface to the guest kernel for accessing the disk image,
|
---|
| 472 | instead of simulating a real disk hardware. This can improve disk I/O
|
---|
| 473 | performance, but it requires a Virtio driver in guest kernel. Use
|
---|
| 474 | it instead of a plain <option>-drive</option> if the guest kernel
|
---|
| 475 | supports Virtio. Note that if the guest kernel is Linux, the virtual
|
---|
| 476 | disks using Virtio interface will be named <filename>vdx</filename>
|
---|
| 477 | in the devtmpfs, instead of <filename>sdx</filename>.
|
---|
| 478 | </para>
|
---|
| 479 |
|
---|
| 480 | <para>
|
---|
| 481 | <option>-net nic,netdev=net0,model=virtio-net-pci</option>: Provide
|
---|
| 482 | Virtio interface to the guest kernel for accessing the network
|
---|
| 483 | interface, instead of simulating a real network interface card. This
|
---|
| 484 | can improve network I/O performance, but it requires a Virtio driver
|
---|
| 485 | in guest kernel. Use it instead of a plain <option>-net</option> if
|
---|
| 486 | the guest kernel supports Virtio.
|
---|
| 487 | </para>
|
---|
| 488 |
|
---|
[0639bb6] | 489 | <bridgehead renderas="sect3">Controlling the Emulated Display</bridgehead>
|
---|
[b4c31a6] | 490 | <para>
|
---|
| 491 | It may happen that the guest window displayed by qemu does not correspond
|
---|
| 492 | to the full capability of the emulated vga card. For example, the vmware
|
---|
| 493 | card is 1600x900 capable, but only 1024x768 is displayed by default.
|
---|
| 494 | A suitable Xorg configuration on the guest allows to use the full size
|
---|
| 495 | (Note that the Xorg video driver to use is <xref
|
---|
| 496 | linkend="xorg-vmware-driver"/>):
|
---|
| 497 | </para>
|
---|
[855c1f7] | 498 |
|
---|
| 499 | <screen role="root"><userinput>cat > /usr/share/X11/xorg.conf.d/20-vmware.conf << "EOF"
|
---|
[577d43d] | 500 | <literal>Section "Monitor"
|
---|
| 501 | Identifier "Monitor0"
|
---|
| 502 | # cvt 1600 900
|
---|
| 503 | # 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
|
---|
| 504 | Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
|
---|
| 505 | Option "PreferredMode" "1600x900"
|
---|
| 506 | HorizSync 1-200
|
---|
| 507 | VertRefresh 1-200
|
---|
[855c1f7] | 508 | EndSection
|
---|
| 509 |
|
---|
[577d43d] | 510 | Section "Device"
|
---|
[855c1f7] | 511 | Identifier "VMware SVGA II Adapter"
|
---|
| 512 | Option "Monitor" "default"
|
---|
| 513 | Driver "vmware"
|
---|
| 514 | EndSection
|
---|
| 515 |
|
---|
[577d43d] | 516 | Section "Screen"
|
---|
[855c1f7] | 517 | Identifier "Default Screen"
|
---|
| 518 | Device "VMware SVGA II Adapter"
|
---|
| 519 | Monitor "Monitor0"
|
---|
| 520 |
|
---|
| 521 | SubSection "Display"
|
---|
| 522 | Depth 24
|
---|
| 523 | Modes "1600x900" "1440x900" "1366x768" "1280x720" "800x480"
|
---|
| 524 | EndSubSection
|
---|
| 525 |
|
---|
| 526 | EndSection</literal>
|
---|
| 527 | EOF</userinput></screen>
|
---|
| 528 |
|
---|
[b4c31a6] | 529 | <para>
|
---|
| 530 | New sizes will be available besides the native ones. You need to
|
---|
| 531 | restart X in order to have the new sizes available.
|
---|
| 532 | </para>
|
---|
[d28198d3] | 533 |
|
---|
[b4c31a6] | 534 | <bridgehead renderas="sect3">Networking</bridgehead>
|
---|
| 535 | <para>
|
---|
[449c552] | 536 | The above solution for networking allows the guest to access the local
|
---|
[b4c31a6] | 537 | network through the host (and possibly to access internet through the
|
---|
| 538 | local routers), but the converse is not true. Not even the host can
|
---|
| 539 | access the guest, unless port forwarding is enabled. And in the case
|
---|
| 540 | several guests are running, they cannot communicate with each other.
|
---|
| 541 | Other network devices can be used for this purpose. For example, there
|
---|
| 542 | is the <quote>socket</quote> device, which allows several guests to
|
---|
| 543 | share a common virtual network. In the following, we describe in more
|
---|
| 544 | details how to set up the <quote>bridge</quote> device, which allows
|
---|
| 545 | the guests to appear as if connected to the local network. All the
|
---|
| 546 | commands below should be run as the <systemitem
|
---|
| 547 | class="username">root</systemitem> user.
|
---|
| 548 | </para>
|
---|
[0d7900a] | 549 |
|
---|
[b4c31a6] | 550 | <para revision="sysv">
|
---|
| 551 | Set up bridging with <xref linkend="bridgeutils"/>. Only the physical
|
---|
| 552 | interface(s) should be set up at boot. The virtual interface(s) will be
|
---|
| 553 | added as needed when qemu is started.
|
---|
| 554 | </para>
|
---|
| 555 |
|
---|
[47274444] | 556 | <para revision="systemd">
|
---|
| 557 | <!-- On SYS-V, IP_FORWARD is enabled by the bridge script. -->
|
---|
[b4c31a6] | 558 | Allow the host to forward IP packets:
|
---|
| 559 | </para>
|
---|
[d28198d3] | 560 |
|
---|
[b4c31a6] | 561 | <screen role="root"
|
---|
| 562 | revision="systemd"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
|
---|
[d28198d3] | 563 |
|
---|
[b4c31a6] | 564 | <para revision="systemd">
|
---|
| 565 | To make this permanent, add the command to
|
---|
| 566 | <filename>/etc/sysctl.d/60-net-forward.conf:</filename>
|
---|
| 567 | </para>
|
---|
[6e5e4d2] | 568 |
|
---|
[b4c31a6] | 569 | <screen role="root"
|
---|
| 570 | revision="systemd"><userinput>cat >> /etc/sysctl.d/60-net-forward.conf << EOF
|
---|
[51dfb3e] | 571 | <literal>net.ipv4.ip_forward=1</literal>
|
---|
[6e5e4d2] | 572 | EOF</userinput></screen>
|
---|
| 573 |
|
---|
[b4c31a6] | 574 | <para>
|
---|
| 575 | Set up a required configuration file:
|
---|
| 576 | </para>
|
---|
[670f775] | 577 |
|
---|
[3a87232] | 578 | <!-- /etc/qemu has not been installed by "make install" since version 2.4 -->
|
---|
| 579 | <screen role="root"><userinput>install -vdm 755 /etc/qemu &&
|
---|
| 580 | echo allow br0 > /etc/qemu/bridge.conf</userinput></screen>
|
---|
[670f775] | 581 |
|
---|
[b4c31a6] | 582 | <para>
|
---|
[1f1f2230] | 583 | In the qemu command line above, replace the switch
|
---|
| 584 | <parameter>-netdev user,...</parameter> with
|
---|
| 585 | <parameter>-netdev bridge,...</parameter>.
|
---|
[b4c31a6] | 586 | </para>
|
---|
[d28198d3] | 587 |
|
---|
| 588 | </sect2>
|
---|
| 589 |
|
---|
| 590 | <sect2 role="content">
|
---|
| 591 | <title>Contents</title>
|
---|
| 592 |
|
---|
| 593 | <segmentedlist>
|
---|
[9b13441] | 594 | <segtitle>Installed Programs</segtitle>
|
---|
| 595 | <segtitle>Installed Library</segtitle>
|
---|
[d28198d3] | 596 | <segtitle>Installed Directories</segtitle>
|
---|
| 597 |
|
---|
| 598 | <seglistitem>
|
---|
[9b13441] | 599 | <seg>
|
---|
[a541e080] | 600 | elf2dmp,
|
---|
[10f9bb45] | 601 | qemu (symlink),
|
---|
[a541e080] | 602 | qemu-edid,
|
---|
[9b13441] | 603 | qemu-ga,
|
---|
| 604 | qemu-img,
|
---|
| 605 | qemu-io,
|
---|
[a541e080] | 606 | qemu-keymap,
|
---|
[9b13441] | 607 | qemu-nbd,
|
---|
[a541e080] | 608 | qemu-pr-helper,
|
---|
| 609 | qemu-storage-daemon, and
|
---|
| 610 | qemu-system-<arch>
|
---|
[9b13441] | 611 | </seg>
|
---|
[b4c31a6] | 612 | <seg>None</seg>
|
---|
[9b13441] | 613 | <seg>
|
---|
[b4c31a6] | 614 | /usr/share/qemu and
|
---|
[a541e080] | 615 | /usr/share/doc/qemu-&qemu-version; (optional)
|
---|
[9b13441] | 616 | </seg>
|
---|
[d28198d3] | 617 | </seglistitem>
|
---|
| 618 | </segmentedlist>
|
---|
| 619 |
|
---|
| 620 | <variablelist>
|
---|
| 621 | <bridgehead renderas="sect3">Short Description</bridgehead>
|
---|
| 622 | <?dbfo list-presentation="list"?>
|
---|
| 623 | <?dbhtml list-presentation="table"?>
|
---|
| 624 |
|
---|
[a541e080] | 625 | <varlistentry id="elf2dmp">
|
---|
| 626 | <term><command>elf2dmp</command></term>
|
---|
| 627 | <listitem>
|
---|
| 628 | <para>
|
---|
| 629 | Converts files from elf to dmp format
|
---|
| 630 | </para>
|
---|
| 631 | <indexterm zone="qemu elf2dmp">
|
---|
| 632 | <primary sortas="b-elf2dmp">elf2dmp</primary>
|
---|
| 633 | </indexterm>
|
---|
| 634 | </listitem>
|
---|
| 635 | </varlistentry>
|
---|
| 636 | <!--
|
---|
[b4c31a6] | 637 | <varlistentry id="ivshmem-client">
|
---|
| 638 | <term><command>ivshmem-client</command></term>
|
---|
| 639 | <listitem>
|
---|
[47274444] | 640 | <para>
|
---|
[4c24eb0a] | 641 | is a standalone client for using the ivshmem device
|
---|
[47274444] | 642 | </para>
|
---|
[b4c31a6] | 643 | <indexterm zone="qemu ivshmem-client">
|
---|
| 644 | <primary sortas="b-ivshmem-client">ivshmem-client</primary>
|
---|
| 645 | </indexterm>
|
---|
| 646 | </listitem>
|
---|
| 647 | </varlistentry>
|
---|
| 648 |
|
---|
| 649 | <varlistentry id="ivshmem-server">
|
---|
| 650 | <term><command>ivshmem-server</command></term>
|
---|
| 651 | <listitem>
|
---|
[47274444] | 652 | <para>
|
---|
[4c24eb0a] | 653 | is an example server for the ivshmem device
|
---|
[47274444] | 654 | </para>
|
---|
[b4c31a6] | 655 | <indexterm zone="qemu ivshmem-server">
|
---|
| 656 | <primary sortas="b-ivshmem-server">ivshmem-server</primary>
|
---|
| 657 | </indexterm>
|
---|
| 658 | </listitem>
|
---|
| 659 | </varlistentry>
|
---|
[a541e080] | 660 | -->
|
---|
[f9865e2] | 661 | <varlistentry id="qemu-edid">
|
---|
| 662 | <term><command>qemu-edid</command></term>
|
---|
| 663 | <listitem>
|
---|
[47274444] | 664 | <para>
|
---|
[4c24eb0a] | 665 | is a test tool for the qemu EDID generator
|
---|
[47274444] | 666 | </para>
|
---|
[f9865e2] | 667 | <indexterm zone="qemu qemu-edid">
|
---|
| 668 | <primary sortas="b-qemu-edid">qemu-edid</primary>
|
---|
| 669 | </indexterm>
|
---|
| 670 | </listitem>
|
---|
| 671 | </varlistentry>
|
---|
| 672 |
|
---|
[d28198d3] | 673 | <varlistentry id="qemu-ga">
|
---|
| 674 | <term><command>qemu-ga</command></term>
|
---|
| 675 | <listitem>
|
---|
[47274444] | 676 | <para>
|
---|
| 677 | implements support for QMP (QEMU Monitor Protocol) commands and
|
---|
| 678 | events that terminate and originate respectively within the guest
|
---|
[4c24eb0a] | 679 | using an agent built as part of QEMU
|
---|
[47274444] | 680 | </para>
|
---|
[2f6053d] | 681 | <indexterm zone="qemu qemu-ga">
|
---|
[d28198d3] | 682 | <primary sortas="b-qemu-ga">qemu-ga</primary>
|
---|
| 683 | </indexterm>
|
---|
| 684 | </listitem>
|
---|
| 685 | </varlistentry>
|
---|
| 686 |
|
---|
| 687 | <varlistentry id="qemu-img">
|
---|
| 688 | <term><command>qemu-img</command></term>
|
---|
| 689 | <listitem>
|
---|
[47274444] | 690 | <para>
|
---|
[4c24eb0a] | 691 | provides commands to manage QEMU disk images
|
---|
[47274444] | 692 | </para>
|
---|
[2f6053d] | 693 | <indexterm zone="qemu qemu-img">
|
---|
[d28198d3] | 694 | <primary sortas="b-qemu-img">qemu-img</primary>
|
---|
| 695 | </indexterm>
|
---|
| 696 | </listitem>
|
---|
| 697 | </varlistentry>
|
---|
| 698 |
|
---|
| 699 | <varlistentry id="qemu-io">
|
---|
| 700 | <term><command>qemu-io</command></term>
|
---|
| 701 | <listitem>
|
---|
[47274444] | 702 | <para>
|
---|
| 703 | is a diagnostic and manipulation program for (virtual) memory
|
---|
[9d6565bf] | 704 | media. It is still at an early stage of development
|
---|
[47274444] | 705 | </para>
|
---|
[2f6053d] | 706 | <indexterm zone="qemu qemu-io">
|
---|
[d28198d3] | 707 | <primary sortas="b-qemu-io">qemu-io</primary>
|
---|
| 708 | </indexterm>
|
---|
| 709 | </listitem>
|
---|
| 710 | </varlistentry>
|
---|
| 711 |
|
---|
[a541e080] | 712 | <varlistentry id="qemu-keymap">
|
---|
| 713 | <term><command>qemu-keymap</command></term>
|
---|
| 714 | <listitem>
|
---|
| 715 | <para>
|
---|
| 716 | generates qemu reverse keymaps from xkb keymaps,
|
---|
| 717 | which can be used with the qemu "-k" command line switch
|
---|
| 718 | </para>
|
---|
| 719 | <indexterm zone="qemu qemu-keymap">
|
---|
| 720 | <primary sortas="b-qemu-keymap">qemu-keymap</primary>
|
---|
| 721 | </indexterm>
|
---|
| 722 | </listitem>
|
---|
| 723 | </varlistentry>
|
---|
| 724 |
|
---|
| 725 |
|
---|
[d28198d3] | 726 | <varlistentry id="qemu-nbd">
|
---|
| 727 | <term><command>qemu-nbd</command></term>
|
---|
| 728 | <listitem>
|
---|
[47274444] | 729 | <para>
|
---|
| 730 | exports Qemu disk images using the QEMU Disk Network Block
|
---|
[4c24eb0a] | 731 | Device (NBD) protocol
|
---|
[47274444] | 732 | </para>
|
---|
[2f6053d] | 733 | <indexterm zone="qemu qemu-nbd">
|
---|
[d28198d3] | 734 | <primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
---|
| 735 | </indexterm>
|
---|
| 736 | </listitem>
|
---|
| 737 | </varlistentry>
|
---|
| 738 |
|
---|
[a541e080] | 739 | <varlistentry id="qemu-pr-helper">
|
---|
| 740 | <term><command>qemu-pr-helper</command></term>
|
---|
| 741 | <listitem>
|
---|
| 742 | <para>
|
---|
| 743 | Implements the persistent reservation helper for QEMU
|
---|
| 744 | </para>
|
---|
| 745 | <indexterm zone="qemu qemu-pr-helper">
|
---|
| 746 | <primary sortas="b-qemu-pr-helper">qemu-pr-helper</primary>
|
---|
| 747 | </indexterm>
|
---|
| 748 | </listitem>
|
---|
| 749 | </varlistentry>
|
---|
| 750 |
|
---|
| 751 | <varlistentry id="qemu-storage-daemon">
|
---|
| 752 | <term><command>qemu-storage-daemon</command></term>
|
---|
| 753 | <listitem>
|
---|
| 754 | <para>
|
---|
| 755 | allows to modify disk images using the QEMU Monitor Protocol (QMP)
|
---|
| 756 | without running a VM
|
---|
| 757 | </para>
|
---|
| 758 | <indexterm zone="qemu qemu-storage-daemon">
|
---|
| 759 | <primary sortas="b-qemu-storage-daemon">qemu-storage-daemon</primary>
|
---|
| 760 | </indexterm>
|
---|
| 761 | </listitem>
|
---|
| 762 | </varlistentry>
|
---|
| 763 |
|
---|
[d28198d3] | 764 | <varlistentry id="qemu-system">
|
---|
| 765 | <term><command>qemu-system-x86_64</command></term>
|
---|
| 766 | <listitem>
|
---|
[47274444] | 767 | <para>
|
---|
[4c24eb0a] | 768 | is the QEMU PC System emulator
|
---|
[47274444] | 769 | </para>
|
---|
[2f6053d] | 770 | <indexterm zone="qemu qemu-system">
|
---|
[d28198d3] | 771 | <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
---|
| 772 | </indexterm>
|
---|
| 773 | </listitem>
|
---|
| 774 | </varlistentry>
|
---|
[a541e080] | 775 | <!--
|
---|
[72d90b67] | 776 | <varlistentry id="virtfs-proxy-helper">
|
---|
| 777 | <term><command>virtfs-proxy-helper</command></term>
|
---|
| 778 | <listitem>
|
---|
[47274444] | 779 | <para>
|
---|
[9d6565bf] | 780 | creates a socket pair or a named socket. QEMU and the proxy helper
|
---|
| 781 | communicate using this socket. The QEMU proxy fs driver sends
|
---|
| 782 | filesystem requests to the proxy helper and receives the response
|
---|
[4c24eb0a] | 783 | from it
|
---|
[47274444] | 784 | </para>
|
---|
[72d90b67] | 785 | <indexterm zone="qemu virtfs-proxy-helper">
|
---|
| 786 | <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
|
---|
| 787 | </indexterm>
|
---|
| 788 | </listitem>
|
---|
| 789 | </varlistentry>
|
---|
[a541e080] | 790 | -->
|
---|
[d28198d3] | 791 | </variablelist>
|
---|
| 792 |
|
---|
| 793 | </sect2>
|
---|
| 794 |
|
---|
| 795 | </sect1>
|
---|