How to deploy wic image on Raspberry Pi in LAVA

How to deploy wic image on Raspberry Pi in LAVA

This topic documents the steps required for wic image deployment on RPi in LAVA.

RPi supports to boot from USB if available, otherwise boot from SD card. With this boot order, secondary image deployment method in LAVA can be used to deploy wic image to RPi SD card using USB boot device as primary media.

Here is the sequence of the pipeline.

  1. Switch on USB boot device.
  2. Boot the primary OS from USB boot device.
  3. Under the primary OS, deploy wic image to SD card.
  4. Switch off USB boot device.
  5. Reset to boot from SD card with new deployed wic image for testing.

Prepare RPi for secondary image deployment

Follow How to Boot Raspberry Pi 4 / 400 From a USB SSD or Flash Drive to prepare RPi board. Boot the board from USB device. Make sure the OS installed on USB device meets the following requirements.

  • bmap-tools is installed.
  • root user enabled with password `root’.
    P.S. User and passwd for auto login can be adjusted in LAVA job definition.
  • Host name set to rpi-primary.
    P.S. Prompt root@rpi-primary:~# for auto login can be adjusted in LAVA job definition.

Insert SD card to Raspberry Pi. wic image will be deployed to the SD card. Connect USB boot device via USB switching equipment to the RPI as well. Here are the options for switching USB device on/off.

Connect the board to LAVA worker

Follow RPi Serial Connection to connect the board to LAVA worker via USB to TTL adapter.

Add LAVA Configurations

Add serial adapter to ser2net.conf

Edit ser2net configuration to add serial adapter for the RPi board. Here is an example. Adjust port and serial device ID as needed.

7003:telnet:0:/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0NGN83-if00-port0:115200 8DATABITS NONE 1STOPBIT LOCAL

Restart ser2net service.

Add device dictionary to LAVA server

Add device dictionary file /etc/lava-server/dispatcher-config/devices/rpi4-01.jinja2 . Here is an example. Adjust the configs as needed.

{% extends 'bcm2711-rpi-4-b.jinja2' %}

{% set connection_command = 'telnet localhost 7003' %}

{% set hard_reset_command = '/root/tools/ -c CH2 -s reboot' %}
{% set power_off_command = '/root/tools/ -c CH2 -s off' %}
{% set power_on_command = '/root/tools/ -c CH2 -s on' %}

{% set pre_power_command = ['echo Power on ssd drive', '/root/tools/ -c CH1 -s on'] %}
{% set pre_os_command = ['echo Power off ssd drive', '/root/tools/ -c CH1 -s off'] %}

{% set usb_label = 'mmc' %}
{% set usb_uuid = 'mmc-SE16G_0x5005f990' %}

{% set sync_to_lava = {'device_type': 'rpi4', 'worker': '', 'tags': ['rpi4-01']} %}

If you are adding device to OSTC LAVA instance, send the above device dictionary to LAVA Config. It will be deployed automatically once merged to master branch.

Test your device in LAVA

Submit a LAVA job to test if wic image deployment works. LAVA job example LAVA | Scheduler | Jobs | 2854 | Definition

1 Like