qemu
Virtual / emulated
Multiple (emulated or host)
Key facts
- Vendor
- Virtual / Generic
- Bootloader family
- Virtual / emulated
- Architecture
- Multiple (emulated or host) (from the template)
- Connections
- serial, ssh
- Architectures
- arm64, arm, aarch64, amd64, x86_64, hppa, i386, mips, mipsel, mips64, mips64el, nios2, ppc, ppc64, ppc64le, riscv32, riscv64, sparc, sparc64, alpha, cris, lm32, m68k, microblaze, microblazeel, moxie, or32, s390x, sh4, sh4eb, tricore, unicore32, xtensa, xtensaeb
Fixed settings (3)
| Variable | Value |
|---|---|
| base_guest_fs_size | guestfs_size | default(512) |
| qemu_guest_fs_driveid | guestfs_driveid | default('lavatest') |
| qemu_misc_architectures | [ 'alpha', 'cris', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'moxie', 'or32', 's390x', 'sh4', 'sh4eb', 'tricore', 'unicore32', 'xtensa', 'xtensaeb'] |
{# device_type: qemu #}
{% extends 'base.jinja2' %}
{% block body %}
{# allow job context override - use a different variable name, undefined if not in job context #}
{% set base_guest_fs_size = guestfs_size | default(512) %}
{% set qemu_guest_fs_driveid = guestfs_driveid | default('lavatest') %}
{# see https://packages.debian.org/buster/amd64/qemu-system-misc/filelist #}
{% set qemu_misc_architectures = [
'alpha', 'cris', 'lm32', 'm68k', 'microblaze', 'microblazeel',
'moxie', 'or32', 's390x', 'sh4', 'sh4eb', 'tricore', 'unicore32',
'xtensa', 'xtensaeb'] %}
available_architectures:
- arm64
- arm
- aarch64
- amd64
- x86_64
- hppa
- i386
- mips
- mipsel
- mips64
- mips64el
- nios2
- ppc
- ppc64
- ppc64le
- riscv32
- riscv64
- sparc
- sparc64
{% for arch in qemu_misc_architectures %}
- {{ arch }}
{% endfor %}
actions:
deploy:
connections:
serial:
methods:
nfs:
image:
parameters:
guest:
size: {{ base_guest_fs_size }} # in Mb
interface: {{ arch | qemu_guest_fs_interface(guestfs_interface) }}
driveid: {{ qemu_guest_fs_driveid }}
boot:
connections:
serial:
ssh:
methods:
minimal:
qemu:
{% block qemu_method %}
parameters:
command:
{# start arch command #}
{% if arch == 'arm64' or arch == 'aarch64' %}
qemu-system-aarch64
{% elif arch == 'arm' %}
qemu-system-arm
{% elif arch == 'amd64' or arch == 'x86_64' %}
qemu-system-x86_64
{% elif arch == 'hppa' %}
qemu-system-hppa
{% elif arch == 'i386' %}
qemu-system-i386
{% elif arch == 'mips' %}
qemu-system-mips
{% elif arch == 'mipsel' %}
qemu-system-mipsel
{% elif arch == 'mips64' %}
qemu-system-mips64
{% elif arch == 'nios2' %}
qemu-system-nios2
{% elif arch == 'ppc' %}
qemu-system-ppc
{% elif arch == 'ppc64' %}
qemu-system-ppc64
{% elif arch == 'riscv64' %}
qemu-system-riscv64
{% elif arch == 'sparc' %}
qemu-system-sparc
{% elif arch == 'sparc64' %}
qemu-system-sparc64
{% else %}
{# binary comes from the qemu-system-misc package #}
qemu-system-{{ arch }}
{% endif %}
{# end arch command #}
# used by installers to relate to the empty target device
boot_options:
{# start arch root #}
{% if arch == 'arm64' or arch == 'aarch64' %}
{root: '{{ boot_root|default("/dev/vda2") }} rw rootwait', console: {{ boot_console|default('ttyAMA0 115200') }}, ip: dhcp, mem: 1024M}
{% elif arch == 'arm' %}
{% elif arch == 'amd64' %}
{root: {{ boot_root|default('/dev/sda1') }},
console: '{{ boot_console|default('ttyS0,115200') }}',
boot_order: c}
{% else %}
{root: {{ boot_root|default('/dev/sda1') }}, console: {{ boot_console|default('ttyS0,115200') }}}
{% endif %}
{# end arch root #}
options:
{% block qemu_options %}
{# arch cpu #}
{% if arch == 'hppa' %}
- -machine {{ machine|default('hppa') }}
{% endif %}
{% if arch == 'm68k' %}
- -machine {{ machine|default('mcf5208evb') }}
{% endif %}
{% if arch == 'mips' %}
- -machine {{ machine|default('malta') }}
{% endif %}
{% if arch == 'mips64' %}
- -machine {{ machine|default('malta') }}
{% endif %}
{% if arch == 'nios2' %}
- -machine {{ machine|default('10m50-ghrd') }}
{% endif %}
{% if arch == 'ppc' %}
- -machine {{ machine|default('g3beige') }}
{% endif %}
{% if arch == 'ppc64' %}
- -machine {{ machine|default('pseries') }}
{% endif %}
{% if arch == 'riscv64' %}
- -machine {{ machine|default('virt') }}
- -cpu {{ cpu|default('rv64') }}
{% endif %}
{% if arch == 'sparc' %}
- -machine {{ machine|default('SS-5') }}
{% endif %}
{% if arch == 'sparc64' %}
- -machine {{ machine|default('sun4u') }}
{% endif %}
{% if arch == 'xtensa' %}
- -machine {{ machine|default('sim') }}
{% endif %}
{% if arch == 'i386' %}
- -cpu {{ cpu|default('core2duo') }}
- -machine {{ machine|default('pc') }}
{% endif %}
{% if arch == 'arm64' or arch == 'aarch64' or arch == 'arm' %}
- -cpu {{ cpu|default('cortex-a57') }}
- -machine {{ machine|default('virt') }}
{# arch cpu + vga #}
{% if vga %}
- {{ vga }}
{% endif %}
{# arch cpu #}
{# arch cpu + serial #}
{% if serial %}
- {{ serial }}
{% endif %}
{# arch cpu #}
{% else %}
{# not arch cpu #}
{% if not no_kvm %}
- -cpu host
- -enable-kvm
{% endif %}
{# end no_kvm #}
{% endif %}
{# end arch cpu #}
- -nographic
{% if no_network is defined and no_network is sameas true %}
- -net none
{% else %}
- -net nic,{{ model|default('model=virtio') }},macaddr={{ mac_addr|default('52:54:00:12:34:58') }} -net {{ netdevice|default('user') }}
{% endif %}
{# end no_network #}
- -m {{ memory|default(512) }}
- -monitor {{ monitor|default('none') }}
{# If you need to pass -soundhw in extra_options, then see doc/v2/qemu_options.rst for how to set the environment var QEMU_AUDIO_DRV=none #}
{% if extra_options %}
extra: {{ extra_options }}
{% endif %}
{% endblock qemu_options -%}
{% endblock qemu_method %}
qemu-nfs:
{{ self.qemu_method() }}
append:
console: {{ console_device|default('ttyAMA0') }}
root: /dev/nfs
nfsrootargs: {{ base_nfsroot_args }}
ipargs: {{ base_ip_args }}
test:
methods:
docker:
# Docker-shell additional command-line options. Can be given as
# a list here, or additional options can be taken from device
# dict vars below (which in turn can be not defined (== null),
# a string, or an inline list of strings).
global_options:
- {{ docker_shell_global_arguments }}
options:
- {{ docker_shell_extra_arguments }}
{% endblock body %}
hostname: 'qemu-01'
devicetype: 'qemu'
constants:
# POSIX os (not AOSP)
posix:
lava_test_sh_cmd: /bin/sh
lava_test_results_dir: /lava-%s
lava_test_shell_file: ~/.bashrc
# bootloader specific
barebox:
interrupt-prompt: 'Hit m for menu or any other key to stop autoboot'
interrupt-character: '
'
final-message: 'Starting kernel'
error-messages:
- '### ERROR ### Please RESET the board ###'
- 'ERROR: .*'
- '.*: Out of memory'
u-boot:
interrupt-prompt: 'Hit any key to stop autoboot'
interrupt-character: ' '
interrupt_ctrl_list: []
interrupt-newline: True
final-message: 'Starting kernel'
error-messages:
- 'Resetting CPU'
- 'Must RESET board to recover'
- 'TIMEOUT'
- 'Retry count exceeded'
- 'Retry time exceeded; starting again'
- 'The remote end did not respond in time.'
- 'File not found'
- 'Bad Linux ARM64 Image magic!'
- 'Wrong Ramdisk Image Format'
- 'Ramdisk image is corrupt or invalid'
- 'ERROR: Failed to allocate'
- 'TFTP error: trying to overwrite reserved memory'
- 'Bad Linux RISCV Image magic!'
- 'Wrong Image Format for boot'
- 'ERROR: Did not find a cmdline Flattened Device Tree'
- 'ERROR: RD image overlaps OS image'
- 'kernel_comp_addr_r or kernel_comp_size is not provided'
- 'zimage: Bad magic'
dfu-download: 'DOWNLOAD \.\.\. OK\r\nCtrl\+C to exit \.\.\.'
grub:
interrupt-prompt: 'for a command-line'
interrupt-character: 'c'
interrupt-newline: False
error-messages:
- "error: missing (.*) symbol."
- "error: couldn't send network packet"
- "error: destination unreachable"
- "error: couldn't autoconfigure"
- "error: timeout reading"
- "error: you need to load the kernel first."
- "error: file '(.*)' not found"
- "error: no such device"
- "error: disk '(.*)' not found"
- "error: unknown filesystem"
grub-efi:
interrupt-prompt: 'for a command-line'
interrupt-character: 'c'
error-messages:
- 'Undefined OpCode Exception PC at'
- 'Synchronous Exception at'
- "error: missing (.*) symbol."
- "error: couldn't send network packet"
- "error: destination unreachable"
- "error: couldn't autoconfigure"
- "error: timeout reading"
- "error: you need to load the kernel first."
- "error: file '(.*)' not found"
- "error: no such device"
- "error: disk '(.*)' not found"
- "error: unknown filesystem"
ipxe:
interrupt-prompt: 'Press Ctrl-B for the iPXE command line'
interrupt_ctrl_list: ['b']
error-messages:
- 'No configuration methods succeeded'
- 'Connection timed out'
depthcharge:
final-message: 'Starting kernel'
error-messages:
- 'Tftp failed.'
- 'Dhcp release failed.'
- 'No space left for ramdisk'
- 'TFTP failed for ramdisk.'
- 'Dhcp release failed.'
- 'Out of space adding TFTP server IP to the command line.'
- 'No network device.'
- 'Error code \d+( \([\w\s]+\))?\r\n'
# OS shutdown message
# Override: set as the shutdown-message parameter of an Action.
# SHUTDOWN_MESSAGE
shutdown-message: 'The system is going down for reboot NOW'
# Kernel starting message
kernel-start-message: 'Linux version [0-9]'
# Default shell prompt for AutoLogin
# DEFAULT_SHELL_PROMPT
default-shell-prompt: 'lava-test: # '
# pexpect.spawn maxread
# SPAWN_MAXREAD - in bytes, quoted as a string
# 1 to turn off buffering, pexpect default is 2000
# maximum may be limited by platform issues to 4092
# avoid setting searchwindowsize:
# Data before searchwindowsize point is preserved, but not searched.
spawn_maxread: '4092'
# Set the failure retry to default or override it
failure_retry: 1
# Override boot_retry
boot_retry:
parameters:
# device_ip or device_mac
pass: # sata_uuid_sd_uuid_usb_uuid
available_architectures:
- arm64
- arm
- aarch64
- amd64
- x86_64
- hppa
- i386
- mips
- mipsel
- mips64
- mips64el
- nios2
- ppc
- ppc64
- ppc64le
- riscv32
- riscv64
- sparc
- sparc64
- alpha
- cris
- lm32
- m68k
- microblaze
- microblazeel
- moxie
- or32
- s390x
- sh4
- sh4eb
- tricore
- unicore32
- xtensa
- xtensaeb
actions:
deploy:
connections:
serial:
methods:
nfs:
image:
parameters:
guest:
size: 512 # in Mb
interface: virtio
driveid: lavatest
boot:
connections:
serial:
ssh:
methods:
minimal:
qemu:
parameters:
command:
qemu-system-
# used by installers to relate to the empty target device
boot_options:
{root: /dev/sda1, console: ttyS0,115200}
options:
- -cpu host
- -enable-kvm
- -nographic
- -net nic,model=virtio,macaddr=52:54:00:12:34:58 -net user
- -m 512
- -monitor none
qemu-nfs:
parameters:
command:
qemu-system-
# used by installers to relate to the empty target device
boot_options:
{root: /dev/sda1, console: ttyS0,115200}
options:
- -cpu host
- -enable-kvm
- -nographic
- -net nic,model=virtio,macaddr=52:54:00:12:34:58 -net user
- -m 512
- -monitor none
append:
console: ttyAMA0
root: /dev/nfs
nfsrootargs: nfsroot={NFS_SERVER_IP}:{NFSROOTFS},tcp,hard
ipargs: ip=dhcp
test:
methods:
docker:
# Docker-shell additional command-line options. Can be given as
# a list here, or additional options can be taken from device
# dict vars below (which in turn can be not defined (== null),
# a string, or an inline list of strings).
global_options:
-
options:
-
timeouts:
actions:
apply-overlay-image:
minutes: 2
dd-image:
minutes: 10
download-retry:
minutes: 15
http-download:
minutes: 5
lava-test-shell:
minutes: 3
nfs-deploy:
minutes: 10
power-off:
seconds: 10
bootloader-commands:
minutes: 3
bootloader-interrupt:
seconds: 30
u-boot-interrupt:
seconds: 30
umount-retry:
seconds: 45
auto-login-action:
minutes: 2
bootloader-action:
minutes: 3
uboot-action:
minutes: 3
uboot-commands:
minutes: 3
bootloader-retry:
minutes: 3
boot-qemu-image:
minutes: 2
boot-image-retry:
minutes: 2
flash-uboot-ums:
minutes: 20
musca-deploy:
minutes: 3
musca-boot:
minutes: 1
unmount-musca-usbmsd:
seconds: 30
pdu-reboot:
seconds: 30
reset-device:
seconds: 30
connections:
dd-image:
minutes: 10
uboot-commands:
seconds: 30
bootloader-commands:
seconds: 30
auto-login-action:
minutes: 2
bootloader-interrupt:
seconds: 30
u-boot-interrupt:
seconds: 30
lava-test-shell:
seconds: 10
lava-docker-test-shell:
seconds: 10
Rendered with the default values (no device dictionary), using LAVA's own template environment.