LAS16-108: JerryScript and other scripting languages for IoT
LAS16-TR05 - Getting Started in LAVA V2s3.amazonaws.com/connect.linaro.org/las16... · Any LAVA...
Transcript of LAS16-TR05 - Getting Started in LAVA V2s3.amazonaws.com/connect.linaro.org/las16... · Any LAVA...
LAS16-TR05 - Getting Started in LAVA V2Bill Fletcher - Linaro
RevB
ENGINEERS AND DEVICES
WORKING TOGETHER
Overview● Brief intro to LAVA and installing it
● Single instance LAVA V2 configuration
● Virtual and physical targets
● Boot test examples
● Starting point to leverage the awesomeness of LAVA V2
ENGINEERS AND DEVICES
WORKING TOGETHER
More about this session● The slide deck has a lot of detail
● I don’t propose to go line-by-line through configuration files
here
● All referenced files are at:
http://people.linaro.org/~bill.fletcher/
LAVA Pipeline Device templates, Job files, images
● Kind of a meta-tutorial in the session
● It’s an invitation to have a go
ENGINEERS AND DEVICES
WORKING TOGETHER
About LAVA● The Linaro Automated Validation Architecture
● An automation system for deploying kernel, dtb and rootfs
onto physical and virtual hardware for running tests
● Very scalable
● More details at https://validation.linaro.org/static/docs/v2/
● LAVA V2 is the latest LAVA
ENGINEERS AND DEVICES
WORKING TOGETHER
Invitations to interrupt● Any LAVA folks feel free to pitch in
● Questions & comments welcome
ENGINEERS AND DEVICESWORKING TOGETHER
Getting Started - Installing● See the installation walk-through video https://youtu.be/GDOgtzd0dDs
● LAVA is a Debian package
● Work with supported Debian versions Jessie, Stretch, (Sid)
● lava package - everything you need for a single instance
● apt-get installs latest packaged release
● Find it under /usr/lib/python2.7
● Jessie - need to enable backports and use
apt-get -t jessie-backports install lava
● Known not to work on Ubuntu Trusty 14.04 due to dependencies issues
ENGINEERS AND DEVICESWORKING TOGETHER
Basic Elements of LAVA (Single Instance)
Web interface● Reports results● Shows device and job status● Manages object creation and
permissions
lava tool● command line job submission
and diagnostics
LAVA V2
lava server CLI
Server-scheduler● Handles job submission and
scheduling● Combines (renders) the target
information and test job description
Dispatcher● Executes the test job actions● Manages communication to the
target device● Collects the job results
TargetTest Images
ENGINEERS AND DEVICESWORKING TOGETHER
Basic Elements of LAVA (Distributed Instances)
Web interface● Reports results● Shows device and job status● Manages object creation and
permissions● Manages which target device
instance is on which worker
lava tool● Command line job submission
and diagnostics
lava server CLIDispatcher
● Executes the test job actions● Manages communication to the
target device● Collects the job results
slave daemon
ZMQ[Master]
[Remote workers]
Server-scheduler● Handles job submission and
scheduling● Combines (renders) the target
information and test job description
master daemon
LAVA V2
ENGINEERS AND DEVICESWORKING TOGETHER
The Pipeline Model● A test job is a pipeline of actions -
Deploy, Boot & Test
● The pipeline structure of each job is
explicit
● All pipeline steps are validated at
submission
● Can review the final yaml rendering
of the pipeline actions for
consistency which will be
dispatched
ENGINEERS AND DEVICESWORKING TOGETHER
A Simplified Example Pipeline of Test Actions1. deploy
1.1. download initramfs, kernel, dtb
1.2. apply LAVA test shell scripts to ramdisk
2. boot
2.1. interrupt bootloader and send commands
3. test
ENGINEERS AND DEVICESWORKING TOGETHER
yaml v2 job file - BBBdevice_type: beaglebone-blackjob_name: Pipeline boot BBB lamp rootfs
[timeouts,priority, visibility blocks omitted][no context block required] actions:- deploy: timeout: minutes: 4 to: tftp kernel: url: file:///home/billf/lava/uboot/zImage nfsrootfs: url: file:///home/billf/lava/uboot/linaro-image-lamp-genericarmv7a-20150323-328.rootfs.tar.gz compression: gz os: debian dtb: url: file:///home/billf/lava/uboot/am335x-boneblack.dtb
- boot: method: u-boot commands: nfs type: bootz auto_login: login_prompt: 'login:' username: root prompts: - 'root@jessie:' timeout: minutes: 2 failure_retry: 2
ENGINEERS AND DEVICES
WORKING TOGETHER
Target Configuration
● Hard-coded LAVA behaviour
● Behaviour common to many device types
● Behaviour common to a particular type of device
● Specifics for an individual device
● Some aspect that needs to be specified on a per-job basis
ENGINEERS AND DEVICESWORKING TOGETHER
Chain of Target Configuration
base templatefile
device-type templatefile
job file variables
hardcoded LAVA behaviour device
instance specifics (dictionary entry)
rendered yaml output
is extended by
is extended by
is extended by
to dispatcher
ENGINEERS AND DEVICESWORKING TOGETHER
Target Configuration (detail)
base template(all devices)
device-type template
job file context: variablehardcoded
LAVA behaviour
device dictionary entry
rendered yaml
templates/etc/lava-server/dispatcher-config/device-types
is extended by
is extended by is
extended by
to dispatcher
rendered by server/master
common command descriptions across all devices
● uboot ● uefi ● ssh
device-type specifics
● 32 or 64-bit ● load
addresses● prompts
things which are device instance specific
things which are job specific
Composite of device type and device instance definitions
visible via XML RPC API using e.g. lava-tool
ENGINEERS AND DEVICESWORKING TOGETHER
Representing a Pipeline-enabled target device
Web interface
lava tool add/update device
retire device
LAVA V2
Device Dictionary
Device type templates
lava server CLI
add deviceDevice
dictionary entry
Device administration
Information on Pipeline-enabled Devices resides in the Device Dictionary
ENGINEERS AND DEVICESWORKING TOGETHER
Worked example - qemu aarch64 ● device type and instance creation walk-through video
https://youtu.be/eEQwhP12U8w
● Configuration files at http://people.linaro.org/~bill.fletcher/
● Install qemu apt-get install qemu-system
● qemu device-type file - this is still evolving but try mine available above
● create qemu device instance in device dictionary lava-server manage device-dictionary ...
● also create qemu device type and instance in the web interface
CAVEAT: deploy/boot example worksfurther support is work-in-progress
ENGINEERS AND DEVICESWORKING TOGETHER
aarch64 qemuBuilding the target command line
$ /usr/bin/qemu-system-aarch64 -nographic -machine virt -cpu cortex-a57 -smp 1 -m 2048 -global virtio-blk-device.scsi=off -device virtio-scsi-device,id=scsi -kernel /tmp/tmpQi2ZR3/Image --append "console=ttyAMA0 root=/dev/vda rw" -drive format=raw,file=/tmp/tmpQi2ZR3/ubuntu-core-14.04.1-core-arm64-ext4.img -drive format=qcow2,file=/tmp/tmpMgsuvB/lava-guest.qcow2,media=disk
Colours - where each option comes from (at the moment):
device type template (qemu.jinja2) qemu01 device dictionary entry
job definition file - context section job definition file - action entry
LAVA hardwired
ENGINEERS AND DEVICESWORKING TOGETHER
arm64 qemu configuration
base template
qemu device type template
job file context: variablehardcoded
LAVA behaviour
qemu01 device dictionary entry
rendered yaml
device-type templates/etc/lava-server/dispatcher-config/device-types
to dispatcher(no entries relevant
to qemu)
command line optionswith conditionals for differentarchitectures
device dictionary entry -set memory = 2048set mac_addr = ...
context: arch: arm64
ENGINEERS AND DEVICESWORKING TOGETHER
yaml v2 job file - qemu-aarch64device_type: qemujob_name: Pipeline boot qemu-arm64 Ubuntutimeouts: job: minutes: 15 action: minutes: 5priority: mediumvisibility: public
context: arch: arm64
actions: - deploy: timeout: minutes: 5 to: tmpfs images: kernel: image_arg: -kernel {kernel} --append "console=ttyAMA0 root=/dev/vda rw" url: file:///home/billf/lava/qemu/Image rootfs: image_arg: -drive format=raw,file={rootfs} url: file:///home/billf/lava/qemu/ubuntu-core-14.04.1-core-arm64-ext4.img.gz compression: gz os: debian root_partition: 1
- boot: method: qemu
job file context: variable
ENGINEERS AND DEVICESWORKING TOGETHER
Submitting the job file● Authentication walk-through video https://youtu.be/OaAdipbmyzs
● LAVA has a mechanism for user authentication
● Generate an authentication token via the web interface
● (note that you need to generate the authentication token logged in to the local
web interface as yourself)
● lava-tool auth-add http://bill@localhost
● Submit test job files to LAVA via the command line using lava-tool● lava-tool submit-job http://bill@localhost
/home/bill/development/lava/aarch64_qemu_job.yaml
ENGINEERS AND DEVICES
WORKING TOGETHER
Physical Device ConfigurationRequirements:
● An uninterrupted serial console connection
● A way to put the system in a known state and reboot
● A way to transfer the boot image to the target
i.e. serial, power control and network
ENGINEERS AND DEVICESWORKING TOGETHER
Serial Console and NetworkSerial
● ser2net package will be installed automatically. In /etc/ser2net.conf add
something like: 2000:telnet:0:/dev/tty.beaglebone:115200 8DATABITS NONE 1STOPBIT banner
● The serial connection info is obviously specific to a device instance - hence they
appear in the device dictionary entry
Network
● The dispatcher can rely on TFTP downloads. LAVA installs tftp-hpa and
modifies the configuration file for the default tftp image root directory
● The device templates assume dhcp, so if necessary e.g.
sudo apt-get install isc-dhcp-server
ENGINEERS AND DEVICESWORKING TOGETHER
Power Control and Rebooting the Board● PDU = Power Distribution Unit
“A way to put the system in a known state and
reboot the board”
● Power cycle the board under software control
● pdudaemon is one framework that LAVA
provides to manage PDUs
● Reset controls are obviously specific to a device
instance - hence they appear in the device
dictionary entry
● Dictionary entry: e.g. hard_reset_command =
● Simple desktop PDU
https://youtu.be/bZng6attqV0
ENGINEERS AND DEVICESWORKING TOGETHER
Example: BBB configuration
job file context: variablehardcoded
LAVA behaviour
device dictionary entry
rendered yaml
device-type templates/etc/lava-server/dispatcher-config/device-types
to dispatcher
Behaviour and commands specific to Beaglebone Black e.g. load addresses
device dictionary entry -instance-specific serial connection and power control(see next slide)
context: (none)
Cross platform bootloader command defaults
base template(all devices)
beaglebone-black type template
ENGINEERS AND DEVICESWORKING TOGETHER
BBB Device Dictionary Entry{% extends 'beaglebone-black.jinja2' %}{% set connection_command = 'telnet localhost 2096' %}{% set power_off_command = '/usr/bin/pduclient --daemon=localhost --hostname=127.0.0.1 --port=4 --command=reboot' %}{% set hard_reset_command = '/usr/bin/pduclient --daemon=localhost --hostname=127.0.0.1 --port=4 --command=reboot' %}{% set power_on_command = '/usr/bin/pduclient --daemon=localhost --hostname=127.0.0.1 --port=4 --command=reboot' %}
Import this (in a file - bbb01.jinja2) with:$ lava-server manage device-dictionary --hostname bbb01 --import /etc/dispatcher-config/devices/bbb01.jinja2
ENGINEERS AND DEVICES
WORKING TOGETHER
A quick demo
ENGINEERS AND DEVICES
WORKING TOGETHER
Getting started in LAVA V2 - Summary
aarch64 qemu
● Example boots under LAVA control, but WIP for further use
● Location of command line options within the templates/job
context is evolving
Beaglebone-Black
● Out-of-box V2 experience with BBB - it pretty much just
worked
● It’s worth noting that device templates are less hackable
(by design) in V2
ENGINEERS AND DEVICESWORKING TOGETHER
“Pipeline Edition” Overview
Targetserial,tftp/nfspower control
Web interface
lava tool add/update device
retire device
LAVA V2
Device Dictionary
Device type templates
Job Definition
PDU
submissionlava server CLI
add device TFTP
Test Images
Server Schedulerjob
images
Pipeline Dispatcher
target specificjob definition results
target info
Device dictionary entry
User Keyring
authentication token
results
jobs
NFS
Device administration
View results
ser2net
ENGINEERS AND DEVICES
WORKING TOGETHER
Resources● Configuration files at: http://people.linaro.org/~bill.fletcher/
● LAVA installation walk-through
https://youtu.be/GDOgtzd0dDs
● Pipeline device type and instance creation walk-through
https://youtu.be/eEQwhP12U8w
● Authentication walk-through
https://youtu.be/OaAdipbmyzs
● Building a simple desktop PDU
https://youtu.be/bZng6attqV0
Thank You
#LAS16For further information: www.linaro.org
LAS16 keynotes and videos on: connect.linaro.org