How to Build Yocto

The Yocto Project (YP) is an open source collaboration project that helps developers create custom Linux-based systems regardless of the hardware architecture. This procedure will help you build Yocto image for I-Pi SMARC IMX8M Plus.

1. Set up a build host environment

1.1 Recommended Hardware for the host

  • Intel Core-i7 Processor (>= 4 cores)
  • at least 8GB Memory
  • at least 500GB Disk space
  • Ubuntu 18.04 LTS 64bit or later version for Yocto Project Build
  • High speed network connectivity

1.2 Install the following packages in your host

Note:

In order to use the build system, your host development system must meet the following versions requirements for Git, tar and Python:

  • Git 1.8.3.1 or greater
  • tar 1.28 or greater
  • Python 3.5.0 or greater
$ python3 -V
$ sudo apt-get update
$ sudo apt-get install zstd
$ sudo apt-get install liblz4-tool
$ sudo apt install curl
$ sudo apt install git
$ git --version

1.3 Essential host Packages required to be installed in your host

$ sudo apt-get install gawk wget git git-core diffstat unzip texinfo gcc-multilib build-essential \
chrpath socat cpio python python3 python3-pip python3-pexpect \
python3-git python3-jinja2 libegl1-mesa pylint3 rsync bc bison \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm \
language-pack-en coreutils texi2html file docbook-utils \
python-pysqlite2 help2man desktop-file-utils \
libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake \
groff curl lzop asciidoc u-boot-tools libreoffice-writer \
sshpass ssh-askpass zip xz-utils kpartx vim screen
$ sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto

Note:

Please Don’t use the root account to build Yocto. It might cause unpredictable errors.

1.4 “Google repo” packages required to be installed in your host

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH

1.5 Before starting to build the source, make sure that git is set up properly with the commands below

$ git config --global user.name "Your_Name"
$ git config --global user.email "Your_Email"
$ git config --list

2. Fetch the source from the git location as below

2.1 Create the working directory as we have to create “imx-yocto-bsp”

$ mkdir imx-yocto-bsp
$ cd imx-yocto-bsp

2.2 **Start to download the source **

  • Attention: current default branch for build image is “hardknott”. For other branches build such as kirkstone, please refer to our ADLINK GitHub repository for paired manifest  .xml accordingly!
$ repo init -u https://github.com/ADLINK/adlink-manifest -b lec-imx-yocto-hardknott -m adlink-lec-imx8mp-yocto-hardknott_1v5.xml
$ repo sync
$ MACHINE=lec-imx8mp DISTRO=fsl-imx-xwayland source adlink-imx-setup-release.sh -b <build_dir>

2.3 Required setting in conf/local.conf

$ vi <build_dir>/conf/local.conf

# sets the LPDDR4 DRAM size, available options are: LPDDR4_2GB, LPDDR4_2GK, LPDDR4_4GB, LPDDR4_8GB
UBOOT_EXTRA_CONFIGS = "LPDDR4_2GB"

3. Build the Image

Choose the Image recipe with the supported hardware

Module name Yocto branch bitbake command
lec-imx8mp + wayland desktop (GUI) + weston graphics hardknott $ bitbake imx-image-full
lec-imx8mp + wayland desktop (GUI) + weston graphics hardknott $ bitbake imx-image-multimedia
lec-imx8mp + console (CLI) hardknott $ bitbake core-image-minimal
lec-imx8mp + xwayland desktop (GUI) + wayland graphics and X11 hardknott $ bitbake imx-image-full
lec-imx8mp + xwayland desktop (GUI) + wayland graphics and X11 hardknott $ bitbake imx-image-multimedia

Run the following command on your host system to provoke the yocto image building process.

$ bitbake imx-image-full

After the build is complete, disk images will be located at work-dir/build-dir/tmp/deploy/image/lec-imx8mp/

3.1 Image is generated as wic.bz2, use below command to unzip

$ bunzip2 -dk -f <image_name>.wic.bz2

4. Next action deploying the image

  • Deploying the image through SD card.

  • Deploying the image through eMMC.