Introduction
The setup described below uses the tool edi and the configuration edi-pi to generate the following artifacts on a Ubuntu 18.04 host machine:
- A pure Debian stretch arm64 (64bit) image suitable for the Raspberry Pi 3.
- A pure Debian stretch armhf (32bit) image suitable for the Raspberry Pi 2 or 3.
- Matching Mender update artifacts for the above configurations.
Building the Artifacts
Preparation
Prior to using the edi-pi configuration you have to install edi according to this instructions. Please take a careful look at the “Setting up ssh Keys” section since you will need a proper ssh key setup in order to access the Rasperry Pi using ssh.
The image processing steps require some additional tools. On Ubuntu 18.04 those tools can be installed as follows:
sudo apt install e2fsprogs dosfstools bmap-tools mtools parted
To generate the Mender update artifact, the mender-artifact tool is required. Unfortunately it did not make it into the Ubuntu Bionic apt repositories. Luckily this package comes with a small number of dependencies and therefore it is without risk to download it from Debian and install it on Ubuntu Bionic:
sudo dpkg -i mender-artifact*.deb
Now you can clone the edi-pi
project configuration repository from GitHub:
git clone https://github.com/lueschem/edi-pi.git
cd edi-pi
Mender Configuration
To get connected to your tenant you have to add your tenant token to your image build:
vi configuration/mender/mender.yml
Please enter your tenant token like this:
mender_tenant_token: YOURTENANTTOKENRETRIEVEDFROMHOSTEDMENDER
Creating the Artifacts
A Raspberry Pi image and a Mender update artifact can be created using the following command:
For Raspberry Pi 3, arm64:
sudo edi -v image create pi3-stretch-arm64.yml
For Raspberry Pi 2 or 3, armhf:
sudo edi -v image create pi23-stretch-armhf.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!):
For Raspberry Pi 3, arm64:
sudo bmaptool copy artifacts/pi3-stretch-arm64.img /dev/mmcblk0
For Raspberry Pi 2 or 3, armhf:
sudo bmaptool copy artifacts/pi23-stretch-armhf.img /dev/mmcblk0
If the command fails, unmount the flash card and repeat the above command.
Once you have booted the Raspberry Pi using this SD card you can access it using ssh (the access should be granted thanks to to your ssh keys):
ssh pi@IP_ADDRESS
The password for the user pi is raspberry (just in case you want to execute a command using sudo
or login via a local terminal).
The Mender update artifacts can be found in the same artifacts
folder like the the full images.
More Information
For more information please read the edi documentation and this blog post.
For more details about the Mender integration please refer to this blog post.
If you are curious about the U-Boot bootloader setup please take a look at this blog post.
If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!