Compulab CL-SOM-iMX7

Board description

The Compulab CL-SOM-iMX7 platform is a System on Modules (SoM) based on the NXP i.MX7 chip. The kit validated here is the IOT gateway device.


URL:

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:

Yocto Project Build Runtime
rocko (2.4) :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 has been verified.

Getting started

Prerequisites

  • 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.

Configuring the build

Setup Yocto environment

Set the Yocto Project branch you are building for:

# set to your branch, make sure it is supported (see table above)
export BRANCH="rocko"

Create a directory for your mender-compulab setup to live in and clone the
meta information.

mkdir mender-compulab && cd mender-compulab

Initialize repo manifest:

repo init \
       -u git://source.codeaurora.org/external/imx/imx-manifest.git \
       -m imx-4.9.88-2.0.0_ga.xml \
       -b imx-linux-rocko
mkdir .repo/local_manifests
cd .repo/local_manifests/
wget https://raw.githubusercontent.com/mendersoftware/meta-mender-community/rocko/meta-mender-compulab/scripts/manifest-compulab-local-manifest.xml
wget https://raw.githubusercontent.com/mendersoftware/meta-mender-community/rocko/scripts/mender-no-setup.xml
cd -

Fetch layers in manifest:

repo sync
cd .repo/local_manifests/
ln -sf ../../sources/meta-mender-community/meta-mender-compulab/scripts/manifest-compulab-local-manifest.xml .
ln -sf ../../sources/meta-mender-community/scripts/mender-no-setup.xml .
cd -

Setup build environment

Initialize the build environment:

MACHINE=cl-som-imx7
source fsl-setup-release.sh -b build
source ../sources/meta-compulab-bsp/tools/setup-compulab-env
cat ../sources/meta-mender-community/meta-mender-compulab/templates/bblayers.conf.append >> conf/bblayers.conf
cat ../sources/meta-mender-community/templates/local.conf.append >> conf/local.conf
cat ../sources/meta-mender-community/meta-mender-compulab/templates/local.conf.append >> conf/local.conf

Building the image

You can now proceed with building an image:

MACHINE=cl-som-imx7 bitbake core-image-base

Replace core-image-base with your desired image target.

Using the build output

The first step is to build an SD Card with the stock image provided by Compulab. Download the archive and extract the file cl-som-imx7-yocto-linux/images/cl-som-imx7-image-qt5.sdcard.bz2. Write this file to an SD Card on your build host. WARNING, make sure you use the correct device node as the of= parameter to avoid overwriting the wrong device:

bzcat cl-som-imx7-image-qt5.sdcard.bz2 | sudo dd of=<SDCARD-DEVICE-NODE> bs=8M

Now, insert this SD Card into the target. Configure the target to boot from SD Card by adding a jumper to E2 on the system board. Power cycle your board and verify that it boots from SD Card:

U-Boot SPL 2017.07-cl-som-imx7-1.5 (Jan 10 2019 - 10:08:35)
Booting from SD card
Trying to boot from **MMC1**


U-Boot 2017.07-cl-som-imx7-1.5 (Jan 10 2019 - 10:08:35 +0200)

Once Linux has booted, log in as root with no password. Then verify that the root filesystem is /dev/mmcblk0p2 which is on the SD Card:

NXP i.MX Release Distro 4.9.88-2.0.0 cl-som-imx8 ttymxc2

cl-som-imx8 login: root
Last login: Tue Mar  5 23:27:32 UTC 2019 on ttymxc2
root@cl-som-imx8:~# mount | head -1
/dev/mmcblk0p2 on / type ext4 (rw,relatime,data=ordered)

Now copy the new U-Boot image and Mender SDIMG file to a USB drive and connect that to your target.

On your build host:

cp tmp/deploy/images/cl-som-imx7/core-image-base-cl-som-imx7.sdimg tmp/deploy/images/cl-som-imx7/cl-som-imx7-firmware /mnt

On the target:

mount /dev/sda1 /mnt
dd if=/mnt/core-image-base-cl-som-imx7.sdimg of=/dev/mmcblk2 conv=notrunc status=progress bs=8M
flash_erase /dev/mtd0 0 0
dd if=/mnt/cl-som-imx7-firmware of=/dev/mtd0
shutdown -h now

