# Integration of Mender to reTerminal

**URL:** <https://hub.mender.io/t/integration-of-mender-to-reterminal/4361>\
**Category:** Yocto Project\
**Tags:** yocto, raspberrypi-cm4\
**Created:** [December 1, 2021, 6:24am UTC](https://hub.mender.io/t/integration-of-mender-to-reterminal/4361 "2021-12-01T06:24:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lakshanthad](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lakshanthad/32/1403_2.png) [@lakshanthad](https://hub.mender.io/u/lakshanthad)\
**Post date:** [December 1, 2021, 6:24am UTC](https://hub.mender.io/t/integration-of-mender-to-reterminal/4361/1 "2021-12-01T06:24:31Z")

</div>

# 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!

![](https://files.seeedstudio.com/wiki/ReTerminal/wiki_thumb.png)

Where to buy: [reTerminal CM4104032 - AI, IoT, IIoT Human Machine Interface, All-in-one Board, Modular Design, RPi CM4 32GB powered, IPS multi-touch screen, 2.4GHz/5GHz Wi-Fi&nbsp;&&nbsp;Bluetooth&nbsp;5.0, rich interfaces - Seeed Studio](https://www.seeedstudio.com/ReTerminal-with-CM4-p-4904.html)

Wiki: [Getting Started with ODYSSEY - X86J41x5 | Seeed Studio Wiki](https://wiki.seeedstudio.com/ODYSSEY-X86J4105/)

# 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](https://wiki.yoctoproject.org/wiki/Releases?target=_blank):

| 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](https://docs.mender.io/devices/integrating-with-u-boot/integration-checklist?target=_blank) has been verified | | |

# Prerequisites

- A supported Linux distribution and dependencies installed on your workstation/laptop as described in the [Yocto Mega Manual](https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#detailed-supported-distros)

- [reTerminal](https://www.seeedstudio.com/ReTerminal-with-CM4-p-4904.html)

# Configuring the build

## Setup Yocto environment

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

```auto
mkdir mender-reterminal && cd mender-reterminal

```

Get all of the necessary layers:

```auto
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

```auto
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

```auto
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

```auto
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

```auto
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:

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

```

Add yocto project layers:

```auto
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](https://docs.mender.io/architecture/standalone-deployments?target=_blank), 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:

```auto
# 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:

```auto
# 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):

```auto
# 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:

```auto
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](https://docs.mender.io/architecture/mender-artifacts?target=_blank) 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](https://docs.mender.io/architecture/standalone-deployments?target=_blank).

# Flash instructions

Please follow [this wiki guide](https://wiki.seeedstudio.com/reTerminal/#flash-raspberry-pi-os-64-bit-ubuntu-os-or-other-os-to-emmc) 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

```auto
[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

- **[Web Page]** [Mender Official Documentation](https://docs.mender.io)
- **[Web Page]** [Yocto Official Documentation](https://docs.yoctoproject.org)
- **[Web Page]** [Raspberry Pi CM4 Official Documentation](https://www.raspberrypi.com/documentation/computers/compute-module.html)

* * *

_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!_

---

<div class="post-metadata">

**Author:** ![jepr](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jepr](https://hub.mender.io/u/jepr)\
**Post date:** [June 9, 2022, 10:14am UTC](https://hub.mender.io/t/integration-of-mender-to-reterminal/4361/2 "2022-06-09T10:14:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jepr](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jepr](https://hub.mender.io/u/jepr)\
**Post date:** [August 17, 2022, 2:26pm UTC](https://hub.mender.io/t/integration-of-mender-to-reterminal/4361/3 "2022-08-17T14:26:19Z")

</div>

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

```auto
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](https://hub.mender.io/t/stuck-in-starting-kernel-after-adding-mender-to-an-image-for-reterminal-made-with-yocto/5082)
