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