Integration of Mender to reTerminal

Board description

reTerminal is powered by a Raspberry Pi Compute Module 4 (CM4) which is a Quad-Core Cortex-A72 CPU running at 1.5GHz and a 5-inch IPS capacitive multi-touch screen with a resolution of 1280 x 720. It has sufficient amount of RAM (4GB) to perform multitasking and also has sufficient amount of eMMC storage (32GB) to install an operating system, enabling fast boot up times and smooth overall experience. It has wireless connectivity with dual-band 2.4GHz/5GHz Wi-Fi and Bluetooth 5.0 BLE.

reTerminal consists of a high-speed expansion interface and rich I/O for more expandability. This device has security features such as a cryptographic co-processor with secure hardware-based key storage. It also has built-in modules such as an accelerometer, light sensor and an RTC (Real-Time Clock). reTerminal has a Gigabit Ethernet Port for faster network connections and also has dual USB 2.0 Type-A ports. The 40-pin Raspberry Pi compatible header on the reTerminal opens it for a wide range of IoT applications.

reTerminal is shipped with Raspberry Pi OS out-of-the-box. So, all you have to do is connect it to power and start building your IoT, HMI and Edge AI applications right away!

Where to buy: https://www.seeedstudio.com/ReTerminal-with-CM4-p-4904.html

Wiki: Getting Started - Seeed Wiki

Test results

The Yocto Project releases in the table below have been tested by the Mender community. Please update it if you have tested this integration on other Yocto Project releases:

Yocto Project Build Runtime
dunfell (3.1 / 5.3.0) :test_works: :test_works:

Build Means that the Yocto Project build using this Mender integration completes without errors and outputs images.
Runtime Means that Mender has been verified to work on the board. For U-Boot-based boards, the integration checklist has been verified

Prerequisites

  • A supported Linux distribution and dependencies installed on your workstation/laptop as described in the Yocto Mega Manual

    • NOTE. Instructions depend on which Yocto version you intend to use.
  • reTerminal

Configuring the build

Setup Yocto environment

Create a directory for your mender-reterminal setup to live in and clone the meta information.

mkdir mender-reterminal && cd mender-reterminal

Get all of the necessary layers:

git clone -b master git://git.yoctoproject.org/poky layers/poky
git clone -b dunfell https://github.com/Seeed-Studio/meta-seeed-cm4.git layers/meta-seeed-cm4
git clone -b master git://git.yoctoproject.org/meta-raspberrypi layers/meta-raspberrypi
git clone -b dunfell https://github.com/meta-qt5/meta-qt5.git layers/meta-qt5
git clone -b dunfell https://github.com/openembedded/meta-openembedded.git layers/meta-openembedded
git clone -b dunfell git://github.com/mendersoftware/meta-mender layers/meta-mender

In order to be compatible with meta-raspberrypi, change the gstreamer version of poky to the latest

cd layers/poky
cp -r meta/recipes-multimedia/gstreamer/ ../
git checkout dunfell
rm -r meta/recipes-multimedia/gstreamer/
cp -r ../gstreamer/ meta/recipes-multimedia/
rm -r ../gstreamer/

Modify the meta-raspberrypi to avoid compile error

