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