How to manage your Qt based embedded Linux device with Mender (Apalis iMX8)

The official Mender documentation explains how Mender works. This is a board-specific complement to the official documentation.

This is my experiance in adding Mender layer in iMX8 Apalis board and i thought to share this with you.

Device description

The board is Apalis iMX8 | Toradex Developer Center that is used for integration with boot2qt manifests

Support level

We did the initial testing and things seems to be working fine.

Getting started

  • A supported Linux distribution and dependencies installed on your workstation/laptop as described in the Yocto Mega Manual

    • NOTE. Instructions depend on which Yocto version you intend to use.
  • Google repo tool installed and in your PATH

  • A deployment environment using a desktop PC with Ubuntu 20.04 and Google Chrome as a web browser and at least 10 GB free disk space and 2 GB RAM available for Mender.

  • You should have a running Mender demo server. Instructions on how to setup this up can be found here

  • Apalis iMX8 carrier board

  • Apalis iMX8 SOM

  • Working U-boot on the Apalis iMX8

    • If you do not have a working U-boot, please consult the iMX Recovery Mode section of the Toradex developer resources.
  • Qt Creator IDE installed on your development PC . On a Debian based operating system you can run:

apt-get install qtcreator

Create workspace and change directory:

mkdir boot2qt && cd boot2qt

Clone meta-boot2qt:


repo init -u git://code.qt.io/yocto/boot2qt-manifest -m v6.4.3.xml
repo sync

Download mender meta directories using git clone, we used git clone and got to kirkstone branch

cd sources
git clone https://github.com/mendersoftware/meta-mender.git -b kirkstone
git clone https://github.com/mendersoftware/meta-mender-community.git -b kirkstone
cd ..

Initialize the environment:

MACHINE=apalis-imx8 source ./setup-environment.sh

Add Mender layers to environment:

cat <<- 'EOF' >> conf/bblayers.conf
BBLAYERS += "${BSPDIR}/sources/meta-mender/meta-mender-core"
BBLAYERS += "${BSPDIR}/sources/meta-mender/meta-mender-demo"
BBLAYERS += "${BSPDIR}/sources/meta-mender-community/meta-mender-toradex-nxp"
EOF

Also , i updated local.conf based on findings from this post.

here are local.conf lines i added/updated.

MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
 
INIT_MANAGER = "systemd"
 
INHERIT += "mender-toradex"
 
MENDER_FEATURES_ENABLE:append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE:append = " mender-grub mender-image-uefi"

IMAGE_CLASSES += "image_type_mender_tezi"
IMAGE_FSTYPES:append = " mender_tezi"
IMAGE_FSTYPES:remove = " teziimg"
 
KERNEL_IMAGETYPE:aarch64_mender-grub = "Image"
IMAGE_BOOT_FILES:remove:mender-grub = "boot.scr-verdin-imx8mm;boot.scr"
 
IMAGE_BOOT_FILES:remove:mender-uboot = "zImage ${KERNEL_DEVICETREE} overlays.txt overlays/*;overlays/"

MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET:apalis-imx8 = "0"
MENDER_BOOT_PART_SIZE_MB:apalis-imx8 = "32"
OFFSET_SPL_PAYLOAD:apalis-imx8 = ""
MENDER_STORAGE_DEVICE:apalis-imx8 = "/dev/mmcblk0"
MENDER_STORAGE_TOTAL_SIZE_MB:apalis-imx8 = "12288" 
MENDER_UBOOT_POST_SETUP_COMMANDS:append = " ; setenv tdxargs ${tdxargs} ${bootargs}; "

MENDER_UBOOT_POST_SETUP_COMMANDS:append = " ; setenv overlays_file /boot/overlays.txt;setenv overlays_prefix boot/overlays/ "

Build an image:

bitbake b2qt-embedded-qt6-image

for the recommended demo image by Qt, or

bitbake core-image-minimal

There might be a warning or error while applying patches to u-boot-toradex. In that case refreshing the the patch 0001-Adapt-boot.cmd.in-to-Mender might be necessary.

After the build completes , .mender and .mender_tezi.tar files are available

Follow the standard procedure to update the mender builds afterwards.

1 Like

Hi @dhiry2k,

Thanks a lot for the contribution. I am currently replicating and verifying the steps, and there are some places where typos need to be fixed or minor additions are required. I am taking the liberty of adding it to your original post. Hope this is okay for you.

Greetz,
Josef

1 Like

please feel free do edit the post as required. i am new here , hopefully able to contribute in much better manner after few posts :slight_smile:

1 Like

@dhiry2k

It is already a great contribution!:heart:

One question: after cloning the Mender layers, you jump directly to invoking b2qt-init-build-env. As I understand it, here some essential piece of information is missing. The script is not located in the current, top level directory, and changing into sources/meta-boot2qt before the invocation also does not do the trick. Can you maybe point out how you got to this stage? Thanks!

Greetz,
Josef

It does, but yes, you need to register before using qt manifests and need to have a licence i beleive. I have that licence so i am able to pass that stage. See attached picture.

Hmm that does not match my resulting setup. If I follow the earlier parts of the text, then meta-boot2qt is located under sources, and not in the top level directory. So if I enter sources/meta-boot2qt and issue the command there, it fails with

jd@j-kaitain:~/builds/boot2qt/sources/meta-boot2qt$ ./b2qt-init-build-env init --device apalix-imx8

... A new version of repo (2.32) is available.
... New version is available at: /home/jd/builds/boot2qt/.repo/repo/repo
... The launcher is run from: /usr/bin/repo
!!! The launcher is not writable.  Please talk to your sysadmin or distro
!!! to get an update installed.

repo: reusing existing repo client checkout in /home/jd/builds/boot2qt

manifests:
fatal: '/home/jd/builds/boot2qt/sources/meta-boot2qt/.repo/repo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
manifests: sleeping 4.0 seconds before retrying

manifests:
fatal: '/home/jd/builds/boot2qt/sources/meta-boot2qt/.repo/repo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: cannot obtain manifest /home/jd/builds/boot2qt/sources/meta-boot2qt/.repo/rep

so my understanding is that there is some inherent difference between the documented setup and its directory structure, and the one that you are using. It doesn’t seem to be license related.

Greetz,
Josef

1 Like

aah yes, i did followed this as well to setup my Qt account.

https://wiki.qt.io/Setting_up_Gerrit

This sets up your syetem with correct access rights.

Hi @dhiry2k, I went through the instructions and it builds for me. Can you give it a short read and confirm that I did not break anything for you while editing?

Greetz,
Josef

sorry for the late reply. yes that is fine and worked great on my system .

1 Like