# Integration of Mender to Dual Gigabit Ethernet Carrier Board for RPi CM4

**URL:** <https://hub.mender.io/t/integration-of-mender-to-dual-gigabit-ethernet-carrier-board-for-rpi-cm4/4362>\
**Category:** Yocto Project\
**Tags:** yocto, raspberrypi-cm4\
**Created:** [December 1, 2021, 6:42am UTC](https://hub.mender.io/t/integration-of-mender-to-dual-gigabit-ethernet-carrier-board-for-rpi-cm4/4362 "2021-12-01T06:42:58Z")\
**Posts on this page:** 1\
**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:42am UTC](https://hub.mender.io/t/integration-of-mender-to-dual-gigabit-ethernet-carrier-board-for-rpi-cm4/4362/1 "2021-12-01T06:42:58Z")

</div>

# Board description

The Dual Gigabit Carrier Board powered by Raspberry Pi Compute Module 4 is equipped with dual Gigabit Ethernet ports and dual USB 3.0 ports, making it suitable for soft router applications, while keeping the hardware to a minimum. We have pre-installed a Raspberry Pi Compute Module 4 with 4GB RAM and 32GB eMMC to enable fast boot-up times and a smooth overall experience. You can also replace the installed CM4 with any other CM4 of your choice!

It features a variety of I/O peripherals such as MIPI CSI, MIPI DSI, micro-HDMI to connect displays/ cameras, a standard 9-pin USB 3.0 header for more USB expansion, a micro-SD card slot, and an FPC connector while maintaining a compact form factor! This board is ideal for HTPC makers, Linux developers, software router enthusiasts, and the majority of regular Raspberry Pi users.

![](https://files.seeedstudio.com/wiki/102110497/board%20pics/dual-gbe-cm4-thumb-1.png)

Where to buy: [Dual Gigabit Ethernet NICs CM4 Carrier Board for Raspberry Pi CM4 with 4GB RAM/ 32GB eMMC - Seeed Studio](https://www.seeedstudio.com/Dual-GbE-Carrier-Board-with-4GB-RAM-32GB-eMMC-RPi-CM-4-p-4898.html)

Wiki: [reRouter carrier board | Seeed Studio Wiki](https://wiki.seeedstudio.com/Dual-Gigabit-Ethernet-Carrier-Board-for-Raspberry-Pi-CM4)

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

- [Dual Gigabit Ethernet Carrier Board for RPi CM4](https://www.seeedstudio.com/Dual-GbE-Carrier-Board-with-4GB-RAM-32GB-eMMC-RPi-CM-4-p-4898.html)

# Configuring the build

## Setup Yocto environment

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

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

```

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/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

```

## 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-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="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](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/Dual-Gigabit-Ethernet-Carrier-Board-for-Raspberry-Pi-CM4/#flash-to-emmc-cm4-emmc-version) 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

```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 dual-gbe-cm4-mender ttyS0
dual-gbe-cm4-mender login: root
root@dual-gbe-cm4-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!_
