Mender Kirkstone Release for i.MX8 platforms

Published on December 7, 2022

We are pleased to announce a new Mender Kirkstone release for our Nitrogen8 family of SBCs and SOMs based on i.MX 8 processors. Previously, we only had support on our Nitrogen8M and Nitrogen8M Mini platforms, but this release now includes support for our Nitrogen8M Nano and Nitrogen8M Plus platforms as well!

What is Mender?

Mender.io is a secure, robust and efficient end-to-end over-the-air (OTA) software update manager for embedded devices. It is open source with an active community supporting a large number of different hardware and operating systems. Visit Mender.io and Mender Hub community to learn more.

How to Use Mender with Nitrogen8M

In this post, we will be using Mender in conjunction with Yocto to demonstrate a simple OTA update on our Nitrogen8M platform.  We will be using Nitrogen8M as an example, but the same applies for all of the Nitrogen8 family.

Setup Mender trial server on hosted.mender.io

Sign up for a trial here

Grab Organization token

After signing up and logging in, click your email at the top right and then "My organization": Then click "COPY TO CLIPBOARD" next to Organization token. Temporarily copy this somewhere, as we will be using it in next step:

Build Procedure

We will be using the kirkstone branch of our boundary-bsp-platform repository. To build the image, we recommend using a Docker Container so that you can build with a reproducible and stable build environment. Otherwise, you’ll need these packages installed as well as this repo tool that can be installed like this:

~$ sudo apt-get install repo

Then create your build directory and initialize everything.

~$ mkdir ~/yocto-mender && cd yocto-mender
~/yocto-mender$ repo init -u https://github.com/boundarydevices/boundary-bsp-platform.git -m mender.xml -b kirkstone
~/yocto-mender$ repo sync

Next, setup the environment for building.

~/yocto-mender$ source setup-environment-mender nxp

Now we need to define a few things in local.conf. First, we need to specify our MACHINE and DISTRO in local.conf.  For this image we will be building our boundary-xwayland distro for the nitrogen8m

MACHINE = "nitrogen8m"

DISTRO = "boundary-xwayland"

NOTE: There will be an existing MACHINE and DISTRO defined by default in local.conf. Please replace these definitions. Next, we need to copy the Organization token from the step above to local.conf. Copy the following to local.conf:

MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = ""

Lastly, we need to accept the Freescale EULA located in "sources/meta-freescale/EULA’. Please read it and accept by adding the following to local.conf:

ACCEPT_FSL_EULA = "1"

Now bitbake boundary-image-multimedia-full which is equivalent to fsl-image-multimedia-full with Boundary-specific packages added such as BD-SDMAC support.

~/yocto-mender/build$ bitbake boundary-image-multimedia-full

The image file will deploy to tmp/deploy/images/{MACHINE}/boundary-image-multimedia-full-{MACHINE}.sdimg

Flash image

You can program the SW to eMMC using the instructions below: programming-emmc-on-i-mx-platforms You can also program the SW to SD Card or USB Stick via zcat and dd under Linux:

~$ sudo dd if=*boundary-image*.sdimg of=/dev/sdX bs=1M && sync

In addition, you can use the balenaEtcher utility to flash the eMMC, SD Card or USB stick via Windows or Linux: balenaEtcher

Boot device and upgrade uboot

The boot partition of the image will contain both the uboot binary and the upgrade.scr script required for updating the uboot. We will upgrade the uboot with "run upgradeu":

=> ls mmc 0
28801536 Image
4665 boot.scr
55674 imx8mq-nitrogen8m-edp.dtb
55803 imx8mq-nitrogen8m-m4.dtb
55722 imx8mq-nitrogen8m-tc358743.dtb
55670 imx8mq-nitrogen8m.dtb
51571 imx8mq-nitrogen8m_som-m4.dtb
51438 imx8mq-nitrogen8m_som.dtb
1278752 u-boot.nitrogen8m
5732 upgrade.scr

10 file(s), 0 dir(s)
=> run upgradeu
starting USB...
Bus usb@38100000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@38200000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@38100000 for devices... 1 USB Device(s) found
scanning bus usb@38200000 for devices... 3 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

Device 0: unknown device
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /upgrade.scr
5732 bytes read in 12 ms (465.8 KiB/s)
## Executing script at 40480000
cpu2=8M
cpu3=8MQ
1278752 bytes read in 20 ms (61 MiB/s)
switch to partitions #0, OK
mmc0(part 0) is current device

MMC read: dev # 0, block # 66, count 2498 ... 2498 blocks read: OK
byte at 0x42000400 (0xd1) != byte at 0x42400400 (0x0)
Total of 0 byte(s) were the same
Need U-Boot upgrade
Program in 5 seconds
5
4
3
2
1

MMC write: dev # 0, block # 66, count 2498 ... 2498 blocks written: OK
switch to partitions #0, OK
mmc0(part 0) is current device
---- U-Boot upgraded. The board will now reset.
resetting ...

after the board resets, reset the environment variables to default and reboot:

=> env default -a
## Resetting to default environment
=> savee
Saving Environment to MMC... Writing to redundant MMC(0)... OK
=> reset

Accept Pending device in Mender Dashboard

After booting, make sure your device is connected to the internet. Now, it will show up as a Pending device in the Dashboard: Click the "+" icon under "Pending devices", then select your device and click the "+" icon in the lower right corner and accept: Now your device will show up in the Dashboard:

Prepare a release artifact

We are now ready to test a rootfs update. First, we need to prepare a release artifact in the yocto build. As a test, we can simply just increment the release number, but keep the same rootfs. We do this in local.conf. You will notice that the starting image has a software version name "release-1". Lets bump up to "release-2" by modifying the following line in local.conf:

MENDER_ARTIFACT_NAME = "release-2"

Now we can rebuild the image

~/yocto-mender/build$ bitbake boundary-image-multimedia-full

The mender release artifact will deploy to tmp/deploy/images/{MACHINE}/boundary-image-multimedia-full-{MACHINE}.mender

Upload release artifact

Now let's take the release artifact from step 7 and upload to the Mender server. Navigate to the "Releases" tab and click "Upload" Select the artifact from step 7 and upload:

Deploy release artifact

Now let's deploy the release artifact to the Nitrogen8M. After the upload completes, it will show up as "release-2" under "Releases". We can now click "Create Deployment With This Release": Select "All devices" in the drop-down and click "Next". Click "Next" again then click "Create": The board will now being to update: Click on "View details" to see the update status: If the update was successful, you will see the following success output: Success! Now if we navigate to the "Devices" tab, we can see the Nitrogen8M is running software "release-2": There you have it! You can now integrate Mender into your Yocto BSP to perform seamless software updates.   If you have any issues, please email support@boundarydevices.com