forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 22
Setting up a Raspberry Pi as a Jenkins Agent
Jamie Smith edited this page Jul 13, 2022
·
16 revisions
This guide will walk you through setting up a Raspberry Pi (or another Linux machine) as a Jenkins agent for Mbed CE
sudo apt-get install aptitude
sudo aptitude install gcc-arm-none-eabi gdb-multiarch cmake ninja-build openocd
sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb # Raspbian does not have arm-none-eabi-gdb directly, you have to use it through multiarch
Note: Mbed needs at least CMake 3.19, if you don't have that version or a newer one in your package manager you will need to compile it from source instead.
From here: https://www.gdcorner.com/2019/12/27/JenkinsHomeLab-P2-LinuxAgents.html
sudo aptitude install default-jre
sudo adduser jenkins # and then follow the prompts, can set the password to "jenkins"
sudo su jenkins
mkdir ~/.ssh
nano ~/.ssh/authorized_keys # paste the jenkins agent SSH public key into this file
You can now add the RPi in Jenkins via Manage Nodes and Clouds > New Node
- Remote Root Directory: /home/jenkins
- Labels:
<all Mbed targets connected to this node, separated by spaces>
- Launch Method: Launch via SSH
- Host:
<IP address of node>
- Credentials:
<use the Jenkins node key>
- Host Key Verification Strategy: Manually Trusted
After clicking OK on this screen, the node should be available for use!
- Get serial number of Mbed device from its tty:
udevadm info -a -n /dev/ttyACMxxx | grep '{serial}' | head -n1
- Create a file
/etc/udev/rules.d/99-usb-serial.rules
with contents like:
SUBSYSTEM=="tty", ATTRS{serial}=="<serial number>", SYMLINK+="tty<mbed board>", OWNER="jenkins"
where <mbed board>
and <serial number>
are replaced by the mbed name and serial number.
- Reload udev:
sudo udevadm control --reload-rules
sudo udevadm trigger
- Create a folder matching the Mbed target name and link the serial port in the location that the build job expects:
sudo mkdir -p /mbed/<target name>
sudo ln -s /dev/tty<target name> /mbed/<target name>/tty
- If using ST-LINK devices, you'll also need the udev rules from here: https://github.com/stlink-org/stlink/tree/develop/config/udev/rules.d