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