Difference between revisions of "iMX8M Industrial Mender"

From Voipac Wiki
Jump to navigation Jump to search
Line 16: Line 16:
  
 
To prepare the machine, follow the [[iMX8M Industrial Yocto Prerequisites|Yocto Project Prerequisites]] Wiki page.
 
To prepare the machine, follow the [[iMX8M Industrial Yocto Prerequisites|Yocto Project Prerequisites]] Wiki page.
 +
 +
== Configuring the build ==
 +
=== Setup Yocto environment ===
 +
Set the Yocto Project branch to build for:
 +
<syntaxhighlight lang="bash">
 +
export BRANCH="dunfell"
 +
</syntaxhighlight>
 +
 +
Create a directory for the mender-<TARGET> setup to work and clone the meta information:
 +
<syntaxhighlight lang="bash">
 +
mkdir mender-<TARGET> && cd mender-<TARGET>
 +
</syntaxhighlight>
 +
 +
Initialize repo manifest:
 +
<syntaxhighlight lang="bash">
 +
repo init -u https://github.com/mendersoftware/meta-mender-community \
 +
          -m meta-mender-<TARGET>/scripts/manifest-<TARGET>.xml \
 +
          -b ${BRANCH}
 +
</syntaxhighlight>
 +
 +
Fetch layers in manifest:
 +
<syntaxhighlight lang="bash">
 +
repo sync
 +
</syntaxhighlight>
 +
 +
=== Setup build environment ===
 +
Initialize the build environment:
 +
<syntaxhighlight lang="bash">
 +
source setup-environment <TARGET>
 +
</syntaxhighlight>
 +
 +
'''''Note:''''' Accepting the Freescale EULA at ''…/sources/meta-freescale/EULA'' is required. Please read it and continue by accepting it in the ''local.conf'' file:
 +
<syntaxhighlight lang="bash">
 +
ACCEPT_FSL_EULA = "1"
 +
</syntaxhighlight>
 +
 +
== 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 [https://docs.mender.io/artifact-creation/standalone-deployment?target=_blank Standalone deployments], due to lack of server configuration.
 +
 +
Edit the ''conf/local.conf'' file to provide the Mender server configuration, ensuring the generated images and Mender Artifacts are connecting to the Mender server that are used. There should already be a commented section in the generated ''conf/local.conf'' file. Thus simply uncommenting the relevant configuration options and assigning appropriate values to them is sufficient.
 +
 +
Build for Hosted Mender:
 +
<syntaxhighlight lang="bash">
 +
# 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>"
 +
</syntaxhighlight>
 +
 +
== Building the image ==
 +
Everything was setup to proceed with building an image:
 +
<syntaxhighlight lang="bash">
 +
MACHINE=imx8mq-voipac bitbake core-image-base
 +
</syntaxhighlight>
 +
 +
Replace '''core-image-base''' with your desired image target.
 +
 +
== Using the build output ==
 +
After a successful build, the images and build artifacts are placed in ''tmp/deploy/images/imq8mq-voipac/''.
 +
 +
The disk image (with ''.sdimg.bz2'' suffix) is used to provision the storage for devices without Mender already running. Please proceed to the [https://docs.mender.io/system-updates-yocto-project/provisioning-a-new-device?target=_blank official documentation on provisioning a new device] for steps to do so.
 +
 +
On the other hand, if Mender has been running on the device and want to deploy a rootfs update using this build, the [https://docs.mender.io/system-updates-yocto-project/provisioning-a-new-device?target=_blank Mender Artifact] files, with ''.mender'' suffix, can be used instead. This Artifact can either be deployed in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client [https://docs.mender.io/artifact-creation/standalone-deployment standalone mode].
 +
 +
== Flashing instructions ==
 +
Follow the [[iMX8M Industrial Flashing Procedure|flashing procedure]] instructions for image flashing.

Revision as of 20:08, 9 December 2023

This Wiki page describes Mender OTA updater integration into the Yocto Project for the iMX8M Industrial Development Kit. Mender is a secure robust and industry leading software update system capable to handle a large number of devices.

Mender supports several extensions enabling features like Remote Terminal, Port Forward, File Transfer, and Device Configuration, together with the ability to monitor and alert.

The steps described on this Wiki page are primarily focused on integrating Mender updater into the Yocto Project. The well written official Mender documentation covers all the other important aspects of this utility.

Prerequisites

Because the Mender utility will be integrated into the Yocto Project Release 3.1 (dunfell), the Mender layer share the same steps for host machine setup as the Yocto Project. In-depth information can be found in the Yocto mega manual, a forum thread concerning repo usage for Mender integration can provide additional insight as well.

To prepare the machine, follow the Yocto Project Prerequisites Wiki page.

Configuring the build

Setup Yocto environment

Set the Yocto Project branch to build for:

export BRANCH="dunfell"

Create a directory for the mender-<TARGET> setup to work and clone the meta information:

mkdir mender-<TARGET> && cd mender-<TARGET>

Initialize repo manifest:

repo init -u https://github.com/mendersoftware/meta-mender-community \
           -m meta-mender-<TARGET>/scripts/manifest-<TARGET>.xml \
           -b ${BRANCH}

Fetch layers in manifest:

repo sync

Setup build environment

Initialize the build environment:

source setup-environment <TARGET>

Note: Accepting the Freescale EULA at …/sources/meta-freescale/EULA is required. Please read it and continue by accepting it in the local.conf file:

ACCEPT_FSL_EULA = "1"

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.

Edit the conf/local.conf file to provide the Mender server configuration, ensuring the generated images and Mender Artifacts are connecting to the Mender server that are used. There should already be a commented section in the generated conf/local.conf file. Thus simply uncommenting the relevant configuration options and assigning appropriate values to them is sufficient.

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

Building the image

Everything was setup to proceed with building an image:

MACHINE=imx8mq-voipac 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 placed in tmp/deploy/images/imq8mq-voipac/.

The disk image (with .sdimg.bz2 suffix) is used to provision the storage for devices without Mender already running. Please proceed to the official documentation on provisioning a new device for steps to do so.

On the other hand, if Mender has been running on the device and want to deploy a rootfs update using this build, the Mender Artifact files, with .mender suffix, can be used instead. This Artifact can either be deployed in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client standalone mode.

Flashing instructions

Follow the flashing procedure instructions for image flashing.