11.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.
11.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 L5.4.70_2.3.4_LINUX_DOCS documentation package (available on https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applications-processors:IMXLINUX?tab=Documentation_Tab under the Supporting Information header) 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-5-4-70-2-3-4
cd ~/projects/imx-yocto-bsp-5-4-70-2-3-4
repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-zeus -m imx-5.4.70-2.3.4.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-5-4-70-2-3-4/sources
cd ~/projects/imx-yocto-bsp-5-4-70-2-3-4/sources
tar xzvf meta-custom.tgz
11.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-5-4-70-2-3-4
DISTRO=fsl-imx-fb MACHINE=imx6ulevk source imx-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"
# +SIMW
BBLAYERS += " ${BSPDIR}/sources/meta-custom"
# -SIMW
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"
# + SIMW: Extended EXTRA_IMAGE_FEATURES
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"
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"
# +SIMW
IMAGE_ROOTFS_EXTRA_SPACE = "640000"
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"
# -SIMW
Note
At this stage it’s possible to also include the Plug&Trust package as a Yocto recipe. Refer to Alternative approach to create SD card: use Yocto recipe for Plug&Trust package on how to do this.
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 a compressed sdcard image
containing bootloader, filesystem and linux kernel is available under
~/projects/imx-yocto-bsp-5-4-70-2-3-4/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.
11.5.2.3. Create and install SDK and Root file system on Host¶
To populate SDK, run:
cd ~/projects/imx-yocto-bsp-5-4-70-2-3-4
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/5.4.70-2.3.4
:
cd ~/projects/imx-yocto-bsp-5-4-70-2-3-4/build-fb-6ul/tmp/deploy/sdk/
./fsl-imx-fb-glibc-x86_64-core-image-full-cmdline-cortexa7hf-neon-toolchain-5.4.70-2.3.4.sh
You have now installed a set of cross-compilation tools for the MCIMX6UL-EVK
board on the Linux Host PC.
11.5.2.4. Alternative approach to create SD card: use Yocto recipe for Plug&Trust package¶
The Plug&Trust MW package also includes a recipe.
Download the Plug&Trust MW from www.nxp.com/se050 and ensure the package version (e.g. 04.00.00) is appended to the file name. (For example: SE050-PLUG-TRUST-MW-v04.00.00.zip)
Put the se05x recipe (se05x_4.0.0.bb), the source code package (SE050-PLUG-TRUST-MW-v04.00.00.zip) and (if applicable) patches into the existing
.../sources/meta-custom/recipes directory
of the Yocto development PC (recipe and patches are available insimw-top/scripts/yocto/v04.00.00
)
The resulting imx-yocto-bsp-5-4-70-2-3-4/sources/meta-custom directory on the Yocto development PC should look like:
+-- conf
| +-- layer.conf
+-- README
+-- recipes
+-- func-timeout
| +-- func-timeout_4.3.3.bb
+-- se05x
+-- files
| +-- SE050-PLUG-TRUST-MW-v04.00.00.zip
+-- se05x_4.0.0.bb
To add the Plug&Trust MW to the image to be created add the following line at the end of the
build-wayland-imx8mqevk/conf/local.conf
file:
IMAGE_INSTALL_append += " se05x"