cd layers/meta-raspberrypi
rm dynamic-layers/meta-python/recipes-connectivity/lirc/*.bbappend
sed -i '/^LAYERSERIES_COMPAT_raspberrypi/s/= .*$/= "honister dunfell"/g' conf/layer.conf
sed -i 's/arm\/armv8a\///g' conf/machine/raspberrypi4-64.conf

Modify the meta-mender to avoid compile error

cd layers/meta-mender
rm meta-mender-raspberrypi/recipes-kernel/linux/linux-raspberrypi-rt_%.bbappend
sed -i 's/"0x4000"/"0x1f000"/g' meta-mender-raspberrypi/recipes-bsp/u-boot/u-boot-raspberrypi.inc
sed -i 's/bootfiles/rpi-bootfiles/g' meta-mender-core/classes/mender-part-images.bbclass

Modify the meta-seeed-cm4 to avoid compile error

cd layers/meta-seeed-cm4
sed -i 's/eudev/udev/g' recipes-lvgl/lvgl/lvgl_demo_git.bb

Setup build environment

Initialize the build environment:

source layers/poky/oe-init-build-env

Add yocto project layers:

bitbake-layers add-layer ../layers/meta-raspberrypi
bitbake-layers add-layer ../layers/meta-seeed-cm4
bitbake-layers add-layer ../layers/meta-qt5
bitbake-layers add-layer ../layers/meta-openembedded/meta-oe
bitbake-layers add-layer ../layers/meta-openembedded/meta-python
bitbake-layers add-layer ../layers/meta-mender/meta-mender-core
bitbake-layers add-layer ../layers/meta-mender/meta-mender-raspberrypi
bitbake-layers add-layer ../layers/meta-mender/meta-mender-demo

Configure Mender server URL (optional)

This section is not required for a successful build but images that are generated by default are only suitable for usage with the Mender client in Standalone deployments, due to lack of server configuration.

You can edit the conf/local.conf file to provide your Mender server configuration, ensuring the generated images and Mender Artifacts are connecting to the Mender server that you are using. There should already be a commented section in the generated conf/local.conf file and you can simply uncomment the relevant configuration options and assign appropriate values to them.

Build for Hosted Mender:

# To get your tenant token:
#    - log in to https://hosted.mender.io
#    - click your email at the top right and then "My organization"
#    - press the "COPY TO CLIPBOARD"
#    - assign content of clipboard to MENDER_TENANT_TOKEN
#
MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "<copy token here>"

Build for Mender Demo Server:

# https://docs.mender.io/administration/demo-installation
#
MENDER_DEMO_HOST_IP_ADDRESS = "<IP address of Mender demo server>"

Build for Mender Production/ Self-Hosted (on-prem):

# https://docs.mender.io/3.1/system-updates-yocto-project/build-for-production
#
# Uncomment below and update the URL to match your configured domain
# name and provide the path to the generated server.crt file.
#
# Note that a custom server.crt file is only necessary if you are using
# self-signed certificates.
#
# NOTE! It is recommend that you provide below information in your custom
# Yocto layer and this is only for demo purposes. See linked documentation
# for additional information.
MENDER_SERVER_URL = "<URL of Self-Hosted Mender Server>"
FILESEXTRAPATHS_prepend_pn-mender-client := "<DIRECTORY-CONTAINING-server.crt>:"
SRC_URI_append_pn-mender-client = " file://server.crt"

Building the image

You can now proceed with building an image:

MACHINE="seeed-reterminal-mender" bitbake rpi-test-image

Replace rpi-test-image with your desired image target.

Using the build output

After a successful build, the images and build artifacts are:

  • build/tmp/deploy/images/seeed-reterminal-mender/rpi-test-image-seeed-reterminal-mender.sdimg.bz2

if you already have Mender running on your device and want to deploy a rootfs update using this build, you should use the Mender Artifact files, which have .mender suffix. You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client only in Standalone deployments.

Flash instructions

Please follow this wiki guide to learn about flashing the above image to the eMMC on the reTerminal.

Once flashed, when you turn on the reTerminal, it will boot from the compiled image.

Boot success

If you see the following log from UART, that means the system has successfully booted

[  OK  ] Started Kernel Logging Service.
[  OK  ] Started System Logging Service.
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Getty on tty1.
         Starting Telephony service...
[  OK  ] Started Serial Getty on ttyS0.
[  OK  ] Reached target Login Prompts.
[    7.340436] audit: type=1334 audit(1638186061.687:4): prog-id=7 op=LOAD
[    7.347278] audit: type=1334 audit(1638186061.691:5): prog-id=8 op=LOAD
         Starting Login Service...
[  OK  ] Started Save/Restore Sound Card State.
[    7.386306] Bluetooth: Core ver 2.22
[    7.390103] NET: Registered protocol family 31
[    7.394856] Bluetooth: HCI device and connection manager initialized
[[    7.401967] Bluetooth: HCI socket layer initialized
  OK      7.407591] Bluetooth: L2CAP socket layer initialized
0m] Reac[    7.413409] Bluetooth: SCO socket layer initialized
hed target Sound Card.
[  OK  ] Started Telephony service.
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
[  OK  ] Started Login Service.
Poky (Yocto Project Reference Distro) 3.1.12 seeed-reterminal-mender ttyS0
seeed-reterminal-mender login: root
root@seeed-reterminal-mender:~#

Resources


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!

2 Likes

Hi, thank you for the precious informations displayed in your post, I tried to follow exactly the instructions and found the following error after trying to build my image :

ERROR: ParseError at /home/***/mender-reterminal-tuto/layers/poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-python_1.20.2.bb:30: Could not inherit file classes/setuptools3-base.bbclass

I also tried to go back to old repositories from around December 2021 and after some tries, I finally managed to build an image but it seems to me that current repositories could have some issues.

HI, I added the misssing setuptools3-base.bbclass from the head version of poky. after this I ran into an error stating missing bb files for rpi-bootfiles.bbappend so I renamed the bootfiles.bb in bootfiles.bbappend in meta-seed in order for them to be compatibles. Unfortuntely I now run into an error

ERROR: Nothing RPROVIDES 'linux-firmware-rpidistro-bcm43455' (but /home/jprobst/TUTO_PROPRES/mender-reterminal/layers/poky/meta/recipes-core/packagegroups/packagegroup-base.bb, /home/jprobst/TUTO_PROPRES/mender-reterminal/layers/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'linux-firmware-rpidistro-bcm43455' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['linux-firmware-rpidistro-bcm43455']
NOTE: Runtime target 'packagegroup-base-extended' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['packagegroup-base-extended', 'linux-firmware-rpidistro-bcm43455']
ERROR: Required build target 'rpi-test-image' has no buildable providers.
Missing or unbuildable dependency chain was: ['rpi-test-image', 'packagegroup-base-extended', 'linux-firmware-rpidistro-bcm43455']

One solution I found was cloning meta-raspberrypi from kirkstone instead of main in the first steps of your tutorial @lakshanthad and then it compiled but I am now stuck in the boot when I burn the reTerminal with this image so something must be missing… I posted elsewhere giving the bootlogs that I am able to access to via UART: Stuck in Starting kernel after adding mender to an image for ReTerminal made with Yocto