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