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