This project generates and customizes a Raspberry Pi image, either for Ubuntu or Raspberry Pi OS. The script is build for running within a docker container.
The customizations include:
- Generating or adding a
vaultkey.secret
file - Updating Ansible configuration in
/boot/firmware/riasc.yaml
- Updating cloud-init file in
/boot/firmware/user-data
- Setting GIT Ansible repor in
/boot/firmware/riasc.yaml
- Adding and enabling GIT based Ansible updates on reboot
- Switch to direcory with Dockerfile to build image
docker build --tag "imagebuilder" .
- Create
env
file:
GIT_URL=https://mygiturl
FLAVOR=ubuntu22.04
GIT_BRANCH=mybranch
NODENAME=myhost
TAG=test
- Run docker container to generate image
docker run \
--volume ./:/tmp/riasc \
--volume ./out/:/tmp/data \
--env-file ./env \
imagebuilder
- Image is placed in ´out/output´ folder
- Copy image to SD card. Either using dd or the Raspberry Pi Imiger
Variable | Info |
---|---|
GIT_URL | URL to ansible git repository |
FLAVOR | Falvor of os. See list of flavors |
GIT_BRANCH | Branch used in ansible git pull |
NODENAME | The hostname of the device |
TAG | A tag that is added to the name |
RAW_OUTPOUT | Set to yes to get the .img file as output |
TOKEN | A token used by Ansible |
VAULT_KEY | Key to use in the vaultkey.secret file |
ubuntu24.04
ubuntu22.04
ubuntu20.04
raspios
Check for the partitions in the image file:
fdisk -lu ubuntu-22.04.4-preinstalled-server-arm64+raspi.img
Run mount command. Make sure to update the offset (526336) for the correct value
mount ubuntu-22.04.4-preinstalled-server-arm64+raspi.img -o loop,offset=$(( 512 * 526336)) /mnt/
To use a custom secret the VAULT_KEY variable can be set. If a vaultkey file of the name NODENAME-vaultkey.secret already exists the variable will be ignored.
- Steffen Vogel 📧, Institute for Automation of Complex Power Systems, RWTH Aachen University
- Vincent Bareiß 📧, Institute for Automation of Complex Power Systems, RWTH Aachen University
- Manuel Pitz 📧, Institute for Automation of Complex Power Systems, RWTH Aachen University
The development of RIasC has been supported by the ERIGrid 2.0 project
of the H2020 Programme under Grant Agreement No. 870620