Now remove the SD Card and power cycle the board. It will boot from eMMC and Mender will connect to the server configured in your local.conf file.

On the other hand, 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 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.

References

  • The Compulab CL-SOM-iMX7 template files can be found in meta-mender-community .
  • The official Mender documentation explains how Mender works. This is simply a board-specific complement to the official documentation.

Known issues


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!

3 Likes

Hi,

Thanks for the great instructions.
They worked great in Rocko.

The folks at Compulab have been working on a warrior branch update of this device: https://github.com/compulab-yokneam/meta-bsp-imx7/tree/devel-warrior

I tried to integrate Mender into this new repo, but unfortunately the meta-mender-community does not include Compulab in the Warrior branch.

The error I get at the moment is:

ERROR: Task do_patch in /home/manuel/imx7/sources/meta-mender/meta-mender-core/recipes-bsp/u-boot/u-boot-fw-utils-mender-auto-provided_1.0.bb depends upon non-existent task do_mender_tar_src in /home/manuel/imx7/sources/meta-bsp-imx7/recipes-bsp/u-boot/u-boot-compulab_2017.07.bb
ERROR: Command execution failed: 1

In all honesty, I also don’t understand Mender sufficiently, but I will try. In the meantime, has any gentle soul around here tried this to update the meta-mender-compulab repo to the warrior branch?

Thanks

Hi @mvargasevans I’m not aware of any work done on newer branches but we would certainly love to see it done.

This particular failure means that you have not included u-boot-mender.inc in the u-boot-compulab recipe. The first step would be to copy the meta-mender-compulab directory from the rocko branch of meta-mender-community as that is where it is done on that branch. I’m certain there will be other changes needed but if you give that a shot and post the results here, we’ll do what we can to get you up and running.

Drew

Hi Drew,

Thanks for coming back.
First I tried the link, and I am able to build an image from the warrior branch, without Mender. This is, as the developer made it - to confirm at least that it works.

Then, I added

  • meta-mender @ warrior
  • meta-mender-community @ rocko

In u-boot-fw-utils-mender-auto-provided, the trouble maker must be this line:
do_patch[depends] += "${MENDER_PREFERRED_UBOOT}:do_mender_tar_src"

At the file u-boot-compulab_%.bbappend, from the Rocko branch, the first line is:
require recipes-bsp/u-boot/u-boot-mender.inc

That should point to the file where actual do_mender_tar_src is. I looked it up on meta-mender-core and it is there like this:

do_mender_tar_src() {
    cd ${WORKDIR}
    # Zip up all plain files, plus the source directory, but not the rest,
    # because there are a lot of bitbake data directories.
    rm -rf src-tar
    cp -a ${S} src-tar
    tar -cz --exclude-vcs -f ${TMPDIR}/mender-u-boot-src.tar.gz `find -maxdepth 1 -type f` src-tar
}

In the bblayers.conf file, I added the new layers as this to confirm they should be there:
BBLAYERS += " {BSPDIR}/sources/meta-mender/meta-mender-core " BBLAYERS += " {BSPDIR}/sources/meta-mender-community/meta-mender-compulab "

(I created a dummy recipe in the meta-mender-community/meta-mender-compulab layer and I can confirm with bitbake -s that it is there).

So, I went directly to u-boot-compulab_2017.07.bb and added u-boot-mender.inc directly. The error persists.

Am I including it correctly?

I modified u-boot-fw-utils-mender-auto-provided by addind u-boot-compulab to the DEPENDS variable and removing the do_patch[depends] line. The new error is:

