Device-Type enablementī
This guide will quickly explain how to enable a new Device-Type in LAVA using an LAA.
Hardware support
In this guide, we suppose that the LAA does provide the right hardware feature to automate the new device-type.
For example, the board can be powered by 1v8, 3v3, 5v or 12v or from USB PD.
Choosing the MIBī
Start by choosing the MIB that will allow to automate your new DUT.
Unless your Device-Type is already supported by an existing MIB, use the flylead MIB.
Connect the chosen MIB to the SIB using the SIB header.
Powering the DUTī
USB poweredī
If the DUT is powered via USB, connect the LAA USB port 1 to the right port on the DUT.
The DUT can now be powered-on and off using:
laacli usb 1 on
laacli usb 1 off
Power railsī
If the DUT can be powered via a pin or a jack port, connect the DUT pin to one of the power rails on the MIB.
The DUT can now be powered-on and off using:
laacli power <RAIL> on
laacli power <RAIL> off
Where RAIL would be 1v8
, 3v3
, 5v
or 12v
.
Serial consoleī
In order to interact with the DUT, LAVA will need to have access to the serial console.
Direct UARTī
Connect the UART to one of the available UARTs on the MIB or the sib-header
UART port
We advice you to use SIB_UART4
as this is already fully configured to be used
by LAVA with telnet localhost 2000
.
Serial over USBī
Connect the USB cable to the LAA USB port 2.
ser2net configurationī
Currently, the following serials are supported by the ser2net configuration:
Device |
Type |
Baud rate |
Port |
---|---|---|---|
/dev/ttymxc3 |
SIB_UART4 |
115200n81 |
2000 |
/dev/ttyUSB0 |
USB |
115200n81 |
2010 |
/dev/ttyUSB1 |
USB |
115200n81 |
2011 |
/dev/ttyACM0 |
USB |
115200n81 |
2020 |
/dev/ttyACM1 |
USB |
115200n81 |
2021 |
You can connect to the device using telnet localhost <PORT>
.
LAVA Supportī
If the above commands are enough to get the DUT to boot into the bootloader, then LAVA will be able to use your DUT to test the OS or user space applications.
You will need to write to jinja2 files:
device-type template: device-type generic information
device dictionary: DUT specific configuration
Device-type templateī
The device-type template is a jinja2 template that explains to LAVA the supported features for the device-type.
The list of upstream device-type is available in LAVA sources.
Depending on the bootloader on the DUT, the device-type template and the device dictionary will differt.
u-bootī
If using u-boot, the device-type template will look something like:
{# set device_type = "<DTB_NAME>" #}
{% extends 'base-uboot.jinja2' %}
{% set booti_kernel_addr = booti_kernel_addr|default('<BOOTI_KERNEL_ADDR>') %}
{% set booti_ramdisk_addr = booti_ramdisk_addr|default('<BOOTI_RAMDISK_ADDR>') %}
{% set booti_dtb_addr = booti_dtb_addr|default('<BOOTI_DTB_ADDR>') %}
{% set bootm_kernel_addr = bootm_kernel_addr|default('<BOOTM_KERNEL_ADDR>') %}
{% set bootm_ramdisk_addr = bootm_ramdisk_addr|default('<BOOTM_RAMDISK_ADDR>') %}
{% set bootm_dtb_addr = bootm_dtb_addr|default('<BOOTM_DTB_ADDR>') %}
{% set uboot_mkimage_arch = 'arm64' %}
{% set bootloader_prompt = bootloader_prompt|default('U-Boot>') %}
{% set console_device = console_device|default('ttyS1') %}
Adapting the template
Set the variables to the right values for your device-type.
Device-dictionaryī
The device dictionary is DUT specific and indicate to LAVA how to power on/off/reset the DUT or access the serial console. Based on the initial part of the guide, you should have the list of commands ready now.
{% extends '<DTB_NAME>.jinja2' %}
{% set hard_reset_command = [
'<LAACLI_POWER_OFF>',
'<LAACLI_POWER_ON>'
] %}
{% set power_off_command = [
'<LAACLI_POWER_OFF>'
] %}
{% set power_on_command = [
'<LAACLI_POWER_ON>'
] %}
{% set connection_command = 'telnet localhost <SERIAL_PORT>' %}
{% set usbg_ms_commands = {
'disable': ['laacli', 'usbg-ms', 'off'],
'enable': ['laacli', 'usbg-ms', 'on', '{IMAGE}']
} %}
{% set docker_shell_extra_arguments = [
'--volume=/usr/bin/laacli:/usr/bin/laacli:ro',
'--volume=/usr/bin/lsibcli:/usr/bin/lsibcli:ro',
'--volume=/run/dbus/system_bus_socket:/run/dbus/system_bus_socket:rw'
] %}
Recoveryī
Recovering from a bad firmware is not considered in the guide yet as this involved more complex setup.