Emcraft Yocto Overview
Emcraft maintains and supports a Yocto distribution and build for the Emcraft i.MX 8M Mini kit. Key features of the Emcraft Yocto distribution are as follows:
- Based on the NXP i.MX Linux release L5.4.3_1.0.0 distribution.
- U-Boot version 2019.04.
- Linux kernel version 5.4.3.
- Yocto project 3.0 (Zeus).
- Specifically customized and configured for the Emcraft i.MX 8M Mini kit.
- Enhanced by Emcraft to provide various advanced capabilities.
- Build validated explicitly on Fedora 27, Ubuntu 16 and Ubuntu 18 host distributions.
- Maintained at an Emcraft public Git repositories at https://gitlab.com.
Getting Access to Emcraft Yocto
Emcraft maintains and supports a Yocto layer for the Emcraft i.MX 8M Mini kit in a private repository at https://gitlab.com. This meta-layer is the Emcraft customization of the NXP Yocto build and software baseline for the i.MX 8M Mini microprocessor. The meta-layer is installed on top of the NXP Yocto distribution and build environment.
The Yocto layer for the Emcraft i.MX 8M Mini kit is available at the following gitlab location:
gitlab.com:/emcraft/imx8mm/cube/meta-emcraft-imx8mm.git
Setting Up Yocto Build Linux Host
The Yocto build for the target board is run on a Linux cross-development host. The following Linux hosts are explicitly validated and supported:
- Fedora 27 and later. Run the command below to install the packages necessary for the Yocto build:
[psl@i7 ~]$ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat \
python3-pexpect findutils which file cpio python python3-pip xz bzip2-devel zlib-devel
- Ubuntu 16.04 (LTS) and later. Run the command below to install the packages necessary for the Yocto build:
[psl@u16 ~]$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libbz2-dev libz-dev
[psl@u16 ~] sudo dpkg-reconfigure dash # Say "No" to use "dash" as the default system shell.
Setting Up Yocto Build
Perform the following step-wise procedure in order to set up the Yocto build for the target board. This procedure is performed only once, at the build setup time:
- Add the public ssh key from your build machine to your gitlab account.
- In an arbitrary directory on the Linux development host, set up the NXP Linux 5.4.3_1.0.0 Yocto build environment:
[psl@i7 ~]$ mkdir yocto-build && cd yocto-build
[psl@i7 yocto-build]$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-zeus -m imx-5.4.3-1.0.0.xml
[psl@i7 yocto-build]$ repo sync
...
[psl@i7 yocto-build]$ ls -l
lrwxrwxrwx 1 psl psl 43 May 13 16:44 imx-setup-release.sh -> sources/meta-imx/tools/imx-setup-release.sh
lrwxrwxrwx 1 psl psl 19 May 13 16:44 README -> sources/base/README
lrwxrwxrwx 1 psl psl 23 May 13 16:44 README-IMXBSP -> sources/meta-imx/README
lrwxrwxrwx 1 psl psl 30 May 13 16:44 setup-environment -> sources/base/setup-environment
drwxrwxr-x 14 psl psl 4096 May 16 16:37 sources
[psl@i7 yocto-build]$
For detailed information on specifics of the NXP Yocto distribution, refer to the NXP Linux 5.4.3 documentation available at: https://www.nxp.com/design/i-mx-developer-resources/i-mx-software-and-development-tools:IMX-SW.
- Install the Emcraft meta-emcraft-imx8mm layer on top of the NXP Yocto distribution:
[psl@i7 yocto-build]$ cd sources
[psl@i7 sources]$ git clone -b imx8m-ga-5.4.3-pmd https://gitlab.com/emcraft/imx8mm/cube/meta-emcraft-imx8mm.git
...
[psl@i7 sources]$ ls -l
total 48 drwxrwxr-x 4 psl psl 4096 May 13 16:44 base
drwxrwxr-x 8 psl psl 4096 May 13 16:44 meta-browser
drwxrwxr-x 7 psl psl 4096 May 14 20:01 meta-emcraft-imx8mm
drwxrwxr-x 23 psl psl 4096 May 13 16:44 meta-freescale
drwxrwxr-x 8 psl psl 4096 May 13 16:44 meta-freescale-3rdparty
drwxrwxr-x 7 psl psl 4096 May 13 16:44 meta-freescale-distro
drwxrwxr-x 7 psl psl 4096 May 13 16:44 meta-imx
drwxrwxr-x 14 psl psl 4096 May 13 16:44 meta-openembedded
drwxrwxr-x 13 psl psl 4096 May 13 16:44 meta-qt5
drwxrwxr-x 10 psl psl 4096 May 13 16:44 meta-rust
drwxrwxr-x 6 psl psl 4096 May 13 16:44 meta-timesys
drwxrwxr-x 12 psl psl 4096 May 13 16:44 poky
[psl@i7 sources]$ cd ..
[psl@i7 yocto-build]$
- Set up the build directory for the target board machine configuration:
[psl@i7 yocto-build]$ DISTRO=fsl-imx-wayland MACHINE=imx8mmcube2g EULA=yes source ./imx-setup-release.sh -b build-20191213
Note: By specifying EULA=yes in the above command you accept the NXP EULA (End User Licensing Agreement) located in sources/meta-freescale/EULA.
- Copy meta-emcraft-imx8/conf/local.conf.sample as conf/local.conf to your build directory:
[psl@i7 build-20191213]$ cp ../sources/meta-emcraft-imx8mm/conf/local.conf.sample conf/local.conf
- Edit conf/local.conf and adjust the DL_DIR variable to point to an arbitrary directory on your host. This is where Yocto will download the packages for the build.
- Optionally, enable the Yocto Shared State Cache directory (SSTATE_DIR). This will speed up builds.
- Add meta-emcraft-imx8mm to the end of conf/bblayers.conf:
...
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-filesystems "
BBLAYERS += " ${BSPDIR}/sources/meta-qt5 "
BBLAYERS += " ${BSPDIR}/sources/meta-emcraft-imx8mm "
Running Yocto Build
Perform the following step-wise procedure in order to run the Yocto build for the target board:
- Build the bootable U-Boot, Linux kernel and root filesystem images, as well as the uuu installation tool and script, using the meta-emcraft-imx8mm/recipes-core/images/image-emcraft.bb recipe:
[psl@i7 build-20191213]$ bitbake image-pmd uuu-native
...
Note: If you has opened a new terminal window on the host, or the Linux has been rebooted after the Yocto build directory was set up, the setup-environment script must be used to set up the environment variables and run the build again. The full imx-setup-release.sh is not needed:
[psl@i7 yocto-build]$ source setup-environmentÂ
[psl@i7 yocto-build]$
- Build the Yocto SDK if neccessary:
[psl@i7 build-20191213]$ bitbake -c populate_sdk image-pmd
...
Understanding Yocto Build Product Images
Output of the Yocto build documented in Section: "Running Yocto Build" is a set of the images in tmp/deploy/images/imx8mmcube2g and tmp/deploy/sdk directories:
- Image - Linux kernel image;
- imx8mm-cube-tof-a65.dtb - Linux Device Tree Blob (.dtb) image;
- imx-boot-imx8mmcube2g-sd.bin-flash_evk - U-Boot image;
- image-pmd-debug-imx8mmcube2g.tar.bz2 - Linux root filesystem image;
- image-pmd-debug-imx8mmcube2g.sdcard.bz2 - U-Boot, Linux kernel and root filesystem images, ready for installation to eMMC disk using the NXP uuu utility.
- fsl-imx-wayland-glibc-x86_64-image-pmd-debug-aarch64-toolchain-5.4-zeus.sh - Yocto SDK self-extracting archive.
An archive with pre-built Yocto image and uuu scripts can be downloaded from the following link (requires registration and login): https://emcraft.com/component/jdownloads/view.download/172/1295
Understanding Yocto Build Version
The Yocto build version is defined in the local.conf file as follows:
...
IMX_DISTRO_VERSION = "beta1-20200519"
CONFIG_LINUX_LOCALVERSION = "-${IMX_DISTRO_VERSION}"
CONFIG_UBOOT_LOCALVERSION = "${CONFIG_LINUX_LOCALVERSION}"
On the target, U-Boot reports the version of release running on the target as follows:
U-Boot 2019.04-beta1-20200519+gd62847f248 (May 19 2020 - 13:43:03 +0000)
...
After booting the target, the version will be displayed at the login prompt:
...
i.MX 8M Mini Distro Release beta1-20200519 imx8mmcube2g ttymxc1
imx8mmcube2g login:
From the Linux shell, the version of release running on the target can be obtained as follows:
root@imx8mmcube2g:~# uname -a
Linux imx8mmcube2g 5.4.3-beta1-20200519+ga922dd67988c #1 SMP PREEMPT Tue May 19 10:16:49 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux