Build server setup documentation

The auto build server is the cheapest available Ubuntu 22.04 instance at Vultr.com. I followed these instructions, but substitute arm-gcc 10.3, which is what is included with the PICO SDK installer. These notes are so I can do it a bit faster next time…

Install git

sudo add-apt-repository -y ppa:git-core/ppa
sudo apt install -y git
git --version

Install CMake

sudo wget -qO /etc/apt/trusted.gpg.d/kitware-key.asc https://apt.kitware.com/keys/kitware-archive-latest.asc
echo "deb https://apt.kitware.com/ubuntu/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/kitware.list
sudo apt update
sudo apt install -y cmake
cmake --version

Install gcc-arm

curl -Lo gcc-arm-none-eabi.tar.bz2 "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2"
sudo mkdir /opt/gcc-arm-none-eabi
sudo tar xf gcc-arm-none-eabi.tar.bz2 --strip-components=1 -C /opt/gcc-arm-none-eabi
echo 'export PATH=$PATH:/opt/gcc-arm-none-eabi/bin' | sudo tee -a /etc/profile.d/gcc-arm-none-eabi.sh
source /etc/profile
arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
rm -rf gcc-arm-none-eabi.tar.bz2

Install pico sdk

sudo git clone https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk
sudo git -C /opt/pico-sdk submodule update --init
echo 'export PICO_SDK_PATH=/opt/pico-sdk' | sudo tee -a /etc/profile.d/pico-sdk.sh
source /etc/profile.d/pico-sdk.sh

Install BP5

sudo git clone https://github.com/DangerousPrototypes/BusPirate5-firmware.git bp5-main
cd bp5-main
mkdir build
cd build
cmake ..
make

Install build script and webhook

cd ~
md webhook
pip install virtualenv
apt install python3.10-venv
python3.10 -m venv env
sudo apt install build-essential libssl-dev libffi-dev python3-dev
source env/bin/activate
pip3 install flask 
pip3 install github_webhook
pip3 install requests
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo apt-get install iptables-persistent
screen
python3 webhook.py  
2 Likes

Latest build server setup, condensed for less copy and paste. Maybe it should be a shell script…

Install git


sudo add-apt-repository -y ppa:git-core/ppa && sudo apt install -y git && git --version

Install CMake


sudo wget -qO /etc/apt/trusted.gpg.d/kitware-key.asc https://apt.kitware.com/keys/kitware-archive-latest.asc && echo "deb https://apt.kitware.com/ubuntu/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/kitware.list && sudo apt update && sudo apt install -y cmake && cmake --version

Install gcc-arm


curl -Lo gcc-arm-none-eabi.tar.bz2 "https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2" && sudo mkdir /opt/gcc-arm-none-eabi && sudo tar xf gcc-arm-none-eabi.tar.bz2 --strip-components=1 -C /opt/gcc-arm-none-eabi

echo 'export PATH=$PATH:/opt/gcc-arm-none-eabi/bin' | sudo tee -a /etc/profile.d/gcc-arm-none-eabi.sh && source /etc/profile && arm-none-eabi-gcc --version && arm-none-eabi-g++ --version && rm -rf gcc-arm-none-eabi.tar.bz2

Install pico sdk


sudo git clone https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk && sudo git -C /opt/pico-sdk submodule update --init

echo 'export PICO_SDK_PATH=/opt/pico-sdk' | sudo tee -a /etc/profile.d/pico-sdk.sh

source /etc/profile.d/pico-sdk.sh

Install BP5


sudo git clone https://github.com/DangerousPrototypes/BusPirate5-firmware.git bp5-main && cd bp5-main &&mkdir build && cd build && cmake .. && make

Install build script and webhook


cd ~ && mkdir webhook && pip install virtualenv && pip install argparse && pip install python-dotenv && apt install python3.10-venv && python3.10 -m venv env && sudo apt install build-essential libssl-dev libffi-dev python3-dev && source env/bin/activate && pip3 install flask && pip3 install github_webhook && pip3 install requests && sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT && sudo apt-get install iptables-persistent

screen

python3 webhook.py

Exit screen:  Ctrl+A and then D

Here is the webhook we’re using to build all four Bus Pirate firmwares, package them and post them to this Discourse forum.

webhook.zip (3.8 KB)

python webhook --test

Optional test argument forces it to run a task instead of starting the webhook listener

  • A task is one repo branch
  • Tasks have 1 or more builds that compile firmware and produce one or more outputs
  • Builds have one or more make commands, and support %%GIT_COMMIT_HASH%% as a tag that is replaced by the current git short hash
  • Outputs have an optional zip_file_location property that shoves the _rev8 firmware into a folder called attic
  • Outputs are packaged with log files, and then posted to a discourse thread
  • API username, key and URL should be stored in a .env file (see sample.env)
  • If the git_pull_dir directory doesn’t exist, the script will attempt to clone and switch to the git_branch specified. This is so adding new branches is faster/automated.

It also has the dead simple class that posts new pull requests in the forum.

1 Like