The first standard QEMU job uses a fully built image containing a root filesystem (rootfs), kernel, initramfs, modules and configuration. QEMU also supports booting a kernel and an initramfs with or without a root filesystem. Testing such jobs in LAVA involves adding the overlay (containing the LAVA test shell helpers and the test shell definition created by the test writer) as an additional drive. This avoids needing to modify the initramfs or root filesystem provided by the test writer but does have some requirements, depending on the type of test job.
This example will show how to boot an arm64 Debian kernel and initramfs in LAVA.
The initramfs needs to include all kernel modules which are needed to run the tests required by the test writer. The Debian initramfs includes modules automatically. There is no support for adding modules to the initramfs for QEMU in LAVA.
device_type: qemu
job_name: qemu arm64 ramdisk
timeouts:
job:
minutes: 15
action:
minutes: 5
connection:
minutes: 3
priority: medium
visibility: public
Download / view qemu-kernel-standard-sid.yaml.
Note
This example uses the Debian kernel which is a modular build. When modifying the standard qemu test jobs, always keep the builds of the kernel and initramfs in sync or provide a replacement kernel with all necessary modules built in.
context: arch: arm64 machine: virt cpu: cortex-a57 extra_options: - -smp - 1
The job context for this example specifies the default machine
and
cpu
values for the arm64
architecture using the qemu
template. (The
arm64
architecture can also be specified as aarch64
with this
template.)
The extra_options
list can contain any option which is understood by QEMU.
The name of the option and the value of that option should be listed as
separate items in the extra_options
list for correct parsing by QEMU.
Test writers can choose which QEMU options are specified as extra_options
and which as image_args
. In some situations, this can matter as some
options to QEMU need to be in a specific order. extra_options
are added to
the command line before image_args
and image_args
are added in the
order specified in the test job.
Note
Check the syntax carefully - the option is -smp so the line in
extra_options
uses a hyphen to continue the list in YAML, then a space,
then the option which itself starts with a hyphen.
actions: - deploy: timeout: minutes: 5 to: tmpfs images: kernel: image_arg: -kernel {kernel} --append 'root=/dev/ram0 rw rootwait rootdelay=5 console=ttyAMA0,38400n8 init=/sbin/init' url: http://snapshots.linaro.org/components/lava/standard/debian/sid/arm64/2/vmlinuz-4.6.0-1-arm64 sha256sum: 714e9669883f4705f3358d11a61cd601e4c938006cbfef0f785a65f3f8f74896 initrd: image_arg: -initrd {initrd} url: http://snapshots.linaro.org/components/lava/standard/debian/sid/arm64/2/initrd.img-4.6.0-1-arm64 sha256sum: 4fb2e63d796729e03b6c5ed3f8e5c0ee2ffe94ea5ded800c508d53c303591972 os: oe
Deploying a kernel and initramfs without a root filesystem can be done using
the image_args
support. In this example, the kernel command line is built
using the --append
option to QEMU.
The example also uses the sha256sum
checksum support to ensure that the
correct files are downloaded.
Caution
The initramfs in this test job comes from a Debian build,
however the initramfs itself is not a full Debian system. In
particular, it uses busybox
for the shell and various utilities like
mount
. To handle this, the deployment must specify the operating
system as oe
so that LAVA can operate within the initramfs using only
minimal tools.
- boot: method: qemu media: tmpfs timeout: minutes: 2 prompts: - '\(initramfs\)'
As this system will boot into the initramfs, the '\(initramfs\)'
prompt is
specified.
This example will show how to boot an arm64 Debian kernel and initramfs with a root filesystem (as a drive) in LAVA.
The initramfs will need enough kernel modules to be able to mount the specified rootfs. The rest of the kernel modules should be present inside the rootfs.
The standard builds use Debian kernels and the initramfs generated inside a Debian chroot when the kernel package is installed. The relevant kernel modules are retained within the rootfs.
device_type: qemu
job_name: qemu arm64 ramdisk rootfs
timeouts:
job:
minutes: 15
action:
minutes: 5
connection:
minutes: 3
priority: medium
visibility: public
Download / view qemu-kernel-rootfs-standard-sid.yaml.
Note
When modifying the standard qemu test jobs, always keep the builds of the kernel, initramfs and rootfs in sync or provide a replacement kernel with all necessary modules built in.
context: arch: arm64 machine: virt cpu: cortex-a57 extra_options: - -smp - 1
The job context for this example specifies the default machine
and
cpu
values for the arm64
architecture using the qemu
template. (The
arm64
architecture can also be specified as aarch64
with this
template.)
The extra_options
list can contain any option which is understood by QEMU.
The name of the option and the value of that option should be listed as
separate items in the extra_options
list for correct parsing by QEMU.
actions: - deploy: timeout: minutes: 5 to: tmpfs images: kernel: image_arg: -kernel {kernel} --append 'root=UUID=e04326af-8715-4c00-bb0a-d9547d8d7512 rw rootwait rootdelay=5 console=ttyAMA0,38400n8 init=/sbin/init' url: http://snapshots.linaro.org/components/lava/standard/debian/sid/arm64/2/vmlinuz-4.6.0-1-arm64 sha256sum: 714e9669883f4705f3358d11a61cd601e4c938006cbfef0f785a65f3f8f74896 initrd: image_arg: -initrd {initrd} url: http://snapshots.linaro.org/components/lava/standard/debian/sid/arm64/2/initrd.img-4.6.0-1-arm64 sha256sum: 4fb2e63d796729e03b6c5ed3f8e5c0ee2ffe94ea5ded800c508d53c303591972 rootfs: image_arg: -drive if=none,id=image,file={rootfs},format=raw,media=disk -device virtio-blk-device,drive=image url: file:///home/neil/code/lava/pipeline/git/local/sid-arm64.img sha256sum: b8ede0942edb716011532b614521a437c2e330728d7829d017a76d08ad5e8b74 os: debian
Deploying a kernel and initramfs with a root filesystem can be done using the
image_args
support. In this example, the kernel command line is built using
the --append
option to QEMU.
Caution
The append
option explicitly specifies the UUID of the
partition where the kernel will be able to find the specified init
.
Avoid using /dev/vda1
or similar because LAVA needs to add an extra
drive containing the test shell helpers and definitions and the kernel can
enumerate the drives differently on consecutive boots, causing the test job
to fail unpredictably. Ensure you specify the checksums of the rootfs so
that the UUID is correct for the downloaded file.
When using checksums, avoid URLs including shortcuts like
latest
. Specify the full URL to ensure consistency between tests.
Note
The initramfs in this test job is used to mount the root filesystem
which is a standard Debian build. The deployment can therefore specify the
operating system as debian
so that LAVA can operate within the root
filesystem using Debian tools and the bash
shell.
- boot: method: qemu media: tmpfs timeout: minutes: 2 auto_login: login_prompt: "login:" username: root prompts: - 'root@sid:' - test: timeout: minutes: 5 definitions: - from: inline repository: metadata: format: Lava-Test Test Definition 1.0 name: smoke-tests-basic description: "Basic system test command for Linaro Ubuntu images" run: steps: - ifconfig -a - mount - ls -l /dev/ name: env-dut-inline path: inline/env-dut.yaml - from: git repository: git://git.linaro.org/qa/test-definitions.git path: ubuntu/smoke-tests-basic.yaml name: smoke-tests - from: git repository: http://git.linaro.org/lava-team/lava-functional-tests.git path: lava-test-shell/single-node/singlenode01.yaml name: singlenode-basic
As this system will boot into the provided root filesystem, the 'root@sid:'
prompt is specified and the auto_login
details of the root filesystem are
specified.