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