9.5.2. Setup i.MX6UL - MCIMX6UL-EVK

This section explains how to create an SD card image (including native compilation tools) and a cross-compilation environment for the MCIMX6UL-EVK.

Note

Setup i.MX 8MQuad - MCIMX8M-EVK is the current default version of the board used with the Plug & Trust MW.

9.5.2.1. Downloading and Installing Yocto for MCIMX6UL-EVK

Please consult first the detailed information that can be found on https://www.nxp.com. Download the L4.19.35_1.1.0_LINUX_DOCS documentation package (available on https://www.nxp.com/design/i-mx-developer-resources/i-mx-software-and-development-tools:IMX-SW under the header Overview - Documentation - Linux 4.19.35_1.1.0 Documentation and take the i.MX Yocto Project User’s Guide as a starting point.

Yocto must be installed on a Linux PC (consult the documentation for the Linux distributions officially supported), it’s possible to use a Virtual PC environment as e.g. Virtual Box. The Linux PC must have access to the internet to retrieve additional packages, tools and sources.

Having set-up all tools and packages required by Yocto, initialize a local git repository as follows:

mkdir -p ~/projects/imx-yocto-bsp-4-19-35-1-1-0
cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0
repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-warrior -m imx-4.19.35-1.1.0.xml
repo sync

Add a custom Yocto layer. This custom Yocto layer is part of the Plug&Trust SW distribution (simw_top/scripts/yocto/layers/meta-custom.tgz) and must be copied and unpacked into the sources directory created above. Note: this custom layer adds a Python package (func-timeout):

cp <PlugTrust>/simw_top/scripts/yocto/layers/meta-custom.tgz ~/projects/imx-yocto-bsp-4-19-35-1-1-0/sources
cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0/sources
tar xzvf meta-custom.tgz

9.5.2.2. Prepare an embedded Linux distribution for the MCIMX6UL-EVK board

The bitbake target core-image-full-cmdline created for MCIMX6UL-EVK contains a busybox implementation of the usual Unix command line tools. It assumes you will interact with the embedded system over the command line:

cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0
DISTRO=fsl-imx-fb MACHINE=imx6ulevk source fsl-setup-release.sh -b build-fb-6ul

Now, before issuing the bitbake command, edit two configuration files.

First edit the build-fb-6ul/conf/bblayers.conf so it contains a reference to the custom layer. Add the following line at the end of the file:

BBLAYERS += " ${BSPDIR}/sources/meta-custom"

The resulting build-fb-6ul/conf/bblayers.conf file will look as follows:

LCONF_VERSION = "7"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-poky \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  ${BSPDIR}/sources/meta-openembedded/meta-multimedia \
  \
  ${BSPDIR}/sources/meta-freescale \
  ${BSPDIR}/sources/meta-freescale-3rdparty \
  ${BSPDIR}/sources/meta-freescale-distro \
"

# i.MX Yocto Project Release layers
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-bsp "
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-sdk "
BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-ml "

BBLAYERS += "${BSPDIR}/sources/meta-browser"
BBLAYERS += "${BSPDIR}/sources/meta-rust"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-gnome"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-networking"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-python"
BBLAYERS += "${BSPDIR}/sources/meta-openembedded/meta-filesystems"
BBLAYERS += "${BSPDIR}/sources/meta-qt5"
BBLAYERS += " ${BSPDIR}/sources/meta-custom "

Next edit the file build-fb-6ul/conf/local.conf so it matches the following:

MACHINE ??= 'imx6ulevk'
DISTRO ?= 'fsl-imx-fb'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks dev-pkgs tools-debug tools-sdk tools-testapps package-management"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
    STOPTASKS,${TMPDIR},1G,100K \
    STOPTASKS,${DL_DIR},1G,100K \
    STOPTASKS,${SSTATE_DIR},1G,100K \
    STOPTASKS,/tmp,100M,100K \
    ABORT,${TMPDIR},100M,1K \
    ABORT,${DL_DIR},100M,1K \
    ABORT,${SSTATE_DIR},100M,1K \
    ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
IMAGE_ROOTFS_EXTRA_SPACE = "640000"

DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"

IMAGE_INSTALL_append += " rng-tools openssl-bin"
IMAGE_INSTALL_append += " cmake curl git subversion"
IMAGE_INSTALL_append += " python3-pip python3-click python3-cryptography python3-pycparser python3-cffi"
IMAGE_INSTALL_append += " e2fsprogs-resize2fs func-timeout i2c-tools"

The above local.conf file prepares an embedded Linux distribution with native development tools

After updating the file build-fb-6ul/conf/local.conf issue the following command:

bitbake core-image-full-cmdline

Note

Output Directory

The directory build-fb-6ul will contain downloaded sources and build artefacts.

When the above bitbake command finished successfully an sdcard image containing bootloader, filesystem and linux kernel is available under ~/projects/imx-yocto-bsp-4-14-98/build-fb-6ul/tmp/deploy/images/imx6ulevk/core-image-full-cmdline-imx6ulevk.sdcard.

core-image-full-cmdline-imx6ulevk.sdcard is a symbolic link to the actual file name - which has a timestamp as part of the filename e.g. core-image-full-cmdline-imx6ulevk-20170825222257.rootfs.sdcard. Copy this sdcard image to a microSD card either with the method described in the ‘i.MX Yocto Project User’s Guide’ or on a Windows PC with e.g. the Win32DiskImager tool. */

When the above bitbake command finished successfully a compressed sdcard image containing bootloader, filesystem and linux kernel is available under ~/projects/imx-yocto-bsp-4-19-35-1-1-0/build-fb-6ul/tmp/deploy/images/imx6ulevk/core-image-full-cmdline-imx6ulevk.wic.bz2.

core-image-full-cmdline-imx6ulevk.wic.bz2 is a symbolic link to the actual file name - which has a timestamp as part of the filename e.g. core-image-full-cmdline-imx6ulevk-20191204234929.rootfs.wic.bz2. Copy the unzipped sdcard image to a microSD card either with the method described in the ‘i.MX Yocto Project User’s Guide’ or on a Windows PC with e.g. the Win32DiskImager tool.

Note

The embedded linux system prepared has a user root that does not require a password. Please define a password at your earliest convenience.

9.5.2.3. Create and install SDK and Root file system on Host

To populate SDK, run:

cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0
MACHINE=imx6ulevk source setup-environment build-fb-6ul
bitbake -c populate_sdk core-image-full-cmdline

To install the SDK in the default location /opt/fsl-imx-fb/4.9.88-2.0.0:

cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0/build-fb-6ul/tmp/deploy/sdk/
./fsl-imx-fb-glibc-x86_64-core-image-full-cmdline-cortexa7hf-neon-toolchain-4.9.88-2.0.0.sh

You have now installed a set of cross-compilation tools for the MCIMX6UL-EVK board on the Linux Host PC.

9.5.2.4. Create and install SDK and Root file system on Host

To populate SDK, run:

cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0
MACHINE=imx6ulevk source setup-environment build-fb-6ul
bitbake -c populate_sdk core-image-full-cmdline

To install the SDK in the default location /opt/fsl-imx-fb/4.19-warrior:

cd ~/projects/imx-yocto-bsp-4-19-35-1-1-0/build-fb-6ul/tmp/deploy/sdk/
./fsl-imx-fb-glibc-x86_64-core-image-full-cmdline-aarch64-toolchain-4.19-warrior.sh

You have now installed a set of cross-compilation tools for the MCIMX6UL-EVK board on the Linux Host PC.