Skip to main content

Mender Usage

We can setup Mender Client on a Dual Gigabit Ethernet Carrier Board for Raspberry Pi Compute Module 4 and then receive OTA updates from a Hosted or Self-Hosted Mender Server.

This guide focuses on using a Dual Gigabit Ethernet Carrier Board for RPi CM4 running a custom Linux System compiled using the Yocto Project.

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 ProjectBuildRuntime
dunfell (3.1 / 5.3.0)test workstest 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

Configuring the build

Setup Yocto environment

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

mkdir mender-dual-gbe-cm4 && cd mender-dual-gbe-cm4

Get all of 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/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

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-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="dual-gbe-cm4-mender" bitbake core-image-base

Replace core-image-base with your desired image target.

Using the build output

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

  • build/tmp/deploy/images/dual-gbe-cm4-mender/core-image-base-dual-gbe-cm4-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 board.

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 dual-gbe-cm4-mender ttyS0

dual-gbe-cm4-mender login: root
root@dual-gbe-cm4-mender:~#

Resources

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...