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