- Notifications
You must be signed in to change notification settings - Fork12
Debian tool chain and image generation for Raspberry Pi 2, 3, 4 and 5.
License
lueschem/edi-pi
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Debian tool chain and image generation for the Raspberry Pi 2, 3, 4 and 5.
Note
Themaster branch isexperimental and currently based on Debiantrixie.To get the stable Debianbookworm configuration please check out thedebian_bookworm branch.
The edi configuration contained in this repository can be used togenerate the following artifacts:
- A Debian trixie arm64 (64bit) image suitable for the Raspberry Pi 3, 4 or 5.
- A Debian trixie armhf (32bit) image suitable for the Raspberry Pi 2.
- Matching Mender update artifacts for the above configurations.
- A Podman/Docker image with a pre-installed cross development toolchains (armhf/arm64) for C and C++.
Prior to using this edi project configuration you have to installedi according tothis instructions.Please take a careful look at the "Setting up ssh Keys" section since youwill need a proper ssh key setup in order to access thethe target device using ssh.
The artifact generation requires some additional tools. OnUbuntu 24.04 and newer those tools can be installed as follows:
sudo apt install buildah containers-storage crun curl distrobox dosfstools e2fsprogs fakeroot genimage git mender-artifact mmdebstrap mtools parted python3-sphinx python3-testinfra podman rsync zerofree
The edi-pi project configuration contained in this git repository can be cloned as follows:
mkdir -p~/edi-workspace/&&cd~/edi-workspace/git clone --recursive https://github.com/lueschem/edi-pi.git
The following steps assume that you are located within the project configuration directory:
cd~/edi-workspace/edi-pi/
If the repository has already been cloned earlier, do not forget to update the submodules:
git submodule update --init
To enable over the air (OTA) updates, the generated images are configuredto connect tohttps://hosted.mender.io/.In order to connect to your Mender tenant you have to provide your tenant token prior to building the images.The tenant token can be added toconfiguration/mender/mender.yml
. If you do not want toadd the tenant token to the version control system you can also copyconfiguration/mender/mender.yml
toconfiguration/mender/mender_custom.yml
and add the tenant token there.
A Raspberry Pi image can be created using the following command:
For Raspberry Pi 5, arm64:
edi -v project make pi5.yml
For Raspberry Pi 5, arm64, prepared for GitOps (git and Ansible preinstalled):
edi -v project make pi5-gitops.yml
For Raspberry Pi 4, arm64:
edi -v project make pi4.yml
For Raspberry Pi 4, arm64, prepared for GitOps (git and Ansible preinstalled):
edi -v project make pi4-gitops.yml
For Raspberry Pi 3, arm64:
edi -v project make pi3.yml
For Raspberry Pi 2, armhf:
edi -v project make pi2.yml
The resulting image can be copied to a SD card (here /dev/mmcblk0)using the following command(Please note that everything on the SD card will be erased!):
Example for Raspberry Pi 5, arm64:
sudo umount /dev/mmcblk0p?sudo dd if=artifacts/pi5.img of=/dev/mmcblk0 bs=4M conv=fsync status=progress
Once you have booted the Raspberry Pi using this SD card you canaccess it using ssh (the access should be granted thanks to yourssh keys):
ssh pi@IP_ADDRESS
The password for the userpi israspberry (just in case you want toexecute a command usingsudo
or login via a local terminal).
A Podman image of a cross development container can be created using thefollowing command:
edi -v project make pi-cross-dev.yml
distrobox can be used to transform the image into a convenient development container:
source artifacts/pi-cross-dev_manifestdistrobox create --image${podman_image} --name SOME_CONTAINER_NAME --init --unshare-all --additional-packages"systemd libpam-systemd"
For all the development work the container can be entered as follows:
distrobox enter SOME_CONTAINER_NAME
You can directly start to cross compile applications:
For the Raspberry Pi 3, 4 or 5, arm64:
aarch64-linux-gnu-g++ ...
For the Raspberry Pi 2, armhf:
arm-linux-gnueabihf-g++
During the image build the documentation gets rendered to artifacts/CONFIGNAME_documentationas reStructuredText. The text files can be transformed into a nice pdf file with someadditional tools that need to be installed first:
sudo apt install texlive-latex-recommended texlive-pictures texlive-latex-extra texlive-xetex latexmk
Then the pdf can be generated using the following commands:
cd artifacts/CONFIGNAME_documentationmake PDFLATEX=xelatex latexpdfmake PDFLATEX=xelatex latexpdf
For more information about this setup please read theedi documentation andthis blog post.
For details about the Mender based robust update integration please refer to thisblog post.
If you are curious about the U-Boot bootloader setup please take a look at thisblog post.
For the kernel build instructions related to the Raspberry Pi 4 and 5 please checkthis blog post.
The WiFi setup isdocumented here.
A GitOps example can be foundhere.