ERROR: u-boot-fw-utils-mender-auto-provided-1.0-r0 do_patch: Function failed: do_patch (log file is located at /home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/temp/log.do_patch.30057)
ERROR: Logfile of failure stored in: /home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/temp/log.do_patch.30057
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/manuel/imx7-warrior/sources/poky/meta/recipes-devtools/quilt/quilt-native_0.65.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: ['quilt-native']
| NOTE: Skipping as already exists in sysroot: []
| DEBUG: sed -e 's:^[^/]*/:/home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/recipe-sysroot-native/:g' /home/manuel/imx7-warrior/build-fb-imx7/tmp/sysroots-components/x86_64/quilt-native/fixmepath | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:/home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/recipe-sysroot:g; s:FIXMESTAGINGDIRHOST:/home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/recipe-sysroot-native:g' -e 's:FIXME_COMPONENTS_DIR:/home/manuel/imx7-warrior/build-fb-imx7/tmp/sysroots-components:g' -e 's:FIXME_HOSTTOOLS_DIR:/home/manuel/imx7-warrior/build-fb-imx7/tmp/hosttools:g' -e 's:FIXME_PKGDATA_DIR:/home/manuel/imx7-warrior/build-fb-imx7/tmp/pkgdata/cl-som-imx7:g' -e 's:FIXME_PSEUDO_LOCALSTATEDIR:/home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/pseudo/:g' -e 's:FIXME_LOGFIFO:/home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/temp/fifo.30057:g'
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_patch
| tar (child): /home/manuel/imx7-warrior/build-fb-imx7/tmp/mender-u-boot-src.tar.gz: Cannot open: No such file or directory
| tar (child): Error is not recoverable: exiting now
| tar: Child returned status 2
| tar: Error is not recoverable: exiting now
| WARNING: exit code 2 from a shell command.
| ERROR: Function failed: do_patch (log file is located at /home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-fw-utils-mender-auto-provided/1.0-r0/temp/log.do_patch.30057)
ERROR: Task (/home/manuel/imx7-warrior/sources/meta-mender/meta-mender-core/recipes-bsp/u-boot/u-boot-fw-utils-mender-auto-provided_1.0.bb:do_patch) failed with exit code '1'

I am starting to think that warrior included new configuration options in local.conf that I am probably missing?

I took a step back, left do_patch[depends] as it was and added this to local.conf since I saw that the file
mender-u-boot-src.tar.gz requires some conditions to be made.

MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_ENABLE_append = " mender-uboot"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"

That leads to an error in this patch:

ERROR: u-boot-compulab-2017.07-r0 do_patch: Command Error: 'quilt --quiltrc /home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-compulab/2017.07-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0  Output:
Applying patch 0003-Integration-of-Mender-boot-code-into-U-Boot.patch
patching file include/env_default.h
Hunk #1 succeeded at 10 with fuzz 2 (offset 1 line).
Hunk #2 FAILED at 23.
1 out of 2 hunks FAILED -- rejects in file include/env_default.h
patching file scripts/Makefile.autoconf
Hunk #1 succeeded at 111 (offset 2 lines).
Patch 0003-Integration-of-Mender-boot-code-into-U-Boot.patch does not apply (enforce with -f)
ERROR: u-boot-compulab-2017.07-r0 do_patch: 
ERROR: u-boot-compulab-2017.07-r0 do_patch: Function failed: patch_do_patch
ERROR: Logfile of failure stored in: /home/manuel/imx7-warrior/build-fb-imx7/tmp/work/cl_som_imx7-poky-linux-gnueabi/u-boot-compulab/2017.07-r0/temp/log.do_patch.4592
ERROR: Task (/home/manuel/imx7-warrior/sources/meta-bsp-imx7/recipes-bsp/u-boot/u-boot-compulab_2017.07.bb:do_patch) failed with exit code '1'

I don’t want to spam more.
For the moment, it would be great to hear if I am moving in the right direction or not.
Regards

Yes, that looks like the right direction. The patch probably doesn’t apply cleanly since the upstream U-Boot has changed. These patch failures are usually pretty straight forward to figure out.

Hi Drew,

I wanted to come back to you quickly just to share that I got it working and I have a fork here:

During the day I will do a fresh compilation and test on the board to make sure it works and other people could follow a similar tutorial as the one you have here.

Note: I still have to fine-tune the local.conf file, hence the readme.md is not updated yet.

Great. Please submit a PR for review when it is done. We would love to get this newer version listed in Mender hub.