Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ******************************* |
| 4 | Using the Quick EMUlator (QEMU) |
| 5 | ******************************* |
| 6 | |
| 7 | The Yocto Project uses an implementation of the Quick EMUlator (QEMU) |
| 8 | Open Source project as part of the Yocto Project development "tool set". |
| 9 | This chapter provides both procedures that show you how to use the Quick |
| 10 | EMUlator (QEMU) and other QEMU information helpful for development |
| 11 | purposes. |
| 12 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 13 | Overview |
| 14 | ======== |
| 15 | |
| 16 | Within the context of the Yocto Project, QEMU is an emulator and |
| 17 | virtualization machine that allows you to run a complete image you have |
| 18 | built using the Yocto Project as just another task on your build system. |
| 19 | QEMU is useful for running and testing images and applications on |
| 20 | supported Yocto Project architectures without having actual hardware. |
| 21 | Among other things, the Yocto Project uses QEMU to run automated Quality |
| 22 | Assurance (QA) tests on final images shipped with each release. |
| 23 | |
| 24 | .. note:: |
| 25 | |
| 26 | This implementation is not the same as QEMU in general. |
| 27 | |
| 28 | This section provides a brief reference for the Yocto Project |
| 29 | implementation of QEMU. |
| 30 | |
| 31 | For official information and documentation on QEMU in general, see the |
| 32 | following references: |
| 33 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 34 | - `QEMU Website <https://wiki.qemu.org/Main_Page>`__\ *:* The official |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 35 | website for the QEMU Open Source project. |
| 36 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 37 | - `Documentation <https://wiki.qemu.org/Manual>`__\ *:* The QEMU user |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 38 | manual. |
| 39 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 40 | Running QEMU |
| 41 | ============ |
| 42 | |
| 43 | To use QEMU, you need to have QEMU installed and initialized as well as |
| 44 | have the proper artifacts (i.e. image files and root filesystems) |
| 45 | available. Follow these general steps to run QEMU: |
| 46 | |
| 47 | 1. *Install QEMU:* QEMU is made available with the Yocto Project a |
| 48 | number of ways. One method is to install a Software Development Kit |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 49 | (SDK). See ":ref:`sdk-manual/intro:the qemu emulator`" section in the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 50 | Yocto Project Application Development and the Extensible Software |
| 51 | Development Kit (eSDK) manual for information on how to install QEMU. |
| 52 | |
| 53 | 2. *Setting Up the Environment:* How you set up the QEMU environment |
| 54 | depends on how you installed QEMU: |
| 55 | |
| 56 | - If you cloned the ``poky`` repository or you downloaded and |
| 57 | unpacked a Yocto Project release tarball, you can source the build |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 58 | environment script (i.e. :ref:`structure-core-script`):: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 59 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 60 | $ cd poky |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 61 | $ source oe-init-build-env |
| 62 | |
| 63 | - If you installed a cross-toolchain, you can run the script that |
| 64 | initializes the toolchain. For example, the following commands run |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 65 | the initialization script from the default ``poky_sdk`` directory:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 66 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 67 | . poky_sdk/environment-setup-core2-64-poky-linux |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 68 | |
| 69 | 3. *Ensure the Artifacts are in Place:* You need to be sure you have a |
| 70 | pre-built kernel that will boot in QEMU. You also need the target |
| 71 | root filesystem for your target machine's architecture: |
| 72 | |
| 73 | - If you have previously built an image for QEMU (e.g. ``qemux86``, |
| 74 | ``qemuarm``, and so forth), then the artifacts are in place in |
| 75 | your :term:`Build Directory`. |
| 76 | |
| 77 | - If you have not built an image, you can go to the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 78 | :yocto_dl:`machines/qemu </releases/yocto/yocto-&DISTRO;/machines/qemu/>` area and download a |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 79 | pre-built image that matches your architecture and can be run on |
| 80 | QEMU. |
| 81 | |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 82 | See the ":ref:`sdk-manual/appendix-obtain:extracting the root filesystem`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 83 | section in the Yocto Project Application Development and the |
| 84 | Extensible Software Development Kit (eSDK) manual for information on |
| 85 | how to extract a root filesystem. |
| 86 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 87 | 4. *Run QEMU:* The basic ``runqemu`` command syntax is as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 88 | |
| 89 | $ runqemu [option ] [...] |
| 90 | |
| 91 | Based on what you provide on the command |
| 92 | line, ``runqemu`` does a good job of figuring out what you are trying |
| 93 | to do. For example, by default, QEMU looks for the most recently |
| 94 | built image according to the timestamp when it needs to look for an |
| 95 | image. Minimally, through the use of options, you must provide either |
| 96 | a machine name, a virtual machine image (``*wic.vmdk``), or a kernel |
| 97 | image (``*.bin``). |
| 98 | |
| 99 | Here are some additional examples to help illustrate further QEMU: |
| 100 | |
| 101 | - This example starts QEMU with MACHINE set to "qemux86-64". |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame^] | 102 | Assuming a standard :term:`Build Directory`, ``runqemu`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 103 | automatically finds the ``bzImage-qemux86-64.bin`` image file and |
| 104 | the ``core-image-minimal-qemux86-64-20200218002850.rootfs.ext4`` |
| 105 | (assuming the current build created a ``core-image-minimal`` |
| 106 | image). |
| 107 | |
| 108 | .. note:: |
| 109 | |
| 110 | When more than one image with the same name exists, QEMU finds |
| 111 | and uses the most recently built image according to the |
| 112 | timestamp. |
| 113 | |
| 114 | :: |
| 115 | |
| 116 | $ runqemu qemux86-64 |
| 117 | |
| 118 | - This example produces the exact same results as the previous |
| 119 | example. This command, however, specifically provides the image |
| 120 | and root filesystem type. |
| 121 | :: |
| 122 | |
| 123 | $ runqemu qemux86-64 core-image-minimal ext4 |
| 124 | |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 125 | - This example specifies to boot an :term:`Initramfs` image and to |
| 126 | enable audio in QEMU. For this case, ``runqemu`` sets the internal |
| 127 | variable ``FSTYPE`` to ``cpio.gz``. Also, for audio to be enabled, |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 128 | an appropriate driver must be installed (see the previous |
| 129 | description for the ``audio`` option for more information). |
| 130 | :: |
| 131 | |
| 132 | $ runqemu qemux86-64 ramfs audio |
| 133 | |
| 134 | - This example does not provide enough information for QEMU to |
| 135 | launch. While the command does provide a root filesystem type, it |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 136 | must also minimally provide a `MACHINE`, `KERNEL`, or `VM` option. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 137 | :: |
| 138 | |
| 139 | $ runqemu ext4 |
| 140 | |
| 141 | - This example specifies to boot a virtual machine image |
| 142 | (``.wic.vmdk`` file). From the ``.wic.vmdk``, ``runqemu`` |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 143 | determines the QEMU architecture (`MACHINE`) to be "qemux86-64" and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 144 | the root filesystem type to be "vmdk". |
| 145 | :: |
| 146 | |
| 147 | $ runqemu /home/scott-lenovo/vm/core-image-minimal-qemux86-64.wic.vmdk |
| 148 | |
| 149 | Switching Between Consoles |
| 150 | ========================== |
| 151 | |
| 152 | When booting or running QEMU, you can switch between supported consoles |
| 153 | by using Ctrl+Alt+number. For example, Ctrl+Alt+3 switches you to the |
| 154 | serial console as long as that console is enabled. Being able to switch |
| 155 | consoles is helpful, for example, if the main QEMU console breaks for |
| 156 | some reason. |
| 157 | |
| 158 | .. note:: |
| 159 | |
| 160 | Usually, "2" gets you to the main console and "3" gets you to the |
| 161 | serial console. |
| 162 | |
| 163 | Removing the Splash Screen |
| 164 | ========================== |
| 165 | |
| 166 | You can remove the splash screen when QEMU is booting by using Alt+left. |
| 167 | Removing the splash screen allows you to see what is happening in the |
| 168 | background. |
| 169 | |
| 170 | Disabling the Cursor Grab |
| 171 | ========================= |
| 172 | |
| 173 | The default QEMU integration captures the cursor within the main window. |
| 174 | It does this since standard mouse devices only provide relative input |
| 175 | and not absolute coordinates. You then have to break out of the grab |
| 176 | using the "Ctrl+Alt" key combination. However, the Yocto Project's |
| 177 | integration of QEMU enables the wacom USB touch pad driver by default to |
| 178 | allow input of absolute coordinates. This default means that the mouse |
| 179 | can enter and leave the main window without the grab taking effect |
| 180 | leading to a better user experience. |
| 181 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 182 | Running Under a Network File System (NFS) Server |
| 183 | ================================================ |
| 184 | |
| 185 | One method for running QEMU is to run it on an NFS server. This is |
| 186 | useful when you need to access the same file system from both the build |
| 187 | and the emulated system at the same time. It is also worth noting that |
| 188 | the system does not need root privileges to run. It uses a user space |
| 189 | NFS server to avoid that. Follow these steps to set up for running QEMU |
| 190 | using an NFS server. |
| 191 | |
| 192 | 1. *Extract a Root Filesystem:* Once you are able to run QEMU in your |
| 193 | environment, you can use the ``runqemu-extract-sdk`` script, which is |
| 194 | located in the ``scripts`` directory along with the ``runqemu`` |
| 195 | script. |
| 196 | |
| 197 | The ``runqemu-extract-sdk`` takes a root filesystem tarball and |
| 198 | extracts it into a location that you specify. Here is an example that |
| 199 | takes a file system and extracts it to a directory named |
| 200 | ``test-nfs``: |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 201 | |
| 202 | .. code-block:: none |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 203 | |
| 204 | runqemu-extract-sdk ./tmp/deploy/images/qemux86-64/core-image-sato-qemux86-64.tar.bz2 test-nfs |
| 205 | |
| 206 | 2. *Start QEMU:* Once you have extracted the file system, you can run |
| 207 | ``runqemu`` normally with the additional location of the file system. |
| 208 | You can then also make changes to the files within ``./test-nfs`` and |
| 209 | see those changes appear in the image in real time. Here is an |
| 210 | example using the ``qemux86`` image: |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 211 | |
| 212 | .. code-block:: none |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 213 | |
| 214 | runqemu qemux86-64 ./test-nfs |
| 215 | |
| 216 | .. note:: |
| 217 | |
| 218 | Should you need to start, stop, or restart the NFS share, you can use |
| 219 | the following commands: |
| 220 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 221 | - To start the NFS share:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 222 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 223 | runqemu-export-rootfs start file-system-location |
| 224 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 225 | - To stop the NFS share:: |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 226 | |
| 227 | runqemu-export-rootfs stop file-system-location |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 228 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 229 | - To restart the NFS share:: |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 230 | |
| 231 | runqemu-export-rootfs restart file-system-location |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 232 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 233 | QEMU CPU Compatibility Under KVM |
| 234 | ================================ |
| 235 | |
| 236 | By default, the QEMU build compiles for and targets 64-bit and x86 Intel |
| 237 | Core2 Duo processors and 32-bit x86 Intel Pentium II processors. QEMU |
| 238 | builds for and targets these CPU types because they display a broad |
| 239 | range of CPU feature compatibility with many commonly used CPUs. |
| 240 | |
| 241 | Despite this broad range of compatibility, the CPUs could support a |
| 242 | feature that your host CPU does not support. Although this situation is |
| 243 | not a problem when QEMU uses software emulation of the feature, it can |
| 244 | be a problem when QEMU is running with KVM enabled. Specifically, |
| 245 | software compiled with a certain CPU feature crashes when run on a CPU |
| 246 | under KVM that does not support that feature. To work around this |
| 247 | problem, you can override QEMU's runtime CPU setting by changing the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame^] | 248 | ``QB_CPU_KVM`` variable in ``qemuboot.conf`` in the :term:`Build Directory` |
| 249 | ``deploy/image`` directory. This setting specifies a ``-cpu`` option passed |
| 250 | into QEMU in the ``runqemu`` script. Running ``qemu -cpu help`` returns a |
| 251 | list of available supported CPU types. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 252 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 253 | QEMU Performance |
| 254 | ================ |
| 255 | |
| 256 | Using QEMU to emulate your hardware can result in speed issues depending |
| 257 | on the target and host architecture mix. For example, using the |
| 258 | ``qemux86`` image in the emulator on an Intel-based 32-bit (x86) host |
| 259 | machine is fast because the target and host architectures match. On the |
| 260 | other hand, using the ``qemuarm`` image on the same Intel-based host can |
| 261 | be slower. But, you still achieve faithful emulation of ARM-specific |
| 262 | issues. |
| 263 | |
| 264 | To speed things up, the QEMU images support using ``distcc`` to call a |
| 265 | cross-compiler outside the emulated system. If you used ``runqemu`` to |
| 266 | start QEMU, and the ``distccd`` application is present on the host |
| 267 | system, any BitBake cross-compiling toolchain available from the build |
| 268 | system is automatically used from within QEMU simply by calling |
| 269 | ``distcc``. You can accomplish this by defining the cross-compiler |
| 270 | variable (e.g. ``export CC="distcc"``). Alternatively, if you are using |
| 271 | a suitable SDK image or the appropriate stand-alone toolchain is |
| 272 | present, the toolchain is also automatically used. |
| 273 | |
| 274 | .. note:: |
| 275 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 276 | There are several mechanisms to connect to the system running |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 277 | on the QEMU emulator: |
| 278 | |
| 279 | - QEMU provides a framebuffer interface that makes standard consoles |
| 280 | available. |
| 281 | |
| 282 | - Generally, headless embedded devices have a serial port. If so, |
| 283 | you can configure the operating system of the running image to use |
| 284 | that port to run a console. The connection uses standard IP |
| 285 | networking. |
| 286 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 287 | - SSH servers are available in some QEMU images. The ``core-image-sato`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 288 | QEMU image has a Dropbear secure shell (SSH) server that runs with |
| 289 | the root password disabled. The ``core-image-full-cmdline`` and |
| 290 | ``core-image-lsb`` QEMU images have OpenSSH instead of Dropbear. |
| 291 | Including these SSH servers allow you to use standard ``ssh`` and |
| 292 | ``scp`` commands. The ``core-image-minimal`` QEMU image, however, |
| 293 | contains no SSH server. |
| 294 | |
| 295 | - You can use a provided, user-space NFS server to boot the QEMU |
| 296 | session using a local copy of the root filesystem on the host. In |
| 297 | order to make this connection, you must extract a root filesystem |
| 298 | tarball by using the ``runqemu-extract-sdk`` command. After |
| 299 | running the command, you must then point the ``runqemu`` script to |
| 300 | the extracted directory instead of a root filesystem image file. |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 301 | See the |
| 302 | ":ref:`dev-manual/qemu:running under a network file system (nfs) server`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 303 | section for more information. |
| 304 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 305 | QEMU Command-Line Syntax |
| 306 | ======================== |
| 307 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 308 | The basic ``runqemu`` command syntax is as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 309 | |
| 310 | $ runqemu [option ] [...] |
| 311 | |
| 312 | Based on what you provide on the command line, ``runqemu`` does a |
| 313 | good job of figuring out what you are trying to do. For example, by |
| 314 | default, QEMU looks for the most recently built image according to the |
| 315 | timestamp when it needs to look for an image. Minimally, through the use |
| 316 | of options, you must provide either a machine name, a virtual machine |
| 317 | image (``*wic.vmdk``), or a kernel image (``*.bin``). |
| 318 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 319 | Following is the command-line help output for the ``runqemu`` command:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 320 | |
| 321 | $ runqemu --help |
| 322 | |
| 323 | Usage: you can run this script with any valid combination |
| 324 | of the following environment variables (in any order): |
| 325 | KERNEL - the kernel image file to use |
| 326 | ROOTFS - the rootfs image file or nfsroot directory to use |
| 327 | MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) |
| 328 | Simplified QEMU command-line options can be passed with: |
| 329 | nographic - disable video console |
| 330 | serial - enable a serial console on /dev/ttyS0 |
| 331 | slirp - enable user networking, no root privileges is required |
| 332 | kvm - enable KVM when running x86/x86_64 (VT-capable CPU required) |
| 333 | kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required) |
| 334 | publicvnc - enable a VNC server open to all hosts |
| 335 | audio - enable audio |
| 336 | [*/]ovmf* - OVMF firmware file or base name for booting with UEFI |
| 337 | tcpserial=<port> - specify tcp serial port number |
| 338 | biosdir=<dir> - specify custom bios dir |
| 339 | biosfilename=<filename> - specify bios filename |
| 340 | qemuparams=<xyz> - specify custom parameters to QEMU |
| 341 | bootparams=<xyz> - specify custom kernel parameters during boot |
| 342 | help, -h, --help: print this text |
| 343 | |
| 344 | Examples: |
| 345 | runqemu |
| 346 | runqemu qemuarm |
| 347 | runqemu tmp/deploy/images/qemuarm |
| 348 | runqemu tmp/deploy/images/qemux86/<qemuboot.conf> |
| 349 | runqemu qemux86-64 core-image-sato ext4 |
| 350 | runqemu qemux86-64 wic-image-minimal wic |
| 351 | runqemu path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial |
| 352 | runqemu qemux86 iso/hddimg/wic.vmdk/wic.qcow2/wic.vdi/ramfs/cpio.gz... |
| 353 | runqemu qemux86 qemuparams="-m 256" |
| 354 | runqemu qemux86 bootparams="psplash=false" |
| 355 | runqemu path/to/<image>-<machine>.wic |
| 356 | runqemu path/to/<image>-<machine>.wic.vmdk |
| 357 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 358 | ``runqemu`` Command-Line Options |
| 359 | ================================ |
| 360 | |
| 361 | Following is a description of ``runqemu`` options you can provide on the |
| 362 | command line: |
| 363 | |
| 364 | .. note:: |
| 365 | |
| 366 | If you do provide some "illegal" option combination or perhaps you do |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 367 | not provide enough in the way of options, ``runqemu`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 368 | provides appropriate error messaging to help you correct the problem. |
| 369 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 370 | - `QEMUARCH`: The QEMU machine architecture, which must be "qemuarm", |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 371 | "qemuarm64", "qemumips", "qemumips64", "qemuppc", "qemux86", or |
| 372 | "qemux86-64". |
| 373 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 374 | - `VM`: The virtual machine image, which must be a ``.wic.vmdk`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 375 | file. Use this option when you want to boot a ``.wic.vmdk`` image. |
| 376 | The image filename you provide must contain one of the following |
| 377 | strings: "qemux86-64", "qemux86", "qemuarm", "qemumips64", |
| 378 | "qemumips", "qemuppc", or "qemush4". |
| 379 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 380 | - `ROOTFS`: A root filesystem that has one of the following filetype |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 381 | extensions: "ext2", "ext3", "ext4", "jffs2", "nfs", or "btrfs". If |
| 382 | the filename you provide for this option uses "nfs", it must provide |
| 383 | an explicit root filesystem path. |
| 384 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 385 | - `KERNEL`: A kernel image, which is a ``.bin`` file. When you provide a |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 386 | ``.bin`` file, ``runqemu`` detects it and assumes the file is a |
| 387 | kernel image. |
| 388 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 389 | - `MACHINE`: The architecture of the QEMU machine, which must be one of |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 390 | the following: "qemux86", "qemux86-64", "qemuarm", "qemuarm64", |
| 391 | "qemumips", "qemumips64", or "qemuppc". The MACHINE and QEMUARCH |
| 392 | options are basically identical. If you do not provide a MACHINE |
| 393 | option, ``runqemu`` tries to determine it based on other options. |
| 394 | |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 395 | - ``ramfs``: Indicates you are booting an :term:`Initramfs` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 396 | image, which means the ``FSTYPE`` is ``cpio.gz``. |
| 397 | |
| 398 | - ``iso``: Indicates you are booting an ISO image, which means the |
| 399 | ``FSTYPE`` is ``.iso``. |
| 400 | |
| 401 | - ``nographic``: Disables the video console, which sets the console to |
| 402 | "ttys0". This option is useful when you have logged into a server and |
| 403 | you do not want to disable forwarding from the X Window System (X11) |
| 404 | to your workstation or laptop. |
| 405 | |
| 406 | - ``serial``: Enables a serial console on ``/dev/ttyS0``. |
| 407 | |
| 408 | - ``biosdir``: Establishes a custom directory for BIOS, VGA BIOS and |
| 409 | keymaps. |
| 410 | |
| 411 | - ``biosfilename``: Establishes a custom BIOS name. |
| 412 | |
| 413 | - ``qemuparams=\"xyz\"``: Specifies custom QEMU parameters. Use this |
| 414 | option to pass options other than the simple "kvm" and "serial" |
| 415 | options. |
| 416 | |
| 417 | - ``bootparams=\"xyz\"``: Specifies custom boot parameters for the |
| 418 | kernel. |
| 419 | |
| 420 | - ``audio``: Enables audio in QEMU. The MACHINE option must be either |
| 421 | "qemux86" or "qemux86-64" in order for audio to be enabled. |
| 422 | Additionally, the ``snd_intel8x0`` or ``snd_ens1370`` driver must be |
| 423 | installed in linux guest. |
| 424 | |
| 425 | - ``slirp``: Enables "slirp" networking, which is a different way of |
| 426 | networking that does not need root access but also is not as easy to |
| 427 | use or comprehensive as the default. |
| 428 | |
| 429 | - ``kvm``: Enables KVM when running "qemux86" or "qemux86-64" QEMU |
| 430 | architectures. For KVM to work, all the following conditions must be |
| 431 | met: |
| 432 | |
| 433 | - Your MACHINE must be either qemux86" or "qemux86-64". |
| 434 | |
| 435 | - Your build host has to have the KVM modules installed, which are |
| 436 | ``/dev/kvm``. |
| 437 | |
| 438 | - The build host ``/dev/kvm`` directory has to be both writable and |
| 439 | readable. |
| 440 | |
| 441 | - ``kvm-vhost``: Enables KVM with VHOST support when running "qemux86" |
| 442 | or "qemux86-64" QEMU architectures. For KVM with VHOST to work, the |
| 443 | following conditions must be met: |
| 444 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 445 | - ``kvm`` option conditions defined above must be met. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 446 | |
| 447 | - Your build host has to have virtio net device, which are |
| 448 | ``/dev/vhost-net``. |
| 449 | |
| 450 | - The build host ``/dev/vhost-net`` directory has to be either |
| 451 | readable or writable and "slirp-enabled". |
| 452 | |
| 453 | - ``publicvnc``: Enables a VNC server open to all hosts. |