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