How to Build Yocto

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 22.04 LTS 64-bit version for Yocto Project Build.

  • High speed network connectivity.

1.2 Essential host packages required to be installed in your host

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm zstd liblz4-tool curl git python-is-python3

Attention: Please Don’t use the root account to build Yocto, it might cause unpredictable errors.

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

Sections 1.4 and 1.5 may not be needed if the build setup already exists on your host.

$ mkdir ~/bin
$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin

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

$ git config --global "Your_Name"
$ git config --global "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 created “imx-yocto-bsp”

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

2.2 Start to download the source

$ repo init -u -b lec-imx-yocto-kirkstone -m adlink-lec-imx8mp-yocto-kirkstone_1v0.xml
$ repo sync
$ MACHINE=lec-imx8mp DISTRO=fsl-imx-wayland source -b <build_dir>

2.3 Required setting in conf/local.conf

Append the following to the conf/local.conf file in your Yocto build directory, to change DRAM size based on your module to the image.

$ vi <build_dir>/conf/local.conf

# sets the LPDDR4 DRAM size, available options are: LPDDR4_2GB, LPDDR4_4GB, LPDDR4_8GB

2.4 Start to build the image

$ bitbake imx-image-multimedia

When the image is successfully built without errors, it can be found under the following path.