title: AOSP-模拟器 layout: doc aside: false
AOSP 8.1 编译
安装编译包
sh
sudo apt install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick lib32readline-dev lib32z1-dev libelf-dev liblz4-tool libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
Ubuntu版本 <= 23.10
sudo apt install -y lib32ncurses5-dev libncurses5 libncurses5-dev
Ubuntu版本 <= 20.04sudo apt install -y libwxgtk3.0-dev
Ubuntu版本 <= 16.04sudo apt install -y libwxgtk2.8-dev
AOSP版本需要的java环境
- Android 11
sudo apt install openjdk-11-jdk
- Android 9-10
sudo apt install openjdk-9-jdk
- Android 7.1-8.1
sudo apt install openjdk-8-jdk
需要删除TLSv1.1jdk.tls.disabledAlgorithms/etc/java-8-openjdk/security/java.security
- Android 1-7.0
sudo apt install openjdk-7-jdk
对于jdk8 需要删除 /etc/java-8-openjdk/security/java.security
文件中的 jdk.tls.disabledAlgorithms
中 TLSv1、TLSv1.1
重启jack
sh
cd prebuilts/sdk/tools
./jack-admin kill-server
Python
- Android 10+ 'sudo apt install python-is-python3'
- Android 1-9
sudo apt install python2
- 'sudo ln -s /usr/bin/python2 /usr/bin/python'
下载源码
sh
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-security-8.1.0_r93
repo init -u https://android.googlesource.com/platform/manifest -b android-security-8.1.0_r93
repo sync
修复错误
sh
sudo nano ~/.bashrc
#最后一行添加 export LC_ALL=C
source ~/.bashrc
//art/runtime/mem_map.cc
c
//Add begin @{
#if !defined(ART_TARGET)
}else if(expected_ptr){
#define MAP_FIXED_NOREPLACE 0x100000
flags |= MAP_FIXED_NOREPLACE;
#endif
//@}
编译
sh
cd ~/aosp
source ./build/envsetup.sh
lunch
make -j8
#错误清理
make clean
启动
sh
cd ~/aosp
source ./build/envsetup.sh
lunch aosp_arm64-eng
emulator
编译为导出包
sh
#13和13以上
make emu_img_zip
#12和12以下
make -j8 sdk sdk_repo
#这会生成一个 sdk-repo-linux-system-images-eng.[username]].zip 文件。
emulator.exe -netdelay none -netspeed full -no-snapstorage -avd Small_Phone_API_25
sh
x .\emulator.exe --help
INFO | Storing crashdata in: C:\Users\Kpa\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.2.15.db, detection is enabled for process: 14580
Android Emulator usage: emulator [options] [-qemu args]
options:
-list-avds list available AVDs
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-vendor <file> read initial vendor image from <file>
-writable-system make system & vendor image writable after 'adb remount'
-delay-adb delay adb communication till boot completes
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-initdata <file> same as '-init-data <file>'
-data <file> data image (default <datadir>/userdata-qemu.img
-encryption-key <file> read initial encryption key image from <file>
-logcat-output <file> output file of logcat(default none)
-partition-size <size> system/data partition size in MBs
-cache <file> cache partition image (default is temporary file)
-cache-size <size> cache partition size in MBs
-no-cache disable the cache partition
-nocache same as -no-cache
-sdcard <file> SD card image (default <datadir>/sdcard.img
-quit-after-boot <timeout> quit emulator after guest boots completely, or after timeout in seconds
-qemu-top-dir <dir> Use the emulator in the specified dir (relative or absolute path)
-monitor-adb <verbose_level> monitor the adb messages between guest and host, default not
-snapstorage <file> file that contains all state snapshots (default <datadir>/snapshots.img)
-no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)
-snapshot <name> name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
-no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage
-no-snapshot-save do not auto-save to snapshot on exit: abandon changed state
-no-snapshot-load do not auto-start from snapshot: perform a full boot
-force-snapshot-load force starting from snapshot: exit emulator if loading from snapshot fails
-qcow2-for-userdata use qcow2 for userdata
-snapshot-list show a list of available snapshots
-no-snapshot-update-time do not try to correct snapshot time on restore
-wipe-data reset the user data image (copy it from initdata)
-avd <name> use a specific android virtual device
-avd-arch <target> use a specific target architecture
-skindir <dir> search skins in <dir> (default <system>/skins)
-skin <name> select a given skin
-no-skin deprecated: create an AVD with no skin instead
-noskin same as -no-skin
-memory <size> physical RAM size in MBs
-ui-only <UI feature> run only the UI feature requested
-id <name> assign an id to this virtual device (separate from the avd name)
-cores <number> Set number of CPU cores to emulator
-accel <mode> Configure emulation acceleration
-no-accel Same as '-accel off'
-ranchu Use new emulator backend instead of the classic one
-engine <engine> Select engine. auto|classic|qemu2
-netspeed <speed> maximum network download/upload speeds
-netdelay <delay> network latency emulation
-netfast disable network shaping
-code-profile <name> enable code profiling
-show-kernel display kernel messages
-shell enable root shell on current terminal
-no-jni deprecated, see dalvik_vm_checkjni
-nojni deprecated, see dalvik_vm_checkjni
-dalvik-vm-checkjni Enable dalvik.vm.checkjni
-logcat <tags> enable logcat output with given tags
-log-nofilter Disable the duplicate log filter
-log-detailed Enable detailed logging info
-no-audio disable audio support
-noaudio same as -no-audio
-audio <backend> use specific audio backend
-radio <device> redirect radio modem interface to character device
-port <port> TCP port that will be used for the console
-ports <consoleport>,<adbport> TCP ports used for the console and adb bridge
-modem-simulator-port <port> TCP port that will be used for android modem simulator
-onion <image> use overlay PNG image over screen
-onion-alpha <%age> specify onion-skin translucency
-onion-rotation 0|1|2|3 specify onion-skin rotation
-dpi-device <dpi> specify device's resolution in dpi (default DEFAULT_DEVICE_DPI)
-scale <scale> scale emulator window (deprecated)
-wifi-client-port <port> connect to other emulator for WiFi forwarding
-wifi-server-port <port> listen to other emulator for WiFi forwarding
-http-proxy <proxy> make TCP connections through a HTTP/HTTPS proxy
-timezone <timezone> use this timezone instead of the host's default
-change-language <language> use this language instead of the current one. Restarts the framework.
-change-country <country> use this country instead of the current one. Restarts the framework.
-change-locale <locale> use this locale instead of the current one. Restarts the framework.
-dns-server <servers> use this DNS server(s) in the emulated system
-net-tap <interface> use this TAP interface for networking
-net-socket option use Socket interface for network, one of fd=, listen=, or connect=
-net-tap-script-up <script> script to run when the TAP interface goes up
-net-tap-script-down <script> script to run when the TAP interface goes down
-cpu-delay <cpudelay> throttle CPU emulation
-no-boot-anim disable animation for faster boot
-no-window disable graphical window display
-qt-hide-window Start QT window but hide window display
-no-sim device has no SIM card
-lowram device is a low ram device
-version display emulator version number
-no-passive-gps disable passive gps updates
-gnss-file-path <path> Use the specified filepath to read gnss data
-gnss-grpc-port <port number> Use the specified port number to start grpc service to receive gnss data
-virtio-console using virtio console as console
-read-only allow running multiple instances of emulators on the same AVD, but cannot save snapshot.
-is-restart <restart-pid> specifies that this emulator was a restart, and to wait out <restart-pid> before proceeding
-report-console <socket> report console port to remote socket
-gps <device> redirect NMEA GPS to character device
-shell-serial <device> specific character device for root shell
-tcpdump <file> capture network packets to file
-bootchart <timeout> enable bootcharting
-charmap <file> use specific key character map
-studio-params <file> used by Android Studio to provide parameters
-prop <name>=<value> set system property on boot
-shared-net-id <number> join the shared network, using IP address 10.1.2.<number>
-gpu <mode> set hardware OpenGLES emulation mode
-use-host-vulkan use host for vulkan emulation regardless of 'gpu' mode
-vsync-rate <rate> set the vsync rate (refresh rate) in Hz for the guest display
-camera-back <mode> set emulation mode for a camera facing back
-camera-front <mode> set emulation mode for a camera facing front
-webcam-list lists web cameras available for emulation
-virtualscene-poster <name>=<filename> Load a png or jpeg image as a poster in the virtual scene
-screen <mode> set emulated screen mode
-selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
-unix-pipe <path> Add <path> to the list of allowed Unix pipes
-fixed-scale Use fixed 1:1 scale for the initial emulator window.
-wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming
-skip-adb-auth Skip adb authentication dialogue
-metrics-to-console Enable usage metrics and print the messages to stdout
-metrics-collection Enable usage metrics and send them to google play
-metrics-to-file <file> Enable usage metrics and write the messages into specified file
-no-metrics Disable metrics collection
-detect-image-hang Enable the detection of system image hangs.
-feature <name|-name> Force-enable or disable (-name) the features
-icc-profile <file> Use icc profile from specified file
-sim-access-rules-file <file> Use SIM access rules from specified file
-phone-number <phone_number> Sets the phone number of the emulated device
-acpi-config <file> specify acpi device proprerties (hierarchical key=value pair)
-fuchsia Run Fuchsia image. Bypasses android-specific setup; args after are treated as standard QEMU args
-window-size <size> Set window size for when bypassing android-specific setup.
-allow-host-audio Allows sending of audio from audio input devices. Otherwise, zeroes out audio.
-restart-when-stalled Allows restarting guest when it is stalled.
-perf-stat <file> Run periodic perf stat reporter in the background and write output to specified file.
-share-vid Share current video state in shared memory region.
-grpc <port> TCP ports used for the gRPC bridge.
-grpc-tls-key <pem> File with the private key used to enable gRPC TLS.
-grpc-tls-cer <pem> File with the public X509 certificate used to enable gRPC TLS.
-grpc-tls-ca <pem> File with the Certificate Authorities used to validate client certificates.
-grpc-use-token Use the emulator console token for gRPC authentication.
-grpc-use-jwt Use a signed JWT token for gRPC authentication. (default, disable with -grpc flag)
-grpc-allowlist <file> Use a custom allow list for gRPC authentication.
-idle-grpc-timeout <timeout> Terminate the emulator if there is no gRPC activity within <timeout> seconds.
-waterfall <mode> Mode in which to run waterfall.
-grpc-ui Use the experimental gRPRC ui.
-packet-streamer-endpoint <uri> Use the provided packet streamer endpoint when present.
-netsim-args <arg1> [<arg2> ...] Additional netsim arguments.
-multidisplay index width height dpi flag config multiple displays.
-google-maps-key <API key> API key to use with the Google Maps GUI.
-no-location-ui Disable the location UI in the extended window.
-use-keycode-forwarding Use keycode forwarding instead of host charmap translation.
-record-session <file>,<delay>[,<duration>] Screen record the emulator session.
-legacy-fake-camera Use legacy camera HAL for the emulated fake camera.
-camera-hq-edge Enable high qualify edge processing for emulated camera.
-no-direct-adb Use external adb executable for internal communication.
-check-snapshot-loadable <snapshot name|exported snapshot tar file> Check if a snasphot is loadable.
-no-hidpi-scaling Disable HiDPI scaling of guest display on macOS devices.
-no-mouse-reposition Do not reposition the mouse to emulator window center if mouse pointer gets out of the window.
-guest-angle Enable guest ANGLE as system driver.
-usb-passthrough VID PID BUS PORTS Host USB device Passthrough
-append-userspace-opt key=value Appends a property which is passed to the userspace.
-save-path <file path> Override save path for screenshot and bug report. The value will not be persisted on host OS.
-no-nested-warnings Disable the warning dialog when emulator is running in nested virtualization.
-wifi-tap <interface> use this TAP interface for Virtio Wi-Fi
-wifi-tap-script-up <script> script to run when the TAP interface goes up
-wifi-tap-script-down <script> script to run when the TAP interface goes down
-wifi-socket <option> use Socket interface for Virtio Wi-Fi, one of fd=, listen=, or connect=
-wifi-user-mode-options <option list> Override default user mode networking option for wifi network in Android Emulator for API 31 and above.
-network-user-mode-options <option list> Override default user mode networking option for both radio and wifi network in Android Emulator for API 30 and below. Override default user mode networking optionfor radio network for API 31 and above.
-adb-path <path> use adb binary from <path>
-hotplug-multi-display Use the HAL hotplug display to implement multiDisplay.
-xts Use android64-xts CPU profile instead of the default one
-wifi-mac-address <mac address> Override the mac address of the wlan0 interface in AVD. This option only applies to situation where AVD is loaded from snapshot using read-only mode. Example: -wifi-mac-address 00:11:22:33:44:55.
-no-ethernet Disable virtual Ethernet interface en0. This option is only effective when feature VirtioWifi is used.
-android-serialno <android serialno> Set customized android serial number. The value of this field must be encodable as 7-bit
ASCII and match the regular expression 鈥淾[a-zA-Z0-9._-,]+$鈥?
-qemu args... pass arguments to qemu
-qemu -h display qemu help
-verbose same as '-debug-init'
-debug <tags> enable/disable debug messages
-debug-<tag> enable specific debug messages
-debug-no-<tag> disable specific debug messages
-help print this help
-help-<option> print option-specific help
-help-disk-images about disk images
-help-debug-tags debug tags for -debug <tags>
-help-char-devices character <device> specification
-help-environment environment variables
-help-virtual-device virtual device management
-help-sdk-images about disk images when using the SDK
-help-build-images about disk images when building Android
-help-all prints all help content
> .\emulator.exe -qemu -h
INFO | Storing crashdata in: C:\Users\Kpa\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.2.15.db, detection is enabled for process: 20384
INFO | Android emulator version 34.2.15.0 (build_id 11906825) (CL:N/A)
INFO | Storing crashdata in: C:\Users\Kpa\AppData\Local\Temp\\AndroidEmulator\emu-crash-34.2.15.db, detection is enabled for process: 804
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
INFO | qt_main: arg: D:\ProgramData\Android\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe
INFO | qt_main: arg: -h
QEMU emulator version 2.12.0 (gradle_1.3.0-beta4-80481-g0739999921), Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
usage: D:\ProgramData\Android\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe [options] [disk_image]
'disk_image' is a raw hard disk image for IDE hard disk 0
Standard options:
-h or -help display this help and exit
-version display version information and exit
-machine [type=]name[,prop[=value][,...]]
selects emulated machine ('-machine help' for list)
property accel=accel1[:accel2[:...]] selects accelerator
supported accelerators are kvm, xen, hax, hvf, whpx or tcg (default: tcg)
kernel_irqchip=on|off|split controls accelerated irqchip support (default=off)
vmport=on|off|auto controls emulation of vmport (default: auto)
kvm_shadow_mem=size of KVM shadow MMU in bytes
dump-guest-core=on|off include guest memory in a core dump (default=on)
mem-merge=on|off controls memory merge support (default: on)
igd-passthru=on|off controls IGD GFX passthrough support (default=off)
aes-key-wrap=on|off controls support for AES key wrapping (default=on)
dea-key-wrap=on|off controls support for DEA key wrapping (default=on)
suppress-vmdesc=on|off disables self-describing migration (default=off)
nvdimm=on|off controls NVDIMM support (default=off)
enforce-config-section=on|off enforce configuration section migration (default=off)
s390-squash-mcss=on|off (deprecated) controls support for squashing into default css (default=off)
memory-encryption=@var{} memory encryption object to use (default=none)
-cpu cpu select CPU ('-cpu help' for list)
-accel [accel=]accelerator[,thread=single|multi]
select accelerator (kvm, xen, hax, hvf, whpx or tcg; use 'help' for a list)
thread=single|multi (enable multi-threaded TCG)-smp [cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets]
set the number of CPUs to 'n' [default=1]
maxcpus= maximum number of total cpus, including
offline CPUs for hotplug, etc
cores= number of CPU cores on one socket
threads= number of threads on one CPU core
sockets= number of discrete sockets in the system
-numa node[,mem=size][,cpus=firstcpu[-lastcpu]][,nodeid=node]
-numa node[,memdev=id][,cpus=firstcpu[-lastcpu]][,nodeid=node]
-numa dist,src=source,dst=destination,val=distance
-numa cpu,node-id=node[,socket-id=x][,core-id=y][,thread-id=z]
-add-fd fd=fd,set=set[,opaque=opaque]
Add 'fd' to fd 'set'
-set group.id.arg=value
set <arg> parameter for item <id> of type <group>
i.e. -set drive.$id.file=/path/to/image
-global driver.property=value
-global driver=driver,property=property,value=value
set a global default for a driver property
-boot [order=drives][,once=drives][,menu=on|off]
[,splash=sp_name][,splash-time=sp_time][,reboot-timeout=rb_time][,strict=on|off]
'drives': floppy (a), hard disk (c), CD-ROM (d), network (n)
'sp_name': the file's name that would be passed to bios as logo picture, if menu=on
'sp_time': the period that splash picture last if menu=on, unit is ms
'rb_timeout': the timeout before guest reboot when boot failed, unit is ms
-m [size=]megs[,slots=n,maxmem=size]
configure guest RAM
size: initial amount of guest memory
slots: number of hotplug slots (default: none)
maxmem: maximum amount of guest memory (default: none)
NOTE: Some architectures might enforce a specific granularity
-mem-path FILE provide backing storage for guest RAM
-mem-prealloc preallocate guest memory (use with -mem-path)
-k language use keyboard layout (for example 'fr' for French)
-audio-help print list of audio drivers and their options
-no-audio disable audio support
-soundhw c1,... enable audio support
and only specified sound cards (comma separated list)
use '-soundhw help' to get the list of supported cards
use '-soundhw all' to enable all of them
-balloon virtio[,addr=str]
enable virtio balloon device (deprecated)
-device driver[,prop[=value][,...]]
add device (based on driver)
prop=value,... sets driver properties
use '-device help' to print all possible drivers
use '-device driver,help' to print all possible properties
-name string1[,process=string2][,debug-threads=on|off]
set the name of the guest
string1 sets the window title and string2 the process name (on Linux)
When debug-threads is enabled, individual threads are given a separate name (on Linux)
NOTE: The thread names are for debugging and not a stable API.
-uuid %08x-%04x-%04x-%04x-%012x
specify machine UUID
Block device options:
-fda/-fdb file use 'file' as floppy disk 0/1 image
-hda/-hdb file use 'file' as IDE hard disk 0/1 image
-hdc/-hdd file use 'file' as IDE hard disk 2/3 image
-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)
-blockdev [driver=]driver[,node-name=N][,discard=ignore|unmap]
[,cache.direct=on|off][,cache.no-flush=on|off]
[,read-only=on|off][,detect-zeroes=on|off|unmap]
[,driver specific parameters...]
configure a block backend
-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
[,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
[,cache=writethrough|writeback|none|directsync|unsafe][,format=f]
[,serial=s][,addr=A][,rerror=ignore|stop|report]
[,werror=ignore|stop|report|enospc][,id=name][,aio=threads|native]
[,readonly=on|off][,copy-on-read=on|off]
[,discard=ignore|unmap][,detect-zeroes=on|off|unmap]
[[,bps=b]|[[,bps_rd=r][,bps_wr=w]]]
[[,iops=i]|[[,iops_rd=r][,iops_wr=w]]]
[[,bps_max=bm]|[[,bps_rd_max=rm][,bps_wr_max=wm]]]
[[,iops_max=im]|[[,iops_rd_max=irm][,iops_wr_max=iwm]]]
[[,iops_size=is]]
[[,group=g]]
use 'file' as a drive image
-mtdblock file use 'file' as on-board Flash memory image
-sd file use 'file' as SecureDigital card image
-pflash file use 'file' as a parallel flash image
-snapshot write to temporary files instead of disk image files
-fsdev fsdriver,id=id[,path=path,][security_model={mapped-xattr|mapped-file|passthrough|none}]
[,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd][,fmode=fmode][,dmode=dmode]
[[,throttling.bps-total=b]|[[,throttling.bps-read=r][,throttling.bps-write=w]]]
[[,throttling.iops-total=i]|[[,throttling.iops-read=r][,throttling.iops-write=w]]]
[[,throttling.bps-total-max=bm]|[[,throttling.bps-read-max=rm][,throttling.bps-write-max=wm]]]
[[,throttling.iops-total-max=im]|[[,throttling.iops-read-max=irm][,throttling.iops-write-max=iwm]]]
[[,throttling.iops-size=is]]
-virtfs local,path=path,mount_tag=tag,security_model=[mapped-xattr|mapped-file|passthrough|none]
[,id=id][,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd][,fmode=fmode][,dmode=dmode]
-virtfs_synth Create synthetic file system image
-iscsi [user=user][,password=password]
[,header-digest=CRC32C|CR32C-NONE|NONE-CRC32C|NONE
[,initiator-name=initiator-iqn][,id=target-iqn]
[,timeout=timeout]
iSCSI session parameters
USB options:
-usb enable the USB driver (if it is not used by default yet)
-usbdevice name add the host or guest USB device 'name'
Display options:
-display sdl[,frame=on|off][,alt_grab=on|off][,ctrl_grab=on|off]
[,window_close=on|off][,gl=on|off]
-display gtk[,grab_on_hover=on|off][,gl=on|off]|
-display vnc=<display>[,<optargs>]
-display curses
-display none select display type
The default display is equivalent to
"-display sdl"
-nographic disable graphical output and redirect serial I/Os to console
-curses shorthand for -display curses
-no-frame open SDL window without a frame and window decorations
-alt-grab use Ctrl-Alt-Shift to grab mouse (instead of Ctrl-Alt)
-ctrl-grab use Right-Ctrl to grab mouse (instead of Ctrl-Alt)
-no-quit disable SDL window close capability
-sdl shorthand for -display sdl
-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]
[,x509-key-file=<file>][,x509-key-password=<file>]
[,x509-cert-file=<file>][,x509-cacert-file=<file>]
[,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6|unix]
[,tls-ciphers=<list>]
[,tls-channel=[main|display|cursor|inputs|record|playback]]
[,plaintext-channel=[main|display|cursor|inputs|record|playback]]
[,sasl][,password=<secret>][,disable-ticketing]
[,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]
[,jpeg-wan-compression=[auto|never|always]]
[,zlib-glz-wan-compression=[auto|never|always]]
[,streaming-video=[off|all|filter]][,disable-copy-paste]
[,disable-agent-file-xfer][,agent-mouse=[on|off]]
[,playback-compression=[on|off]][,seamless-migration=[on|off]]
[,gl=[on|off]][,rendernode=<file>]
enable spice
at least one of {port, tls-port} is mandatory
-portrait rotate graphical output 90 deg left (only PXA LCD)
-rotate <deg> rotate graphical output some deg left (only PXA LCD)
-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]
select video card type
-full-screen start in full screen
-vnc <display> shorthand for -display vnc=<display>
i386 target only:
-win2k-hack use it when installing Windows 2000 to avoid a disk full bug
-no-fd-bootchk disable boot signature checking for floppy disks
-no-acpi disable ACPI
-no-hpet disable HPET
-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]
ACPI table description
-smbios file=binary
load SMBIOS entry from binary file
-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]
[,uefi=on|off]
specify SMBIOS type 0 fields
-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]
[,uuid=uuid][,sku=str][,family=str]
specify SMBIOS type 1 fields
-smbios type=2[,manufacturer=str][,product=str][,version=str][,serial=str]
[,asset=str][,location=str]
specify SMBIOS type 2 fields
-smbios type=3[,manufacturer=str][,version=str][,serial=str][,asset=str]
[,sku=str]
specify SMBIOS type 3 fields
-smbios type=4[,sock_pfx=str][,manufacturer=str][,version=str][,serial=str]
[,asset=str][,part=str]
specify SMBIOS type 4 fields
-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]
[,asset=str][,part=str][,speed=%d]
specify SMBIOS type 17 fields
Network options:
-netdev user,id=str[,ipv4[=on|off]][,net=addr[/mask]][,host=addr]
[,ipv6[=on|off]][,ipv6-net=addr[/int]][,ipv6-host=addr]
[,restrict=on|off][,hostname=host][,dhcpstart=addr]
[,dns=addr][,ipv6-dns=addr][,dnssearch=domain][,tftp=dir]
[,bootfile=f][,hostfwd=rule][,guestfwd=rule] configure a user mode network backend with ID 'str',
its DHCP server and optional services
-netdev tap,id=str,ifname=name
configure a host TAP network backend with ID 'str'
-netdev socket,id=str[,fd=h][,listen=[host]:port][,connect=host:port]
configure a network backend to connect to another network
using a socket connection
-netdev socket,id=str[,fd=h][,mcast=maddr:port[,localaddr=addr]]
configure a network backend to connect to a multicast maddr and port
use 'localaddr=addr' to specify the host address to send packets from
-netdev socket,id=str[,fd=h][,udp=host:port][,localaddr=host:port]
configure a network backend to connect to another network
using an UDP tunnel
-netdev hubport,id=str,hubid=n[,netdev=nd]
configure a hub port on QEMU VLAN 'n'
--nic [tap|bridge|user|socket][,option][,...][mac=macaddr]
initialize an on-board / default host NIC (using MAC address
macaddr) and connect it to the given host network backend
--nic none use it alone to have zero network devices (the default is to
provided a 'user' network connection)
-net nic[,vlan=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]
configure or create an on-board (or machine default) NIC and
connect it either to VLAN 'n' or the netdev 'nd' (for pluggable
NICs please use '-device devtype,netdev=nd' instead)
-net [user|tap|bridge|socket][,vlan=n][,option][,option][,...]
old way to initialize a host network interface
(use the -netdev option if possible instead)
Character device options:
-chardev help
-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev socket,id=id[,host=host],port=port[,to=to][,ipv4][,ipv6][,nodelay][,reconnect=seconds]
[,server][,nowait][,telnet][,reconnect=seconds][,mux=on|off]
[,logfile=PATH][,logappend=on|off][,tls-creds=ID] (tcp)
-chardev socket,id=id,path=path[,server][,nowait][,telnet][,reconnect=seconds]
[,mux=on|off][,logfile=PATH][,logappend=on|off] (unix)
-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]
[,localport=localport][,ipv4][,ipv6][,mux=on|off]
[,logfile=PATH][,logappend=on|off]
-chardev msmouse,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]
[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev ringbuf,id=id[,size=size][,logfile=PATH][,logappend=on|off]
-chardev file,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev pipe,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev console,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]
-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]
Device URL Syntax:
Bluetooth(R) options:
-bt hci,null dumb bluetooth HCI - doesn't respond to commands
-bt hci,host[:id]
use host's HCI with the given name
-bt hci[,vlan=n]
emulate a standard HCI in virtual scatternet 'n'
-bt vhci[,vlan=n]
add host computer to virtual scatternet 'n' using VHCI
-bt device:dev[,vlan=n]
emulate a bluetooth device 'dev' in scatternet 'n'
TPM device options:
-tpmdev passthrough,id=id[,path=path][,cancel-path=path]
use path to provide path to a character device; default is /dev/tpm0
use cancel-path to provide path to TPM's cancel sysfs entry; if
not provided it will be searched for in /sys/class/misc/tpm?/device
-tpmdev emulator,id=id,chardev=dev
configure the TPM device using chardev backend
Linux/Multiboot boot specific:
-kernel bzImage use 'bzImage' as kernel image
-append cmdline use 'cmdline' as kernel command line
-initrd file use 'file' as initial ram disk
-dtb file use 'file' as device tree image
Debug/Expert options:
-fw_cfg [name=]<name>,file=<file>
add named fw_cfg entry with contents from file
-fw_cfg [name=]<name>,string=<str>
add named fw_cfg entry with contents from string
-serial dev redirect the serial port to char device 'dev'
-parallel dev redirect the parallel port to char device 'dev'
-monitor dev redirect the monitor to char device 'dev'
-qmp dev like -monitor but opens in 'control' mode
-qmp-pretty dev like -qmp but uses pretty JSON formatting
-mon [chardev=]name[,mode=readline|control][,pretty[=on|off]]
-debugcon dev redirect the debug console to char device 'dev'
-pidfile file write PID to 'file'
-singlestep always run in singlestep mode
-S freeze CPU at startup (use 'c' to start execution)
-realtime [mlock=on|off]
run qemu with realtime features
mlock=on|off controls mlock support (default: on)
-gdb dev wait for gdb connection on 'dev'
-s shorthand for -gdb tcp::1234
-d item1,... enable logging of specified items (use '-d help' for a list of log items)
-D logfile output log to logfile (default stderr)
-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)
-L path set the directory for the BIOS, VGA BIOS and keymaps
-bios file set the filename for the BIOS
-enable-kvm enable KVM full virtualization support
-enable-hax enable HAX virtualization support
-enable-whpx enable WHPX virtualization support
-enable-hvf enable Hypervisor.framework virtualization support
-enable-aehd enable AEHD full virtualization support
-xen-domid id specify xen guest domain id
-xen-create create domain using xen hypercalls, bypassing xend
warning: should not be used when xend is in use
-xen-attach attach to existing xen domain
xend will use this when starting QEMU
-xen-domid-restrict restrict set of available xen operations
to specified domain id. (Does not affect
xenpv machine type).
-no-reboot exit instead of rebooting
-no-shutdown stop before shutdown
-loadvm [tag|id]
start right away with a saved state (loadvm in monitor)
-snapshot-list
list snapshots of current AVD on startup
-option-rom rom load a file, rom, into the option ROM space
-rtc [base=utc|localtime|date][,clock=host|rt|vm][,driftfix=none|slew]
set the RTC base and clock, enable drift fix for clock ticks (x86 only)
-icount [shift=N|auto][,align=on|off][,sleep=on|off,rr=record|replay,rrfile=<filename>,rrsnapshot=<snapshot>]
enable virtual instruction counter with 2^N clock ticks per
instruction, enable aligning the host and virtual clocks
or disable real time cpu sleeping
-watchdog model
enable virtual hardware watchdog [default=none]
-watchdog-action reset|shutdown|poweroff|inject-nmi|pause|debug|none
action when watchdog fires [default=reset]
-echr chr set terminal escape character instead of ctrl-a
-virtioconsole c
set virtio console
-show-cursor show cursor
-tb-size n set TB size
-incoming tcp:[host]:port[,to=maxport][,ipv4][,ipv6]
-incoming rdma:host:port[,ipv4][,ipv6]
-incoming unix:socketpath
prepare for incoming migration, listen on
specified protocol and socket address
-incoming fd:fd
-incoming exec:cmdline
accept incoming migration on given file descriptor
or from given external command
-incoming defer
wait for the URI to be specified via migrate_incoming
-only-migratable allow only migratable devices
-nodefaults don't create default devices
-sandbox on[,obsolete=allow|deny][,elevateprivileges=allow|deny|children]
[,spawn=allow|deny][,resourcecontrol=allow|deny]
Enable seccomp mode 2 system call filter (default 'off').
use 'obsolete' to allow obsolete system calls that are provided
by the kernel, but typically no longer used by modern
C library implementations.
use 'elevateprivileges' to allow or deny QEMU process to elevate
its privileges by blacklisting all set*uid|gid system calls.
The value 'children' will deny set*uid|gid system calls for
main QEMU process but will allow forks and execves to run unprivileged
use 'spawn' to avoid QEMU to spawn new threads or processes by
blacklisting *fork and execve
use 'resourcecontrol' to disable process affinity and schedular priority
-readconfig <file>
-writeconfig <file>
read/write config file
-no-user-config
do not load default user-provided config files at startup
-trace [[enable=]<pattern>][,events=<file>][,file=<file>]
specify tracing options
-msg timestamp[=on|off]
change the format of messages
on|off controls leading timestamps (default:on)
-dump-vmstate <file>
Output vmstate information in JSON format to file.
Use the scripts/vmstate-static-checker.py file to
check for possible regressions in migration code
by comparing two such vmstate dumps.
Generic object creation:
-object TYPENAME[,PROP1=VALUE1,...]
create a new object of type TYPENAME setting properties
in the order they are specified. Note that the 'id'
property must be set. These objects are placed in the
'/objects' path.
-boot-property <name>=<value> set system property on boot
-lcd-density density
select lcd display density value (default is 160)
-android-ports <consoleport>,<adbport> TCP ports used for the emulator instance and adb bridge
-android-wifi-client-port <client port> TCP port used to connect to another emulator running as a WiFi server.
This allows WiFi traffic to pass between two emulators, one acting as a
client and one as a server. The decision which is the server and which
is the client does not affect WiFi functionality
-android-wifi-server-port <server port> TCP port to listen on that another emulator can connect to as a WiFi
client. This allows WiFi traffic to pass between two emulators, one
acting as a client and one as a server. The decision which is the
server and which is the client does not affect WiFi functionality
-android-report-console <socket> report console port to remote socket
-dns-server <servers> use this DNS server(s) in the emulated system
-android-hw <file>
specify the hw config ini file location
-skip-adb-auth skip adb authentication dialogue
-timezone <timezone> use this timezone instead of host's default
-net-tap <tap interface> use the provided TAP interface for networking
-net-tap-script-up <script> script to run when TAP interface goes up
-net-tap-script-down <script> script to run when TAP interface goes down
-mem-file-shared (use with -mem-path) initializes RAM backing file (specified in -mem-path) as a shared mapping
-read-only mark the session as read-only and abandon all snapshot or any disk changes at exit.
-fuchsia Fuchsia kernel/image run. Only standard QEMU options are allowed after, and emulator does not start Android virtual devices automatically.-allow-host-au
dio Allows sending of audio from audio input devices. Otherwise, zeroes out audio.-restart-when-stalled Allows restarting guest when it is stalled.-perf-stat <file> Run periodic perf stat reporter in the background and write output to specified file.-multidisplay config a number of (MAX 3) multidisplays-google-maps-key Provide an API key to use with Google maps GUI-no-location-ui Disables the location UI in the extended window-record-session Screen record the emulator session-legacy-fake-camera emulates fake camera by legacy camera HAL-crostini Turn on optimizations for running in a VM on Chrome OS-wear-auto-forward automatically forward tcp:5601 on the host to tcp:5601 on a connected phone if a connected virtual watch is detected. During emulation, the following keys are useful:
ctrl-alt-f toggle full screen
ctrl-alt-n switch to virtual console 'n'
ctrl-alt toggle mouse and keyboard grab
When using -nographic, press 'ctrl-a h' to get some help.
See <https://qemu.org/contribute/report-a-bug> for how to report bugs.
More information on the QEMU project at <https://qemu.org>.
****