[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 |
|
---|
[c6b192c] | 7 | <!ENTITY qemu-download-http "https://download.qemu-project.org/qemu-&qemu-version;.tar.xz">
|
---|
[2f6053d] | 8 | <!ENTITY qemu-download-ftp " ">
|
---|
[59b836c8] | 9 | <!ENTITY qemu-md5sum "a077669ce58b6ee07ec355e54aad25be">
|
---|
| 10 | <!ENTITY qemu-size "110 MB">
|
---|
[a541e080] | 11 | <!ENTITY qemu-buildsize "1.9 GB">
|
---|
[59b836c8] | 12 | <!ENTITY qemu-time "1.4 SBU (using parallelism=4; add 0.5 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 | <date>$Date$</date>
|
---|
[d28198d3] | 20 | </sect1info>
|
---|
| 21 |
|
---|
[2f6053d] | 22 | <title>qemu-&qemu-version;</title>
|
---|
[d28198d3] | 23 |
|
---|
[2f6053d] | 24 | <indexterm zone="qemu">
|
---|
| 25 | <primary sortas="a-qemu">qemu</primary>
|
---|
[d28198d3] | 26 | </indexterm>
|
---|
| 27 |
|
---|
| 28 | <sect2 role="package">
|
---|
[2f6053d] | 29 | <title>Introduction to qemu</title>
|
---|
[d28198d3] | 30 |
|
---|
[47274444] | 31 | <para>
|
---|
| 32 | <application>qemu</application> is a full virtualization solution for
|
---|
| 33 | Linux on x86 hardware containing virtualization extensions (Intel VT or
|
---|
| 34 | AMD-V).
|
---|
| 35 | </para>
|
---|
[d28198d3] | 36 |
|
---|
[da54a62] | 37 | &lfs110a_checked;
|
---|
[27643d0f] | 38 |
|
---|
[d28198d3] | 39 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 40 | <itemizedlist spacing="compact">
|
---|
| 41 | <listitem>
|
---|
[47274444] | 42 | <para>
|
---|
| 43 | Download (HTTP): <ulink url="&qemu-download-http;"/>
|
---|
| 44 | </para>
|
---|
[d28198d3] | 45 | </listitem>
|
---|
| 46 | <listitem>
|
---|
[47274444] | 47 | <para>
|
---|
| 48 | Download (FTP): <ulink url="&qemu-download-ftp;"/>
|
---|
| 49 | </para>
|
---|
[d28198d3] | 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
[47274444] | 52 | <para>
|
---|
| 53 | Download MD5 sum: &qemu-md5sum;
|
---|
| 54 | </para>
|
---|
[d28198d3] | 55 | </listitem>
|
---|
| 56 | <listitem>
|
---|
[47274444] | 57 | <para>
|
---|
| 58 | Download size: &qemu-size;
|
---|
| 59 | </para>
|
---|
[d28198d3] | 60 | </listitem>
|
---|
| 61 | <listitem>
|
---|
[47274444] | 62 | <para>
|
---|
| 63 | Estimated disk space required: &qemu-buildsize;
|
---|
| 64 | </para>
|
---|
[d28198d3] | 65 | </listitem>
|
---|
| 66 | <listitem>
|
---|
[47274444] | 67 | <para>
|
---|
| 68 | Estimated build time: &qemu-time;
|
---|
| 69 | </para>
|
---|
[d28198d3] | 70 | </listitem>
|
---|
| 71 | </itemizedlist>
|
---|
[54f740f] | 72 |
|
---|
[2f6053d] | 73 | <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
|
---|
[d28198d3] | 74 |
|
---|
| 75 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 76 | <para role="required">
|
---|
[f9865e2] | 77 | <xref linkend="glib2"/>, and
|
---|
[d28198d3] | 78 | <xref linkend="x-window-system"/>
|
---|
| 79 | </para>
|
---|
| 80 |
|
---|
[c41b38f] | 81 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 82 | <para role="recommended">
|
---|
[80a314c] | 83 | <xref linkend="alsa-lib"/> and
|
---|
[b4c31a6] | 84 | <xref linkend="sdl2"/>
|
---|
[c41b38f] | 85 | </para>
|
---|
| 86 |
|
---|
[d28198d3] | 87 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 88 | <para role="optional">
|
---|
[80a314c] | 89 | Depending on the sound system, various packages in <xref linkend="alsa"/>,
|
---|
[2d7c53d] | 90 | <xref linkend="python3"/>,
|
---|
[11b931a6] | 91 | <xref linkend="pulseaudio"/>,
|
---|
[8ade43b] | 92 | <xref linkend="bluez"/>,
|
---|
[d28198d3] | 93 | <xref linkend="curl"/>,
|
---|
[8ade43b] | 94 | <xref linkend="cyrus-sasl"/>,
|
---|
[10f9bb45] | 95 | <xref linkend="gnutls"/>,
|
---|
[8ade43b] | 96 | <xref linkend="gtk2"/>,
|
---|
| 97 | <xref linkend="gtk3"/>,
|
---|
| 98 | <xref linkend="libusb"/>,
|
---|
[10f9bb45] | 99 | <xref linkend="libgcrypt"/>,
|
---|
[fee79e2] | 100 | <xref linkend="libssh2"/>,
|
---|
[8ade43b] | 101 | <xref linkend="lzo"/>,
|
---|
[10f9bb45] | 102 | <xref linkend="nettle"/>,
|
---|
| 103 | <xref linkend="mesa"/>,
|
---|
| 104 | <xref linkend="sdl"/>,
|
---|
[cac7f93] | 105 | <xref role="nodep" linkend="vte"/> or <xref linkend="vte2"/>, and
|
---|
[b4c31a6] | 106 | <!-- libcacard has been a standalone project since qemu-2.5.-->
|
---|
[fefc5d54] | 107 | <ulink url="https://gitlab.freedesktop.org/spice/libcacard">libcacard</ulink>
|
---|
[d28198d3] | 108 | </para>
|
---|
| 109 |
|
---|
[a541e080] | 110 | <bridgehead renderas="sect4">Optional dependencies for installing the documentation</bridgehead>
|
---|
| 111 | <para role="optional">
|
---|
| 112 | <ulink url="https://www.sphinx-doc.org/en/master/index.html">sphinx</ulink> with the
|
---|
| 113 | <ulink url="https://pypi.org/project/sphinx-rtd-theme/">sphinx-rtd-theme</ulink> theme
|
---|
| 114 | </para>
|
---|
| 115 |
|
---|
[9b13441] | 116 | <note>
|
---|
| 117 | <para>
|
---|
| 118 | This optional dependencies list is not comprehensive. See the output of
|
---|
| 119 | <command>./configure --help</command> for a more complete list.
|
---|
| 120 | </para>
|
---|
| 121 | </note>
|
---|
| 122 |
|
---|
[d28198d3] | 123 | <para condition="html" role="usernotes">User Notes:
|
---|
[2f6053d] | 124 | <ulink url="&blfs-wiki;/qemu"/></para>
|
---|
[d28198d3] | 125 |
|
---|
| 126 | </sect2>
|
---|
| 127 |
|
---|
[2f6053d] | 128 | <sect2 id='qemu-prereq'>
|
---|
[1eb4fcf] | 129 | <title>KVM Prerequisites</title>
|
---|
[d28198d3] | 130 |
|
---|
[47274444] | 131 | <para>
|
---|
| 132 | Before building <application>qemu</application>, check to see if
|
---|
| 133 | your processor supports Virtualization Technology (VT):
|
---|
| 134 | </para>
|
---|
[d28198d3] | 135 |
|
---|
| 136 | <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
---|
| 137 |
|
---|
[47274444] | 138 | <para>
|
---|
| 139 | If you get any output, you have VT technology (vmx for Intel
|
---|
| 140 | processors and svm for AMD processors). You then need to go into your
|
---|
| 141 | system BIOS and ensure it is enabled. After enabing, reboot back to your
|
---|
| 142 | LFS instance.
|
---|
| 143 | </para>
|
---|
[d28198d3] | 144 |
|
---|
| 145 | </sect2>
|
---|
| 146 |
|
---|
[2f6053d] | 147 | <sect2 role="kernel" id='qemu-kernel'>
|
---|
[d28198d3] | 148 | <title>Kernel Configuration</title>
|
---|
| 149 |
|
---|
[47274444] | 150 | <para>
|
---|
| 151 | Enable the following options in the kernel configuration and
|
---|
| 152 | recompile the kernel if necessary:
|
---|
| 153 | </para>
|
---|
[d28198d3] | 154 |
|
---|
[f39cf0d0] | 155 | <screen><literal>[*] Virtualization: ---> [CONFIG_VIRTUALIZATION]
|
---|
[421128a1] | 156 | <*/M> Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
|
---|
[f39cf0d0] | 157 | <*/M> KVM for Intel (and compatible) processors support [CONFIG_KVM_INTEL]
|
---|
| 158 | <*/M> KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
|
---|
[d28198d3] | 159 |
|
---|
[2f6053d] | 160 | <indexterm zone="qemu qemu-kernel">
|
---|
| 161 | <primary sortas="d-qemu">qemu</primary>
|
---|
[d28198d3] | 162 | </indexterm>
|
---|
| 163 |
|
---|
[47274444] | 164 | <para>
|
---|
| 165 | The Intel or AMD settings are not both required, but the one matching
|
---|
| 166 | your system processor is required.
|
---|
| 167 | </para>
|
---|
[d28198d3] | 168 |
|
---|
[b4c31a6] | 169 | <para>
|
---|
| 170 | To use the <quote>bridge</quote> network device, as explained below,
|
---|
| 171 | check that <xref linkend='bridgeutils'/> is installed
|
---|
| 172 | and the following options in the kernel configuration are enabled:
|
---|
| 173 | </para>
|
---|
[9b13441] | 174 |
|
---|
[421128a1] | 175 | <screen><literal>[*] Networking support ---> [CONFIG_NET]
|
---|
[9b13441] | 176 | Networking options --->
|
---|
[421128a1] | 177 | <*/M> 802.1d Ethernet Bridging [CONFIG_BRIDGE]
|
---|
[9b13441] | 178 | Device Drivers --->
|
---|
[421128a1] | 179 | [*] Network device support ---> [CONFIG_NETDEVICES]
|
---|
| 180 | <*/M> Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
|
---|
[d28198d3] | 181 |
|
---|
| 182 | </sect2>
|
---|
| 183 |
|
---|
| 184 | <sect2 role="installation">
|
---|
[2f6053d] | 185 | <title>Installation of qemu</title>
|
---|
[0d7900a] | 186 |
|
---|
[9f309be] | 187 | <para revision="sysv">
|
---|
[b4c31a6] | 188 | You will need a dedicated group that will contain users (other than root)
|
---|
| 189 | allowed to access the KVM device. Create this group by running the
|
---|
| 190 | following command as the
|
---|
| 191 | <systemitem class="username">root</systemitem> user:
|
---|
| 192 | </para>
|
---|
| 193 |
|
---|
[9f309be] | 194 | <screen role="root" revision="sysv"><userinput>groupadd -g 61 kvm</userinput></screen>
|
---|
[b4c31a6] | 195 |
|
---|
| 196 | <para>
|
---|
| 197 | Add any users that might use the KVM device to that group:
|
---|
| 198 | </para>
|
---|
| 199 |
|
---|
| 200 | <screen role="root"><userinput>usermod -a -G kvm <replaceable><username></replaceable></userinput></screen>
|
---|
| 201 |
|
---|
[47274444] | 202 | <para>
|
---|
| 203 | Install <application>qemu</application> by running the following
|
---|
| 204 | commands:
|
---|
| 205 | </para>
|
---|
[d28198d3] | 206 |
|
---|
[47274444] | 207 | <note>
|
---|
| 208 | <para>
|
---|
| 209 | Qemu is capable of running many targets. The build process
|
---|
| 210 | is also capable of building multiple targets at one time in a
|
---|
| 211 | comma delimited list assigned to <option>--target-list</option>. Run
|
---|
| 212 | <command>./configure --help</command> to get a complete list of
|
---|
| 213 | available targets.
|
---|
| 214 | </para>
|
---|
| 215 | </note>
|
---|
[aa9028e] | 216 |
|
---|
| 217 |
|
---|
| 218 | <screen><userinput>if [ $(uname -m) = i686 ]; then
|
---|
| 219 | QEMU_ARCH=i386-softmmu
|
---|
| 220 | else
|
---|
| 221 | QEMU_ARCH=x86_64-softmmu
|
---|
| 222 | fi
|
---|
| 223 |
|
---|
[a29d9e0] | 224 |
|
---|
[10f9bb45] | 225 | mkdir -vp build &&
|
---|
| 226 | cd build &&
|
---|
| 227 |
|
---|
[252e5bf] | 228 | ../configure --prefix=/usr \
|
---|
| 229 | --sysconfdir=/etc \
|
---|
[b0a073b] | 230 | --localstatedir=/var \
|
---|
[252e5bf] | 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>
|
---|
[9d6565bf] | 352 | The virtual disk size and filename should be adjusted as desired. The
|
---|
[b4c31a6] | 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>
|
---|
[9d6565bf] | 521 | The below solution for networking allows the guest to access the local
|
---|
[b4c31a6] | 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>
|
---|
[a541e080] | 584 | elf2dmp,
|
---|
[10f9bb45] | 585 | qemu (symlink),
|
---|
[a541e080] | 586 | qemu-edid,
|
---|
[9b13441] | 587 | qemu-ga,
|
---|
| 588 | qemu-img,
|
---|
| 589 | qemu-io,
|
---|
[a541e080] | 590 | qemu-keymap,
|
---|
[9b13441] | 591 | qemu-nbd,
|
---|
[a541e080] | 592 | qemu-pr-helper,
|
---|
| 593 | qemu-storage-daemon, and
|
---|
| 594 | qemu-system-<arch>
|
---|
[9b13441] | 595 | </seg>
|
---|
[b4c31a6] | 596 | <seg>None</seg>
|
---|
[9b13441] | 597 | <seg>
|
---|
[b4c31a6] | 598 | /usr/share/qemu and
|
---|
[a541e080] | 599 | /usr/share/doc/qemu-&qemu-version; (optional)
|
---|
[9b13441] | 600 | </seg>
|
---|
[d28198d3] | 601 | </seglistitem>
|
---|
| 602 | </segmentedlist>
|
---|
| 603 |
|
---|
| 604 | <variablelist>
|
---|
| 605 | <bridgehead renderas="sect3">Short Description</bridgehead>
|
---|
| 606 | <?dbfo list-presentation="list"?>
|
---|
| 607 | <?dbhtml list-presentation="table"?>
|
---|
| 608 |
|
---|
[a541e080] | 609 | <varlistentry id="elf2dmp">
|
---|
| 610 | <term><command>elf2dmp</command></term>
|
---|
| 611 | <listitem>
|
---|
| 612 | <para>
|
---|
| 613 | Converts files from elf to dmp format
|
---|
| 614 | </para>
|
---|
| 615 | <indexterm zone="qemu elf2dmp">
|
---|
| 616 | <primary sortas="b-elf2dmp">elf2dmp</primary>
|
---|
| 617 | </indexterm>
|
---|
| 618 | </listitem>
|
---|
| 619 | </varlistentry>
|
---|
| 620 | <!--
|
---|
[b4c31a6] | 621 | <varlistentry id="ivshmem-client">
|
---|
| 622 | <term><command>ivshmem-client</command></term>
|
---|
| 623 | <listitem>
|
---|
[47274444] | 624 | <para>
|
---|
[4c24eb0a] | 625 | is a standalone client for using the ivshmem device
|
---|
[47274444] | 626 | </para>
|
---|
[b4c31a6] | 627 | <indexterm zone="qemu ivshmem-client">
|
---|
| 628 | <primary sortas="b-ivshmem-client">ivshmem-client</primary>
|
---|
| 629 | </indexterm>
|
---|
| 630 | </listitem>
|
---|
| 631 | </varlistentry>
|
---|
| 632 |
|
---|
| 633 | <varlistentry id="ivshmem-server">
|
---|
| 634 | <term><command>ivshmem-server</command></term>
|
---|
| 635 | <listitem>
|
---|
[47274444] | 636 | <para>
|
---|
[4c24eb0a] | 637 | is an example server for the ivshmem device
|
---|
[47274444] | 638 | </para>
|
---|
[b4c31a6] | 639 | <indexterm zone="qemu ivshmem-server">
|
---|
| 640 | <primary sortas="b-ivshmem-server">ivshmem-server</primary>
|
---|
| 641 | </indexterm>
|
---|
| 642 | </listitem>
|
---|
| 643 | </varlistentry>
|
---|
[a541e080] | 644 | -->
|
---|
[f9865e2] | 645 | <varlistentry id="qemu-edid">
|
---|
| 646 | <term><command>qemu-edid</command></term>
|
---|
| 647 | <listitem>
|
---|
[47274444] | 648 | <para>
|
---|
[4c24eb0a] | 649 | is a test tool for the qemu EDID generator
|
---|
[47274444] | 650 | </para>
|
---|
[f9865e2] | 651 | <indexterm zone="qemu qemu-edid">
|
---|
| 652 | <primary sortas="b-qemu-edid">qemu-edid</primary>
|
---|
| 653 | </indexterm>
|
---|
| 654 | </listitem>
|
---|
| 655 | </varlistentry>
|
---|
| 656 |
|
---|
[d28198d3] | 657 | <varlistentry id="qemu-ga">
|
---|
| 658 | <term><command>qemu-ga</command></term>
|
---|
| 659 | <listitem>
|
---|
[47274444] | 660 | <para>
|
---|
| 661 | implements support for QMP (QEMU Monitor Protocol) commands and
|
---|
| 662 | events that terminate and originate respectively within the guest
|
---|
[4c24eb0a] | 663 | using an agent built as part of QEMU
|
---|
[47274444] | 664 | </para>
|
---|
[2f6053d] | 665 | <indexterm zone="qemu qemu-ga">
|
---|
[d28198d3] | 666 | <primary sortas="b-qemu-ga">qemu-ga</primary>
|
---|
| 667 | </indexterm>
|
---|
| 668 | </listitem>
|
---|
| 669 | </varlistentry>
|
---|
| 670 |
|
---|
| 671 | <varlistentry id="qemu-img">
|
---|
| 672 | <term><command>qemu-img</command></term>
|
---|
| 673 | <listitem>
|
---|
[47274444] | 674 | <para>
|
---|
[4c24eb0a] | 675 | provides commands to manage QEMU disk images
|
---|
[47274444] | 676 | </para>
|
---|
[2f6053d] | 677 | <indexterm zone="qemu qemu-img">
|
---|
[d28198d3] | 678 | <primary sortas="b-qemu-img">qemu-img</primary>
|
---|
| 679 | </indexterm>
|
---|
| 680 | </listitem>
|
---|
| 681 | </varlistentry>
|
---|
| 682 |
|
---|
| 683 | <varlistentry id="qemu-io">
|
---|
| 684 | <term><command>qemu-io</command></term>
|
---|
| 685 | <listitem>
|
---|
[47274444] | 686 | <para>
|
---|
| 687 | is a diagnostic and manipulation program for (virtual) memory
|
---|
[9d6565bf] | 688 | media. It is still at an early stage of development
|
---|
[47274444] | 689 | </para>
|
---|
[2f6053d] | 690 | <indexterm zone="qemu qemu-io">
|
---|
[d28198d3] | 691 | <primary sortas="b-qemu-io">qemu-io</primary>
|
---|
| 692 | </indexterm>
|
---|
| 693 | </listitem>
|
---|
| 694 | </varlistentry>
|
---|
| 695 |
|
---|
[a541e080] | 696 | <varlistentry id="qemu-keymap">
|
---|
| 697 | <term><command>qemu-keymap</command></term>
|
---|
| 698 | <listitem>
|
---|
| 699 | <para>
|
---|
| 700 | generates qemu reverse keymaps from xkb keymaps,
|
---|
| 701 | which can be used with the qemu "-k" command line switch
|
---|
| 702 | </para>
|
---|
| 703 | <indexterm zone="qemu qemu-keymap">
|
---|
| 704 | <primary sortas="b-qemu-keymap">qemu-keymap</primary>
|
---|
| 705 | </indexterm>
|
---|
| 706 | </listitem>
|
---|
| 707 | </varlistentry>
|
---|
| 708 |
|
---|
| 709 |
|
---|
[d28198d3] | 710 | <varlistentry id="qemu-nbd">
|
---|
| 711 | <term><command>qemu-nbd</command></term>
|
---|
| 712 | <listitem>
|
---|
[47274444] | 713 | <para>
|
---|
| 714 | exports Qemu disk images using the QEMU Disk Network Block
|
---|
[4c24eb0a] | 715 | Device (NBD) protocol
|
---|
[47274444] | 716 | </para>
|
---|
[2f6053d] | 717 | <indexterm zone="qemu qemu-nbd">
|
---|
[d28198d3] | 718 | <primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
---|
| 719 | </indexterm>
|
---|
| 720 | </listitem>
|
---|
| 721 | </varlistentry>
|
---|
| 722 |
|
---|
[a541e080] | 723 | <varlistentry id="qemu-pr-helper">
|
---|
| 724 | <term><command>qemu-pr-helper</command></term>
|
---|
| 725 | <listitem>
|
---|
| 726 | <para>
|
---|
| 727 | Implements the persistent reservation helper for QEMU
|
---|
| 728 | </para>
|
---|
| 729 | <indexterm zone="qemu qemu-pr-helper">
|
---|
| 730 | <primary sortas="b-qemu-pr-helper">qemu-pr-helper</primary>
|
---|
| 731 | </indexterm>
|
---|
| 732 | </listitem>
|
---|
| 733 | </varlistentry>
|
---|
| 734 |
|
---|
| 735 | <varlistentry id="qemu-storage-daemon">
|
---|
| 736 | <term><command>qemu-storage-daemon</command></term>
|
---|
| 737 | <listitem>
|
---|
| 738 | <para>
|
---|
| 739 | allows to modify disk images using the QEMU Monitor Protocol (QMP)
|
---|
| 740 | without running a VM
|
---|
| 741 | </para>
|
---|
| 742 | <indexterm zone="qemu qemu-storage-daemon">
|
---|
| 743 | <primary sortas="b-qemu-storage-daemon">qemu-storage-daemon</primary>
|
---|
| 744 | </indexterm>
|
---|
| 745 | </listitem>
|
---|
| 746 | </varlistentry>
|
---|
| 747 |
|
---|
[d28198d3] | 748 | <varlistentry id="qemu-system">
|
---|
| 749 | <term><command>qemu-system-x86_64</command></term>
|
---|
| 750 | <listitem>
|
---|
[47274444] | 751 | <para>
|
---|
[4c24eb0a] | 752 | is the QEMU PC System emulator
|
---|
[47274444] | 753 | </para>
|
---|
[2f6053d] | 754 | <indexterm zone="qemu qemu-system">
|
---|
[d28198d3] | 755 | <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
---|
| 756 | </indexterm>
|
---|
| 757 | </listitem>
|
---|
| 758 | </varlistentry>
|
---|
[a541e080] | 759 | <!--
|
---|
[72d90b67] | 760 | <varlistentry id="virtfs-proxy-helper">
|
---|
| 761 | <term><command>virtfs-proxy-helper</command></term>
|
---|
| 762 | <listitem>
|
---|
[47274444] | 763 | <para>
|
---|
[9d6565bf] | 764 | creates a socket pair or a named socket. QEMU and the proxy helper
|
---|
| 765 | communicate using this socket. The QEMU proxy fs driver sends
|
---|
| 766 | filesystem requests to the proxy helper and receives the response
|
---|
[4c24eb0a] | 767 | from it
|
---|
[47274444] | 768 | </para>
|
---|
[72d90b67] | 769 | <indexterm zone="qemu virtfs-proxy-helper">
|
---|
| 770 | <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
|
---|
| 771 | </indexterm>
|
---|
| 772 | </listitem>
|
---|
| 773 | </varlistentry>
|
---|
[a541e080] | 774 | -->
|
---|
[d28198d3] | 775 | </variablelist>
|
---|
| 776 |
|
---|
| 777 | </sect2>
|
---|
| 778 |
|
---|
| 779 | </sect1>
|
---|