Raspberry Pi 4 - Debian bullseye - no U-Boot (edi)

Introduction

The setup described below uses the tool edi and the configuration edi-pi to generate the following artifacts on a Ubuntu or Debian host machine:

  • A Debian bullseye arm64 (64bit) image suitable for the Raspberry Pi 4.
  • A matching Mender update artifact for the above configuration.
  • An amd64/arm64 based LXD container with a pre-installed cross development toolchain for C and C++.

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 20.04 those tools can be installed as follows:

sudo apt install e2fsprogs dosfstools bmap-tools mtools parted rsync zerofree python3-sphinx mender-artifact

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:

sudo edi -v image create pi4-bullseye-arm64.yml

Please upgrade your Raspberry Pi 4 EEPROM prior to using the just created artifacts!

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!):

sudo bmaptool copy artifacts/pi4-bullseye-arm64.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 bootloader setup please take a look at this blog post.

Thanks Matthias,

I’m new to edi, and really interested in trying this.

My initial goal would be to build an mender-enabled arm64 image (for RPi4), ideally with dual-partition (A/B) booting; I’m currently using mender-convert, which doesn’t yet support arm64 (MEN-3663).

Q. Does your edi-pi example create a dual-partition image? (apologies I have not tried your method above yet)

Best regards,

Tom

Yes, exactly - edi-pi creates a minimal dual-rootfs image for the Pi 4. The image gets created from scratch and by modifying the configuration you can easily extend it according to your use case.

Sweet! Exciting times…and without needing to build a new arm64 uboot?

I am not an embedded systems engineer myself (for example, I don’t know Yocto Project), but it seems to me (having read your edi presentations about Debian, IoT, etc.) that mender and edi could be a great combination for people who want to get up and running quickly with Debian based projects. My “gold” systems are already provisioned with Ansible, so it sounds like that should be easy to inject via the edi plugins. :slight_smile:

So I look forward to diving into the edi configuration management in due course.

In the meantime, I just tried creating an image using the example in your post above (pi4-bullseye-arm64.yml) but it’s failing at the apt_setup task in the sample playbook:

...
TASK [apt_setup : Initialize apt.] *********************************************************************************************
fatal: [edi-tmp-e17f2af7ff11261d23bb]: FAILED! => {"changed": false, "cmd": ["apt-get", "update"], "delta": "0:03:05.605031", "end": "2021-11-30 16:55:10.615755", "msg": "non-zero return code", "rc": 100, "start": "2021-11-30 16:52:05.010724", "stderr": "E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/main/i18n/Translation-en  Connection timed out [IP: 199.232.138.132 80]\nE: Some index files failed to download. They have been ignored, or old ones used instead.", "stderr_lines": ["E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/main/i18n/Translation-en  Connection timed out [IP: 199.232.138.132 80]", "E: Some index files failed to download. They have been ignored, or old ones used instead."], "stdout": "Get:1 h...
...

I’m an edi newbie, so I don’t yet know how the Ansible playbooks are setup for the container; it seems like an apt cache problem. My host is Debian 11 (bullseye) on amd64.

Thanks again!

Could it be that Docker is crashing the party? See also failed to build due to python3-apt package missing · Issue #3 · lueschem/edi-var · GitHub