[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 |
|
---|
[feb7c00] | 7 | <!ENTITY qemu-download-http "http://download.qemu-project.org/qemu-&qemu-version;.tar.xz">
|
---|
[2f6053d] | 8 | <!ENTITY qemu-download-ftp " ">
|
---|
[7d85f2a] | 9 | <!ENTITY qemu-md5sum "ede6005d7143fe994dd089d31dc2cf6c">
|
---|
| 10 | <!ENTITY qemu-size "60 MB">
|
---|
| 11 | <!ENTITY qemu-buildsize "1.1 GB (add 445 MB for tests)">
|
---|
| 12 | <!ENTITY qemu-time "0.8 SBU (using parallelism=4; add 4.9 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 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
[d28198d3] | 21 | </sect1info>
|
---|
| 22 |
|
---|
[2f6053d] | 23 | <title>qemu-&qemu-version;</title>
|
---|
[d28198d3] | 24 |
|
---|
[2f6053d] | 25 | <indexterm zone="qemu">
|
---|
| 26 | <primary sortas="a-qemu">qemu</primary>
|
---|
[d28198d3] | 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
[2f6053d] | 30 | <title>Introduction to qemu</title>
|
---|
[d28198d3] | 31 |
|
---|
[47274444] | 32 | <para>
|
---|
| 33 | <application>qemu</application> is a full virtualization solution for
|
---|
| 34 | Linux on x86 hardware containing virtualization extensions (Intel VT or
|
---|
| 35 | AMD-V).
|
---|
| 36 | </para>
|
---|
[d28198d3] | 37 |
|
---|
[c6fc9b28] | 38 | &lfs91_checked;
|
---|
[27643d0f] | 39 |
|
---|
[d28198d3] | 40 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 41 | <itemizedlist spacing="compact">
|
---|
| 42 | <listitem>
|
---|
[47274444] | 43 | <para>
|
---|
| 44 | Download (HTTP): <ulink url="&qemu-download-http;"/>
|
---|
| 45 | </para>
|
---|
[d28198d3] | 46 | </listitem>
|
---|
| 47 | <listitem>
|
---|
[47274444] | 48 | <para>
|
---|
| 49 | Download (FTP): <ulink url="&qemu-download-ftp;"/>
|
---|
| 50 | </para>
|
---|
[d28198d3] | 51 | </listitem>
|
---|
| 52 | <listitem>
|
---|
[47274444] | 53 | <para>
|
---|
| 54 | Download MD5 sum: &qemu-md5sum;
|
---|
| 55 | </para>
|
---|
[d28198d3] | 56 | </listitem>
|
---|
| 57 | <listitem>
|
---|
[47274444] | 58 | <para>
|
---|
| 59 | Download size: &qemu-size;
|
---|
| 60 | </para>
|
---|
[d28198d3] | 61 | </listitem>
|
---|
| 62 | <listitem>
|
---|
[47274444] | 63 | <para>
|
---|
| 64 | Estimated disk space required: &qemu-buildsize;
|
---|
| 65 | </para>
|
---|
[d28198d3] | 66 | </listitem>
|
---|
| 67 | <listitem>
|
---|
[47274444] | 68 | <para>
|
---|
| 69 | Estimated build time: &qemu-time;
|
---|
| 70 | </para>
|
---|
[d28198d3] | 71 | </listitem>
|
---|
| 72 | </itemizedlist>
|
---|
[54f740f] | 73 |
|
---|
[2f6053d] | 74 | <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
|
---|
[d28198d3] | 75 |
|
---|
| 76 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 77 | <para role="required">
|
---|
[f9865e2] | 78 | <xref linkend="glib2"/>, and
|
---|
[d28198d3] | 79 | <xref linkend="x-window-system"/>
|
---|
| 80 | </para>
|
---|
| 81 |
|
---|
[c41b38f] | 82 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 83 | <para role="recommended">
|
---|
[80a314c] | 84 | <xref linkend="alsa-lib"/> and
|
---|
[b4c31a6] | 85 | <xref linkend="sdl2"/>
|
---|
[c41b38f] | 86 | </para>
|
---|
| 87 |
|
---|
[d28198d3] | 88 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 89 | <para role="optional">
|
---|
[80a314c] | 90 | Depending on the sound system, various packages in <xref linkend="alsa"/>,
|
---|
[2d7c53d] | 91 | <xref linkend="python3"/>,
|
---|
[11b931a6] | 92 | <xref linkend="pulseaudio"/>,
|
---|
[8ade43b] | 93 | <xref linkend="bluez"/>,
|
---|
[d28198d3] | 94 | <xref linkend="curl"/>,
|
---|
[8ade43b] | 95 | <xref linkend="cyrus-sasl"/>,
|
---|
[10f9bb45] | 96 | <xref linkend="gnutls"/>,
|
---|
[8ade43b] | 97 | <xref linkend="gtk2"/>,
|
---|
| 98 | <xref linkend="gtk3"/>,
|
---|
| 99 | <xref linkend="libusb"/>,
|
---|
[10f9bb45] | 100 | <xref linkend="libgcrypt"/>,
|
---|
[fee79e2] | 101 | <xref linkend="libssh2"/>,
|
---|
[8ade43b] | 102 | <xref linkend="lzo"/>,
|
---|
[10f9bb45] | 103 | <xref linkend="nettle"/>,
|
---|
| 104 | <xref linkend="mesa"/>,
|
---|
| 105 | <xref linkend="sdl"/>,
|
---|
[cac7f93] | 106 | <xref role="nodep" linkend="vte"/> or <xref linkend="vte2"/>, and
|
---|
[b4c31a6] | 107 | <!-- libcacard has been a standalone project since qemu-2.5.-->
|
---|
[fee79e2] | 108 | <ulink url="https://www.spice-space.org/page/Libcacard">libcacard</ulink>
|
---|
[d28198d3] | 109 | </para>
|
---|
| 110 |
|
---|
[9b13441] | 111 | <note>
|
---|
| 112 | <para>
|
---|
| 113 | This optional dependencies list is not comprehensive. See the output of
|
---|
| 114 | <command>./configure --help</command> for a more complete list.
|
---|
| 115 | </para>
|
---|
| 116 | </note>
|
---|
| 117 |
|
---|
[d28198d3] | 118 | <para condition="html" role="usernotes">User Notes:
|
---|
[2f6053d] | 119 | <ulink url="&blfs-wiki;/qemu"/></para>
|
---|
[d28198d3] | 120 |
|
---|
| 121 | </sect2>
|
---|
| 122 |
|
---|
[2f6053d] | 123 | <sect2 id='qemu-prereq'>
|
---|
[1eb4fcf] | 124 | <title>KVM Prerequisites</title>
|
---|
[d28198d3] | 125 |
|
---|
[47274444] | 126 | <para>
|
---|
| 127 | Before building <application>qemu</application>, check to see if
|
---|
| 128 | your processor supports Virtualization Technology (VT):
|
---|
| 129 | </para>
|
---|
[d28198d3] | 130 |
|
---|
| 131 | <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
---|
| 132 |
|
---|
[47274444] | 133 | <para>
|
---|
| 134 | If you get any output, you have VT technology (vmx for Intel
|
---|
| 135 | processors and svm for AMD processors). You then need to go into your
|
---|
| 136 | system BIOS and ensure it is enabled. After enabing, reboot back to your
|
---|
| 137 | LFS instance.
|
---|
| 138 | </para>
|
---|
[d28198d3] | 139 |
|
---|
| 140 | </sect2>
|
---|
| 141 |
|
---|
[2f6053d] | 142 | <sect2 role="kernel" id='qemu-kernel'>
|
---|
[d28198d3] | 143 | <title>Kernel Configuration</title>
|
---|
| 144 |
|
---|
[47274444] | 145 | <para>
|
---|
| 146 | Enable the following options in the kernel configuration and
|
---|
| 147 | recompile the kernel if necessary:
|
---|
| 148 | </para>
|
---|
[d28198d3] | 149 |
|
---|
[421128a1] | 150 | <screen><literal>[*] Virtualization: ---> [CONFIG_VIRTUALIZATION]
|
---|
| 151 | <*/M> Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
|
---|
| 152 | <*/M> KVM for Intel processors support [CONFIG_KVM_INTEL]
|
---|
| 153 | <*/M> KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
|
---|
[d28198d3] | 154 |
|
---|
[2f6053d] | 155 | <indexterm zone="qemu qemu-kernel">
|
---|
| 156 | <primary sortas="d-qemu">qemu</primary>
|
---|
[d28198d3] | 157 | </indexterm>
|
---|
| 158 |
|
---|
[47274444] | 159 | <para>
|
---|
| 160 | The Intel or AMD settings are not both required, but the one matching
|
---|
| 161 | your system processor is required.
|
---|
| 162 | </para>
|
---|
[d28198d3] | 163 |
|
---|
[b4c31a6] | 164 | <para>
|
---|
| 165 | To use the <quote>bridge</quote> network device, as explained below,
|
---|
| 166 | check that <xref linkend='bridgeutils'/> is installed
|
---|
| 167 | and the following options in the kernel configuration are enabled:
|
---|
| 168 | </para>
|
---|
[9b13441] | 169 |
|
---|
[421128a1] | 170 | <screen><literal>[*] Networking support ---> [CONFIG_NET]
|
---|
[9b13441] | 171 | Networking options --->
|
---|
[421128a1] | 172 | <*/M> 802.1d Ethernet Bridging [CONFIG_BRIDGE]
|
---|
[9b13441] | 173 | Device Drivers --->
|
---|
[421128a1] | 174 | [*] Network device support ---> [CONFIG_NETDEVICES]
|
---|
| 175 | <*/M> Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
|
---|
[d28198d3] | 176 |
|
---|
| 177 | </sect2>
|
---|
| 178 |
|
---|
| 179 | <sect2 role="installation">
|
---|
[2f6053d] | 180 | <title>Installation of qemu</title>
|
---|
[0d7900a] | 181 |
|
---|
[9f309be] | 182 | <para revision="sysv">
|
---|
[b4c31a6] | 183 | You will need a dedicated group that will contain users (other than root)
|
---|
| 184 | allowed to access the KVM device. Create this group by running the
|
---|
| 185 | following command as the
|
---|
| 186 | <systemitem class="username">root</systemitem> user:
|
---|
| 187 | </para>
|
---|
| 188 |
|
---|
[9f309be] | 189 | <screen role="root" revision="sysv"><userinput>groupadd -g 61 kvm</userinput></screen>
|
---|
[b4c31a6] | 190 |
|
---|
| 191 | <para>
|
---|
| 192 | Add any users that might use the KVM device to that group:
|
---|
| 193 | </para>
|
---|
| 194 |
|
---|
| 195 | <screen role="root"><userinput>usermod -a -G kvm <replaceable><username></replaceable></userinput></screen>
|
---|
| 196 |
|
---|
[47274444] | 197 | <para>
|
---|
| 198 | Install <application>qemu</application> by running the following
|
---|
| 199 | commands:
|
---|
| 200 | </para>
|
---|
[d28198d3] | 201 |
|
---|
[47274444] | 202 | <note>
|
---|
| 203 | <para>
|
---|
| 204 | Qemu is capable of running many targets. The build process
|
---|
| 205 | is also capable of building multiple targets at one time in a
|
---|
| 206 | comma delimited list assigned to <option>--target-list</option>. Run
|
---|
| 207 | <command>./configure --help</command> to get a complete list of
|
---|
| 208 | available targets.
|
---|
| 209 | </para>
|
---|
| 210 | </note>
|
---|
[aa9028e] | 211 |
|
---|
| 212 |
|
---|
| 213 | <screen><userinput>if [ $(uname -m) = i686 ]; then
|
---|
| 214 | QEMU_ARCH=i386-softmmu
|
---|
| 215 | else
|
---|
| 216 | QEMU_ARCH=x86_64-softmmu
|
---|
| 217 | fi
|
---|
| 218 |
|
---|
[a29d9e0] | 219 |
|
---|
[10f9bb45] | 220 | mkdir -vp build &&
|
---|
| 221 | cd build &&
|
---|
| 222 |
|
---|
[252e5bf] | 223 | ../configure --prefix=/usr \
|
---|
| 224 | --sysconfdir=/etc \
|
---|
| 225 | --target-list=$QEMU_ARCH \
|
---|
| 226 | --audio-drv-list=alsa \
|
---|
| 227 | --docdir=/usr/share/doc/qemu-&qemu-version; &&
|
---|
| 228 |
|
---|
[aa9028e] | 229 | unset QEMU_ARCH &&
|
---|
| 230 |
|
---|
[9b13441] | 231 | make</userinput></screen>
|
---|
[d28198d3] | 232 |
|
---|
[43ef29db] | 233 | <para>
|
---|
| 234 | To run the built in tests, run <command>make V=1 -k check</command>.
|
---|
| 235 | </para>
|
---|
[d28198d3] | 236 |
|
---|
[9a04a8e9] | 237 | <para>
|
---|
[b4c31a6] | 238 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
[9a04a8e9] | 239 | </para>
|
---|
| 240 |
|
---|
[b4c31a6] | 241 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
[9a04a8e9] | 242 |
|
---|
| 243 | <para>
|
---|
[b4c31a6] | 244 | You will also need to add an Udev rule so that the KVM device gets correct
|
---|
[9a04a8e9] | 245 | permissions:
|
---|
| 246 | </para>
|
---|
| 247 |
|
---|
| 248 | <screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules << "EOF"
|
---|
[009eb04] | 249 | <literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
|
---|
[9a04a8e9] | 250 | EOF</userinput></screen>
|
---|
| 251 |
|
---|
[b4c31a6] | 252 | <para>
|
---|
| 253 | Change the permissions and ownership of a helper script, which is needed
|
---|
| 254 | when using the <quote>bridge</quote> network device (see below):
|
---|
| 255 | </para>
|
---|
| 256 |
|
---|
| 257 | <screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &&
|
---|
| 258 | chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
|
---|
| 259 |
|
---|
[8ee3e19c] | 260 | <note>
|
---|
[47274444] | 261 | <para>
|
---|
| 262 | For convenience you may want to create a symbolic link to run
|
---|
| 263 | the installed program. For instance:
|
---|
| 264 | </para>
|
---|
[d28198d3] | 265 |
|
---|
[10f9bb45] | 266 | <screen role="root"><userinput>ln -sv qemu-system-`uname -m` /usr/bin/qemu</userinput></screen>
|
---|
[d28198d3] | 267 | </note>
|
---|
| 268 |
|
---|
| 269 | </sect2>
|
---|
| 270 |
|
---|
[6a54383] | 271 | <sect2 role="commands">
|
---|
| 272 | <title>Command Explanations</title>
|
---|
| 273 |
|
---|
[f9865e2] | 274 | <!-- Not used anymore
|
---|
[a29d9e0] | 275 | <para>
|
---|
| 276 | <command>sed ... util/memfd.c</command>: This command fixes a conflict
|
---|
| 277 | introduced with glibc-2.27.
|
---|
| 278 | </para>
|
---|
[f9865e2] | 279 | -->
|
---|
[11b931a6] | 280 | <para>
|
---|
[f9865e2] | 281 | <parameter>--audio-drv-list=alsa</parameter>: This switch sets the audio
|
---|
| 282 | driver to ALSA. See below for enabling other audio drivers.
|
---|
[9b13441] | 283 | </para>
|
---|
[6a54383] | 284 |
|
---|
[f9865e2] | 285 | <para>
|
---|
| 286 | <option>--audio-drv-list=pa</option>: This switch sets the audio
|
---|
| 287 | driver to pulseaudio. For other drivers see the --audio-drv-list list in
|
---|
| 288 | <command>configure</command>'s help output. The default audio driver is
|
---|
| 289 | OSS. To enable support for both alsa and pulseaudio, use
|
---|
| 290 | <option>--audio-drv-list=alsa,pa</option>.
|
---|
| 291 | </para>
|
---|
| 292 |
|
---|
[c5d5897] | 293 | <!-- this appears to be rejected in 4.1.0
|
---|
| 294 | ERROR: unknown option \-\-with-gtkabi=3.0
|
---|
[b4c31a6] | 295 | <para>
|
---|
[c5d5897] | 296 | <option>\-\-with-gtkabi=3.0</option>: builds with GTK+-3 if both GTK+-2
|
---|
[b4c31a6] | 297 | and GTK+-3 are installed.
|
---|
[c5d5897] | 298 | </para> -->
|
---|
[b4c31a6] | 299 |
|
---|
[9b13441] | 300 | </sect2>
|
---|
[6a54383] | 301 |
|
---|
[b4c31a6] | 302 | <sect2 role="using">
|
---|
| 303 | <title>Using Qemu</title>
|
---|
| 304 |
|
---|
| 305 | <para>
|
---|
| 306 | Since using qemu means using a virtual computer, the steps to set up
|
---|
| 307 | the virtual machine are in close analogy with those to set up a real
|
---|
| 308 | computer. You'll need to decide about CPU, memory, disk, USB devices,
|
---|
| 309 | network card(s), screen size, etc. Once the <quote>hardware</quote> is
|
---|
| 310 | decided, you'll have for example to choose how to connect the machine
|
---|
| 311 | to internet, and/or to install an OS. In the following, we show basic
|
---|
| 312 | ways of performing those steps. But qemu is much more than this, and it
|
---|
| 313 | is strongly advised to read the qemu documentation in
|
---|
| 314 | <filename>/usr/share/doc/qemu-&qemu-version;/qemu-doc.html</filename>.
|
---|
| 315 | </para>
|
---|
[d28198d3] | 316 |
|
---|
[b4c31a6] | 317 | <note>
|
---|
| 318 | <para>
|
---|
| 319 | It is standard practice to name the computer running qemu
|
---|
| 320 | <quote>host</quote> and the emulated machine running under qemu the
|
---|
| 321 | <quote>guest</quote>. We'll use those notations in the following.
|
---|
| 322 | </para>
|
---|
| 323 | </note>
|
---|
[d28198d3] | 324 |
|
---|
[b4c31a6] | 325 | <note>
|
---|
| 326 | <para>
|
---|
| 327 | The following instructions assume the optional symbolic link,
|
---|
| 328 | <filename>qemu</filename>, has been created. Additionally,
|
---|
| 329 | <command>qemu</command> must be run from an X Window System based
|
---|
| 330 | terminal (either locally or over ssh).
|
---|
| 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>
|
---|
| 344 | The virtual disk size and filename should be ajusted as desired. The
|
---|
| 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 \
|
---|
| 390 | -soundhw ac97 \
|
---|
| 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>
|
---|
| 419 | <parameter>-cdrom grub-img.iso</parameter>: defines an iso formated file
|
---|
| 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 |
|
---|
[0639bb6] | 466 | <bridgehead renderas="sect3">Controlling the Emulated Display</bridgehead>
|
---|
[b4c31a6] | 467 | <para>
|
---|
| 468 | It may happen that the guest window displayed by qemu does not correspond
|
---|
| 469 | to the full capability of the emulated vga card. For example, the vmware
|
---|
| 470 | card is 1600x900 capable, but only 1024x768 is displayed by default.
|
---|
| 471 | A suitable Xorg configuration on the guest allows to use the full size
|
---|
| 472 | (Note that the Xorg video driver to use is <xref
|
---|
| 473 | linkend="xorg-vmware-driver"/>):
|
---|
| 474 | </para>
|
---|
[855c1f7] | 475 |
|
---|
| 476 | <screen role="root"><userinput>cat > /usr/share/X11/xorg.conf.d/20-vmware.conf << "EOF"
|
---|
[577d43d] | 477 | <literal>Section "Monitor"
|
---|
| 478 | Identifier "Monitor0"
|
---|
| 479 | # cvt 1600 900
|
---|
| 480 | # 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
|
---|
| 481 | Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
|
---|
| 482 | Option "PreferredMode" "1600x900"
|
---|
| 483 | HorizSync 1-200
|
---|
| 484 | VertRefresh 1-200
|
---|
[855c1f7] | 485 | EndSection
|
---|
| 486 |
|
---|
[577d43d] | 487 | Section "Device"
|
---|
[855c1f7] | 488 | Identifier "VMware SVGA II Adapter"
|
---|
| 489 | Option "Monitor" "default"
|
---|
| 490 | Driver "vmware"
|
---|
| 491 | EndSection
|
---|
| 492 |
|
---|
[577d43d] | 493 | Section "Screen"
|
---|
[855c1f7] | 494 | Identifier "Default Screen"
|
---|
| 495 | Device "VMware SVGA II Adapter"
|
---|
| 496 | Monitor "Monitor0"
|
---|
| 497 |
|
---|
| 498 | SubSection "Display"
|
---|
| 499 | Depth 24
|
---|
| 500 | Modes "1600x900" "1440x900" "1366x768" "1280x720" "800x480"
|
---|
| 501 | EndSubSection
|
---|
| 502 |
|
---|
| 503 | EndSection</literal>
|
---|
| 504 | EOF</userinput></screen>
|
---|
| 505 |
|
---|
[b4c31a6] | 506 | <para>
|
---|
| 507 | New sizes will be available besides the native ones. You need to
|
---|
| 508 | restart X in order to have the new sizes available.
|
---|
| 509 | </para>
|
---|
[d28198d3] | 510 |
|
---|
[b4c31a6] | 511 | <bridgehead renderas="sect3">Networking</bridgehead>
|
---|
| 512 | <para>
|
---|
| 513 | The above solution for networking allows the guest to access the local
|
---|
| 514 | network through the host (and possibly to access internet through the
|
---|
| 515 | local routers), but the converse is not true. Not even the host can
|
---|
| 516 | access the guest, unless port forwarding is enabled. And in the case
|
---|
| 517 | several guests are running, they cannot communicate with each other.
|
---|
| 518 | Other network devices can be used for this purpose. For example, there
|
---|
| 519 | is the <quote>socket</quote> device, which allows several guests to
|
---|
| 520 | share a common virtual network. In the following, we describe in more
|
---|
| 521 | details how to set up the <quote>bridge</quote> device, which allows
|
---|
| 522 | the guests to appear as if connected to the local network. All the
|
---|
| 523 | commands below should be run as the <systemitem
|
---|
| 524 | class="username">root</systemitem> user.
|
---|
| 525 | </para>
|
---|
[0d7900a] | 526 |
|
---|
[b4c31a6] | 527 | <para revision="sysv">
|
---|
| 528 | Set up bridging with <xref linkend="bridgeutils"/>. Only the physical
|
---|
| 529 | interface(s) should be set up at boot. The virtual interface(s) will be
|
---|
| 530 | added as needed when qemu is started.
|
---|
| 531 | </para>
|
---|
| 532 |
|
---|
[47274444] | 533 | <para revision="systemd">
|
---|
| 534 | <!-- On SYS-V, IP_FORWARD is enabled by the bridge script. -->
|
---|
[b4c31a6] | 535 | Allow the host to forward IP packets:
|
---|
| 536 | </para>
|
---|
[d28198d3] | 537 |
|
---|
[b4c31a6] | 538 | <screen role="root"
|
---|
| 539 | revision="systemd"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
|
---|
[d28198d3] | 540 |
|
---|
[b4c31a6] | 541 | <para revision="systemd">
|
---|
| 542 | To make this permanent, add the command to
|
---|
| 543 | <filename>/etc/sysctl.d/60-net-forward.conf:</filename>
|
---|
| 544 | </para>
|
---|
[6e5e4d2] | 545 |
|
---|
[b4c31a6] | 546 | <screen role="root"
|
---|
| 547 | revision="systemd"><userinput>cat >> /etc/sysctl.d/60-net-forward.conf << EOF
|
---|
[51dfb3e] | 548 | <literal>net.ipv4.ip_forward=1</literal>
|
---|
[6e5e4d2] | 549 | EOF</userinput></screen>
|
---|
| 550 |
|
---|
[b4c31a6] | 551 | <para>
|
---|
| 552 | Set up a required configuration file:
|
---|
| 553 | </para>
|
---|
[670f775] | 554 |
|
---|
[3a87232] | 555 | <!-- /etc/qemu has not been installed by "make install" since version 2.4 -->
|
---|
| 556 | <screen role="root"><userinput>install -vdm 755 /etc/qemu &&
|
---|
| 557 | echo allow br0 > /etc/qemu/bridge.conf</userinput></screen>
|
---|
[670f775] | 558 |
|
---|
[b4c31a6] | 559 | <para>
|
---|
| 560 | In the command above, replace the switch <parameter>-netdev user,...
|
---|
| 561 | </parameter> with <parameter>-netdev bridge,id=net0</parameter>.
|
---|
| 562 | </para>
|
---|
[d28198d3] | 563 |
|
---|
| 564 | </sect2>
|
---|
| 565 |
|
---|
| 566 | <sect2 role="content">
|
---|
| 567 | <title>Contents</title>
|
---|
| 568 |
|
---|
| 569 | <segmentedlist>
|
---|
[9b13441] | 570 | <segtitle>Installed Programs</segtitle>
|
---|
| 571 | <segtitle>Installed Library</segtitle>
|
---|
[d28198d3] | 572 | <segtitle>Installed Directories</segtitle>
|
---|
| 573 |
|
---|
| 574 | <seglistitem>
|
---|
[9b13441] | 575 | <seg>
|
---|
[10f9bb45] | 576 | ivshmem-client,
|
---|
| 577 | ivshmem-server,
|
---|
| 578 | qemu (symlink),
|
---|
[9b13441] | 579 | qemu-ga,
|
---|
| 580 | qemu-img,
|
---|
| 581 | qemu-io,
|
---|
| 582 | qemu-nbd,
|
---|
[b4c31a6] | 583 | qemu-system-<arch>, and
|
---|
| 584 | virtfs-proxy-helper
|
---|
[9b13441] | 585 | </seg>
|
---|
[b4c31a6] | 586 | <seg>None</seg>
|
---|
[9b13441] | 587 | <seg>
|
---|
[b4c31a6] | 588 | /usr/share/qemu and
|
---|
[9b13441] | 589 | /usr/share/doc/qemu-&qemu-version;
|
---|
| 590 | </seg>
|
---|
[d28198d3] | 591 | </seglistitem>
|
---|
| 592 | </segmentedlist>
|
---|
| 593 |
|
---|
| 594 | <variablelist>
|
---|
| 595 | <bridgehead renderas="sect3">Short Description</bridgehead>
|
---|
| 596 | <?dbfo list-presentation="list"?>
|
---|
| 597 | <?dbhtml list-presentation="table"?>
|
---|
| 598 |
|
---|
[b4c31a6] | 599 | <varlistentry id="ivshmem-client">
|
---|
| 600 | <term><command>ivshmem-client</command></term>
|
---|
| 601 | <listitem>
|
---|
[47274444] | 602 | <para>
|
---|
| 603 | is a standalone client for using the ivshmem device.
|
---|
| 604 | </para>
|
---|
[b4c31a6] | 605 | <indexterm zone="qemu ivshmem-client">
|
---|
| 606 | <primary sortas="b-ivshmem-client">ivshmem-client</primary>
|
---|
| 607 | </indexterm>
|
---|
| 608 | </listitem>
|
---|
| 609 | </varlistentry>
|
---|
| 610 |
|
---|
| 611 | <varlistentry id="ivshmem-server">
|
---|
| 612 | <term><command>ivshmem-server</command></term>
|
---|
| 613 | <listitem>
|
---|
[47274444] | 614 | <para>
|
---|
| 615 | is an example server for the ivshmem device.
|
---|
| 616 | </para>
|
---|
[b4c31a6] | 617 | <indexterm zone="qemu ivshmem-server">
|
---|
| 618 | <primary sortas="b-ivshmem-server">ivshmem-server</primary>
|
---|
| 619 | </indexterm>
|
---|
| 620 | </listitem>
|
---|
| 621 | </varlistentry>
|
---|
| 622 |
|
---|
[f9865e2] | 623 | <varlistentry id="qemu-edid">
|
---|
| 624 | <term><command>qemu-edid</command></term>
|
---|
| 625 | <listitem>
|
---|
[47274444] | 626 | <para>
|
---|
| 627 | is a test tool for the qemu EDID generator.
|
---|
| 628 | </para>
|
---|
[f9865e2] | 629 | <indexterm zone="qemu qemu-edid">
|
---|
| 630 | <primary sortas="b-qemu-edid">qemu-edid</primary>
|
---|
| 631 | </indexterm>
|
---|
| 632 | </listitem>
|
---|
| 633 | </varlistentry>
|
---|
| 634 |
|
---|
[d28198d3] | 635 | <varlistentry id="qemu-ga">
|
---|
| 636 | <term><command>qemu-ga</command></term>
|
---|
| 637 | <listitem>
|
---|
[47274444] | 638 | <para>
|
---|
| 639 | implements support for QMP (QEMU Monitor Protocol) commands and
|
---|
| 640 | events that terminate and originate respectively within the guest
|
---|
| 641 | using an agent built as part of QEMU.
|
---|
| 642 | </para>
|
---|
[2f6053d] | 643 | <indexterm zone="qemu qemu-ga">
|
---|
[d28198d3] | 644 | <primary sortas="b-qemu-ga">qemu-ga</primary>
|
---|
| 645 | </indexterm>
|
---|
| 646 | </listitem>
|
---|
| 647 | </varlistentry>
|
---|
| 648 |
|
---|
| 649 | <varlistentry id="qemu-img">
|
---|
| 650 | <term><command>qemu-img</command></term>
|
---|
| 651 | <listitem>
|
---|
[47274444] | 652 | <para>
|
---|
| 653 | provides commands to manage QEMU disk images.
|
---|
| 654 | </para>
|
---|
[2f6053d] | 655 | <indexterm zone="qemu qemu-img">
|
---|
[d28198d3] | 656 | <primary sortas="b-qemu-img">qemu-img</primary>
|
---|
| 657 | </indexterm>
|
---|
| 658 | </listitem>
|
---|
| 659 | </varlistentry>
|
---|
| 660 |
|
---|
| 661 | <varlistentry id="qemu-io">
|
---|
| 662 | <term><command>qemu-io</command></term>
|
---|
| 663 | <listitem>
|
---|
[47274444] | 664 | <para>
|
---|
| 665 | is a diagnostic and manipulation program for (virtual) memory
|
---|
| 666 | media. It is still at an early stage of development.
|
---|
| 667 | </para>
|
---|
[2f6053d] | 668 | <indexterm zone="qemu qemu-io">
|
---|
[d28198d3] | 669 | <primary sortas="b-qemu-io">qemu-io</primary>
|
---|
| 670 | </indexterm>
|
---|
| 671 | </listitem>
|
---|
| 672 | </varlistentry>
|
---|
| 673 |
|
---|
| 674 | <varlistentry id="qemu-nbd">
|
---|
| 675 | <term><command>qemu-nbd</command></term>
|
---|
| 676 | <listitem>
|
---|
[47274444] | 677 | <para>
|
---|
| 678 | exports Qemu disk images using the QEMU Disk Network Block
|
---|
| 679 | Device (NBD) protocol.
|
---|
| 680 | </para>
|
---|
[2f6053d] | 681 | <indexterm zone="qemu qemu-nbd">
|
---|
[d28198d3] | 682 | <primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
---|
| 683 | </indexterm>
|
---|
| 684 | </listitem>
|
---|
| 685 | </varlistentry>
|
---|
| 686 |
|
---|
| 687 | <varlistentry id="qemu-system">
|
---|
| 688 | <term><command>qemu-system-x86_64</command></term>
|
---|
| 689 | <listitem>
|
---|
[47274444] | 690 | <para>
|
---|
| 691 | is the QEMU PC System emulator.
|
---|
| 692 | </para>
|
---|
[2f6053d] | 693 | <indexterm zone="qemu qemu-system">
|
---|
[d28198d3] | 694 | <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
---|
| 695 | </indexterm>
|
---|
| 696 | </listitem>
|
---|
| 697 | </varlistentry>
|
---|
[8ade43b] | 698 |
|
---|
[72d90b67] | 699 | <varlistentry id="virtfs-proxy-helper">
|
---|
| 700 | <term><command>virtfs-proxy-helper</command></term>
|
---|
| 701 | <listitem>
|
---|
[47274444] | 702 | <para>
|
---|
| 703 | creates a socket pair or a named socket. QEMU and proxy helper
|
---|
| 704 | communicate using this socket. QEMU proxy fs driver sends
|
---|
| 705 | filesystem request to proxy helper and receives the response
|
---|
| 706 | from it.
|
---|
| 707 | </para>
|
---|
[72d90b67] | 708 | <indexterm zone="qemu virtfs-proxy-helper">
|
---|
| 709 | <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
|
---|
| 710 | </indexterm>
|
---|
| 711 | </listitem>
|
---|
| 712 | </varlistentry>
|
---|
[8ade43b] | 713 |
|
---|
[d28198d3] | 714 | </variablelist>
|
---|
| 715 |
|
---|
| 716 | </sect2>
|
---|
| 717 |
|
---|
| 718 | </sect1>
|
---|