Compulab CL-SOM-iMX6

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

Board description

The Compulab CL-SOM-iMX6 platform is a System on Modules (SoM) based on the NXP i.MX6 chip. The evaluation kit comes with a SB-FX6 baseboard.

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
morty (2.2) :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="morty"

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://git.freescale.com/imx/fsl-arm-yocto-bsp.git \
           -m imx-4.1.33-7ulp_beta.xml \
           -b imx-morty
mkdir .repo/local_manifests
cd .repo/local_manifests/
wget https://raw.githubusercontent.com/mendersoftware/meta-mender-community/morty/meta-mender-compulab/scripts/manifest-compulab-local-manifest.xml
wget https://raw.githubusercontent.com/mendersoftware/meta-mender-community/morty/scripts/mender-local-manifest.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-local-manifest.xml .
cd -

Setup build environment

Initialize the build environment:

source fsl-setup-release.sh -b build
source ../sources/meta-compulab/bb-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-imx6 bitbake core-image-base

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

Using the build output

Provision an SD Card with the image produced by bitbake. WARNING, make sure you use the correct device node as the of= parameter to avoid overwriting the wrong device:

sudo dd if=tmp/deploy/images/cl-som-imx6/compulab-eval-image-cl-som-imx6.sdimg of=<SDCARD-DEVICE-NODE> conv=notrunc status=progress

Create a U-Boot binary suitable for deploying to SPI flash:

dd if=/dev/zero count=500 bs=1K | tr '\000' '\377' > cm-fx6-firmware
dd if=tmp/deploy/images/cl-som-imx6/u-boot.imx of=cm-fx6-firmware bs=1K seek=1 conv=notrunc

Add the images to the SD Card so we can copy them to the eMMC on the target. This assumes the SD Card created in step 2 was enumerated in your system as /dev/mmcblk0:

sudo mount /dev/mmcblk0p5 /mnt/  
sudo cp --sparse=always tmp/deploy/images/cl-som-imx6/core-image-full-cmdline-cl-som-imx6.sdimg cm-fx6-firmware /mnt
sudo umount /mnt

The image generated above assumes it is running from the eMMC (enumerated as /dev/mmcblk3 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:

sudo mount /dev/mmcblk0p2 /mnt
sudo cat /mnt/etc/fstab | grep -v mmcblk3 > fstab.new
sudo mv fstab.new /mnt/etc/fstab
sudo umount /mnt

Now, remove the SD Card from your build host and insert it into the target. Configure your board to boot from SD Card by pressing SW5 as you power it on, or by attaching jumper E2. As the board boots to U-Boot, press a key to stop the autoboot process.

Write the U-Boot binary to the SPI flash:

sf probe 0
sf erase 0 80000
load mmc 2:5 10800000 /cm-fx6-firmware
sf write 10800000 0 80000

Now, remove the SD Card and power cycle your board. As the board boots to U-Boot, press a key to stop the autoboot process. Note from the log that it is now booting U-Boot off of SPI:

U-Boot SPL 2015.07-cl-som-imx6-1.0 (Nov 16 2018 - 12:50:44)
Dual/Quad CPU detected
Trying to boot from MMC
Card did not respond to voltage select!
spl: mmc init failed with error: -17
Trying to boot from SPI


U-Boot 2015.07-cl-som-imx6-1.0 (Nov 16 2018 - 12:50:44 +0000)

CPU:   Freescale i.MX6D rev1.5 996 MHz (running at 792 MHz)
Reset cause: POR
Board: SOM-iMX6-Mender
I2C:   ready
DRAM:  3.7 GiB
NAND:  0 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2, FSL_SDHC: 3
SF: Detected W25Q16CL with page size 256 Bytes, erase size 4 KiB, total 2 MiB
Display: HDMI (1024x768)
In:    serial
Out:   vga
Err:   vga
PCB:   1.0
Net:   FEC
Hit any key to stop autoboot:  0

Setup the default U-Boot environment. Note that running saveenv twice here ensures that the redundant U-Boot environment blocks are synchronized. It is not strictly necessary to do this:

env default -a -f
saveenv
saveenv

Insert the SD Card into your board and boot Linux from there. Unfortunately the buffering in UBoot seems to be unable to handle the speed of copy/paste so these commands may need to be typed manually:

setenv bootargs root=/dev/mmcblk2p2 console=ttymxc3,115200 vmalloc=256M cma=384M dmfc=3
mmc dev 2
load mmc 2:2 0x15000000 /boot/imx6q-sbc-imx6-hdmi.dtb
load mmc 2:2 0x10800000 /boot/zImage
bootz 0x10800000 - 0x15000000

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

NXP i.MX Release Distro 4.1.33-7ulp_beta cl-som-imx6 ttymxc3

cl-som-imx6 login: root
root@cl-som-imx6:~# mount | head -1
/dev/mmcblk2p2 on / type ext4 (rw,relatime,data=ordered)

Provision the eMMC device with the original sdimg file:

mount /dev/mmcblk2p5 /mnt
dd if=/mnt/core-image-full-cmdline-cl-som-imx6.sdimg of=/dev/mmcblk3 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 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 standalone mode.

References


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!

1 Like