# Compulab CL-SOM-iMX8

**URL:** <https://hub.mender.io/t/compulab-cl-som-imx8/416>\
**Category:** Yocto Project\
**Tags:** yocto, rocko, nxp\
**Created:** [March 25, 2019, 5:12pm UTC](https://hub.mender.io/t/compulab-cl-som-imx8/416 "2019-03-25T17:12:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [March 25, 2019, 5:12pm UTC](https://hub.mender.io/t/compulab-cl-som-imx8/416/1 "2019-03-25T17:12:36Z")

</div>

# Board description

The Compulab CL-SOM-iMX8 platform is a System on Modules (SoM) based on the NXP i.MX8 chip. The evaluation kit comes with a [SB-iMX8 carrier board](https://www.compulab.com/products/sbcs/sbc-imx8-nxp-i-mx8m-single-board-computer/).

 ![cl-som-imx8](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/1X/2a9a6b8824801b17cceb95cd2e25bf97588a85fa.jpeg)  
URL:

- [Reference Guid](https://www.compulab.com/wp-content/uploads/2018/01/cl-som-imx8_reference-guide_2019-02-14.pdf)
- [Product Overview](https://www.compulab.com/products/computer-on-modules/cl-som-imx8-nxp-i-mx-8-system-on-module-computer)

# 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](https://wiki.yoctoproject.org/wiki/Releases?target=_blank):

| 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](https://docs.mender.io/devices/integrating-with-u-boot/integration-checklist?target=_blank) has been verified.

# Getting started

## Prerequisites

- A supported Linux distribution and dependencies installed on your workstation/laptop as described in the [Yocto Mega Manual](https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#detailed-supported-distros)
  - NOTE. Instructions depend on which Yocto version you intend to use.

- Google repo tool [installed](https://hub.mender.io/t/google-repo/58/2) and in your `PATH`.

## Configuring the build

### Setup Yocto environment

Set the Yocto Project branch you are building for:

```auto
# 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.

```auto
mkdir mender-compulab && cd mender-compulab

```

Initialize repo manifest:

```auto
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:

```auto
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:

```auto
MACHINE=cl-som-imx8
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
sed -i 's@^\(PREFERRED_RPROVIDER_u-boot-fw-utils.*$\)@# commented by Mender # \1@' conf/local.conf
sed -i 's@^\(CORE_IMAGE_EXTRA_INSTALL.*$\)@# commented by Mender # \1@' conf/local.conf
sed -i 's@^\(IMAGE_FEATURES.*package-management.*$\)@# commented by Mender # \1@' conf/local.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:

```auto
MACHINE=cl-som-imx8 bitbake core-image-base

```

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

### Using the build output

Provision an SD Card with the built above. **WARNING** , make sure you use the correct device node as the _of=_ parameter to avoid overwriting the wrong device:

```auto
sudo dd if=tmp/deploy/images/cl-som-imx8/core-image-full-cmdline-cl-som-imx8.sdimg of=<SDCARD-DEVICE-NODE>

```

The image generated above assumes it is running from the eMMC (enumerated as _/dev/mmcblk0_ on the target). We will manually modify this to boot from the SD Card, and from that environment, we will provision the onboard eMMC with the unmodified image:

```auto
sudo mount /dev/mmcblk0p1 /mnt
sudo cat /mnt/etc/fstab | grep -v /data > fstab.new
sudo mv fstab.new /mnt/etc/fstab
sudo umount /mnt

```

Also, copy the images created above to a USB key. This will be used when booted from the SD Card to populate the eMMC on the target.

Remove the SD Card and USB key from your build host and insert them into the target. Configure your board to boot from SD Card by pressing the _ALT BOOT_ switch, or _SW5_ as you power it on. As the board boots to U-Boot, press a key to stop the autoboot process. Manually boot Linux from the SD Card, bypassing the default bootcmd:

```auto
setenv bootargs root=/dev/mmcblk1p1 console=ttymxc2,115200
mmc dev 1
load mmc 1:1 0x43000000 /boot/sbc-imx8-lvds-lcdif.dtb
load mmc 1:1 0x40480000 /boot/Image
booti 0x40480000 - 0x43000000

```

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

```auto
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/mmcblk1p1 on / type ext4 (rw,relatime,data=ordered)

```

Provision the eMMC device with the original sdimg file:

```auto
mount /dev/sda1 /mnt
dd if=/mnt/core-image-base-cl-som-imx8.sdimg of=/dev/mmcblk0 conv=notrunc status=progress
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](https://docs.mender.io/architecture/mender-artifacts?target=_blank) 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](https://docs.mender.io/architecture/standalone-deployments?target=_blank).

# References

- The Compulab CL-SOM-iMX8 template files can be found in [meta-mender-community](https://github.com/mendersoftware/meta-mender-community/tree/rocko/meta-mender-compulab).
- The official [Mender documentation](https://docs.mender.io/) explains how Mender works. This is simply a board-specific complement to the official documentation.

# Known issues

- The ext4 code in U-Boot is known to be slow due to lack of caching of filesystem data structures. Details can be found in the following links:
  - [https://community.nxp.com/thread/472241](https://community.nxp.com/thread/472241)
  - [https://github.com/madisongh/meta-tegra/issues/42](https://github.com/madisongh/meta-tegra/issues/42)  
The simplest workaround is to switch your root filesystem to ext3 using the `ARTIFACTIMG_FSTYPE` variable.  
There is a [proposed patch available](https://lists.denx.de/pipermail/u-boot/2019-January/356961.html) but it has not been tested in this configuration.

* * *

_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!_

---

<div class="post-metadata">

**Author:** ![kevlan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kevlan/32/695_2.png) [@kevlan](https://hub.mender.io/u/kevlan)\
**Post date:** [July 22, 2020, 6:18pm UTC](https://hub.mender.io/t/compulab-cl-som-imx8/416/2 "2020-07-22T18:18:47Z")

</div>

We have successfully used the patch from here: [https://github.com/madisongh/u-boot-tegra/commit/059ace6e05df0bd6842946327119ac0750766580#diff-64139a70dbc69615e40feee4bc8903c1](https://github.com/madisongh/u-boot-tegra/commit/059ace6e05df0bd6842946327119ac0750766580#diff-64139a70dbc69615e40feee4bc8903c1) to fix the slow issues with ext4 on this platform.

---

<div class="post-metadata">

**Author:** ![kevlan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kevlan/32/695_2.png) [@kevlan](https://hub.mender.io/u/kevlan)\
**Post date:** [July 22, 2020, 6:19pm UTC](https://hub.mender.io/t/compulab-cl-som-imx8/416/3 "2020-07-22T18:19:43Z")

</div>

Currently working on updating this platform to work with dunfell. We will update this when we have a working solution.

---

<div class="post-metadata">

**Author:** ![saizen408](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/saizen408/32/1069_2.png) [@saizen408](https://hub.mender.io/u/saizen408)\
**Post date:** [February 26, 2021, 2:08am UTC](https://hub.mender.io/t/compulab-cl-som-imx8/416/4 "2021-02-26T02:08:47Z")

</div>

Hello,

Just wondering if there’s been any progress on dunfell support
