Skip to content

Setting Up a Mbed Build Runner

Jamie Smith edited this page Jan 6, 2025 · 1 revision

This page will go through the process of setting up an Ubuntu Linux machine as a runner for Mbed tests.

Basic Steps

  • Install basic packages:
$ sudo apt install cmake ninja-build build-essential git
$ sudo apt install libusb-1.0-0-dev libudev-dev # dependencies for USB tests
  • Clone mbed-os to ~/Mbed
  • Clone mbed-ce-test-tools to ~/Mbed
  • Do the toolchain setup and install any needed upload methods

Udev setup

Do the Linux USB setup page for each connected device.

Also add a new rules file specifically for the Mbed USB tests:

# Mbed OS USB Device test suite
ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0007", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0205", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0206", MODE="660", GROUP="plugdev", TAG+="uaccess"
ATTRS{idVendor}=="1f00" ATTRS{idProduct}=="2013", ENV{ID_MM_DEVICE_IGNORE}="1", MODE="660", GROUP="plugdev"
ATTRS{idVendor}=="1f00" ATTRS{idProduct}=="2012", ENV{ID_MM_DEVICE_IGNORE}="1", MODE="660", GROUP="plugdev"

Echo server setup

Now we need to set up the machine as an echo server for the network tests. This is easy for the non-encrypted connections but gets a bit harder for the TLS tests...

Local DNS Server

First we need to set up this machine to act as a DNS server. This allows it to advertise itself as having a "domain name" that Mbed devices can access. It's also needed to make TLS certificates work.

$ sudo apt install bind9 dnsutils

Edit /etc/bind/named.conf.options:

Non-encrypted services

First install inetd:

$ sudo apt install inetutils-inetd

Now edit /etc/inetd.conf to have the following INTERNAL block (near the top):

#:INTERNAL: Internal services
discard     stream  tcp6    nowait  root    internal
discard     dgram   udp6    wait    root    internal
echo        stream  tcp6    nowait  root    internal
echo        dgram   udp6    wait    root    internal
chargen     stream  tcp6    nowait  root    internal
chargen     dgram   udp6    wait    root    internal
daytime     stream  tcp6    nowait  root    internal
time        stream  tcp6    nowait  root    internal

Then enable and start the service:

$ sudo systemctl enable --now inetutils-inetd.service

To test if it's working, you can send data to the echo port (port 7):

$ netcat -u localhost 7

Any text you type should be echoed back to you.

Let's Encrypt

$ sudo apt install python3-certbot