Introduction
The Mender Client 4.0 is a full rewrite in C++. This brings a number of benefits, such as
- increased portability
- reduced resource consumption
- no additional language dependencies
You can find more details in the announcement: Mender to rewrite client using C++ and retain Go for its backend
This short tutorial will show you how to select it in a Yocto-based Linux distribution build.
Version notes
The tutorial has been verified on Debian 11, as of 2024-04-26
This tutorial uses kirkstone as the primary target, which is the current LTS release by the Yocto Project. You can find more infomation on releases here. Supported releases for following the tutorial are:
Yocto Project | Tutorial applies | Maintenance |
---|---|---|
scarthgap (5.0) | development | |
nanbield (4.3) | current stable | |
mickledore (4.2) | EOL | |
langdale (4.1) | EOL | |
kirkstone (4.0) | LTS | |
honister (3.4) | EOL | |
hardknott (3.3) | EOL | |
gatesgarth (3.2) | EOL | |
dunfell (3.1) | EOL | |
zeus (3.0) | EOL | |
warrior (2.7) | EOL | |
thud (2.6) | EOL | |
sumo (2.5) | EOL | |
rocko (2.4) | EOL |
Please note: a failure in the “tutorial applies” column indicates that the instructions do not work without modification. Depending on the combination of release and host Linux distribution, installing other python versions or dependencies might provide a functional state.
Prerequisites
To follow this tutorial, you will need:
- A prepared build setup We will be using an exisiting Yocto Project build setup. As the example for the instructions, the setup as described on the Mender Hub is used.
- An initialized shell The commands assume that the shell has been initialized for the build setup, which is usually done by invoking
source poky/oe-init-build-env
. Given the linked setup, we start in theyocto
directory
The meta-mender-core
layer
The meta-mender-core
layer is the main entry point to use the Yocto integration of Mender. Its concepts and details are described in the documentation. The following steps will show a generic setup of Mender with with Client 4.0 in a Yocto build without incorporating a specific board integration. For such, please refer to the respective article.
Getting the layer
Clone the repository into the sources directory. We are checking out the kirkstone
branch here, adapt in case you are using a different release.
cd sources
git clone https://github.com/mendersoftware/meta-mender -b kirkstone
cd ..
Adding the layer
Change into the build directory:
cd build
Then add the Mender core integration layer, and check the layer listing:
bitbake-layer add-layer ../sources/meta-mender/meta-mender-core
bitbake-layer show-layers
Enabling Mender
systemd
The standard Mender setup requires systemd
. This is a distribution wide setting, so it should be set in the DISTRO
configuration file. If you do not have a custom distro yet, you can add it to your local.conf
:
INIT_MANAGER = "systemd"
Enabling the Mender integration
Mender relies on a number of system and distribution wide settings being in effect, such as:
- the A/B partitioning
- the Client being installed
- required settings being injected into the resulting image, specifically the
device_type
IMAGE_FSTYPES
being set accordingly.
The recommended way to do this is by enabling the mender-full
class. Just as with systemd
, this should be set on the distribution level, or local.conf
:
INHERIT += "mender-full"
Note: if you are targetting a UBIFS-based image, set INHERIT += "mender-full-ubi"
instead
Depending on your target board, you can adjust several features through the MENDER_FEATURES_ENABLE
and MENDER_FEATURES_DISABLE
variables. Please check the documentation for more details.
Select Mender Client 4.0
Depending on the release you are on, Mender Client 4.0 might not be selected as the default. By setting the following configuration variables, you can switch to 4.0:
PREFERRED_VERSION_mender = "4.0.4"
PREFERRED_PROVIDER_mender-native = "mender-native"
PREFERRED_RPROVIDER_mender-auth = "mender"
PREFERRED_RPROVIDER_mender-update = "mender"
If you have custom scripts that rely on invoking the mender
command, you must revisit them to match the following change:
mender-auth
provides thebootstrap
functionalitymender-update
provides thecheck-update
,commit
,install
,rollback
,send-inventory
,show-artifact
andshow-provides
functionalities
For migrating mender daemon
, mender setup
and mender snapshot
, please consult the migration guide.
Building
The Mender integration works independent of the image to be built. So you can use an already existing image recipe, like
bitbake core-image-minimal
Conclusion
The Mender Client 4.0 can be easily brought into an existing Yocto build by adjusting the local respectively distribution configuration. Additional changes might be required in situations where custom scripting is being used.
If this tutorial 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!