Why?
Due to us building three ‘the same’ robots, we don’t only have to align the components used and their assembly, but also the software that we run. If on every robot tests would be done installing different Python libraries on the Raspberry Pi, we might have unpredictable side effects when running the same code, due to differences in the installed software.
So, to ensure running really the same code, we decided to maintain bespoke DRT SD card images, containing the operating system and all other software, except for the configuration and code maintained in our git repository. Loading a specific DRT image version on an SD card, followed by cloning a specific git commit of our repository to it, should result in the exact same Raspberry Pi configuration every time.
How?
We’ve chosen not to create our images from an existing SD card, but to use the pi-gen tool. Although in hindside it would probably have been more sensible to just clone pi-gen and modify it, we made a ‘wrapper’ with only our configuration and a script that loads the pi-gen code, replaces the standard build configuration with our own and just runs pi-gen.
The secrets used in our configuration are managed using KeePassXC and stored in KDBX 4 format.
Current secrets stored:
- Default username and password for our image.
- The credentials for the wifi networks often used by the team members.
A DRT image can be written to an SD card using the Raspberry Pi Imager, with optionally using the advanced options.
What?
We use the standard first four stages of pi-gen to generate the Normal Raspberry Pi OS image.
The standard stage 5 is replaced by our own stage 5 to take care of the specific DRT packages and configuration, like:
- enabling SSH access
- enabling VNC Server
- enabling RDP Server
- Git Cola
- Thonny
- OpenCV
- Numpy
- Matplotlib
- python_json_config
- pupil-apriltags
- wifi networks used by team members
Resources
Tool used to create the official Raspberry Pi OS images | |
DRT pi-gen wrapper with bespoke configuration | |
Introduction to Raspberry Pi Imager | https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility/ |
No comments:
Post a Comment