How to Build Yocto

The Yocto Project provides open-source tools for developers to customize Linux-based systems regardless of the architecture. With this procedure, you will be able to build a Yocto image for I-Pi SMARC 1200.

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 64bit or later version for Yocto Project Build
  • High speed network connectivity

1.2 Essential host Packages required to be installed in your host

$ sudo apt update && sudo apt upgrade
$ sudo apt install gawk wget git-core diffstat unzip gcc-multilib build-essential chrpath socat cpio python3-pip xz-utils debianutils iputils-ping python3-jinja2 libsdl1.2-dev xterm zstd liblz4-tool curl git

Note:

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

1.3 Setup the GitHub account in the Host

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

Generate the SSH key [inside the double quotes put your git_user_mail].

$ ssh-keygen -t rsa -C "git_user_mail"

Copy the generated SSH key and add into your GitHub account.

$ cat ~/.ssh/id_rsa.pub
  • Attention: For security reasons, the repositories are private, so they need to be accessed for building the image. Let us know your GitHub username. Please leave a mail to ipi.wiki@adlinktech.com. Your account will be added to the Adlink 1200 private repository. An error may occur if you don’t have access.

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

$ mkdir -p ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH="~/bin:$PATH"

2. Fetch the source from the git location as below

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

Note: If you’re using external drive to build the image it must be Ext4 format. FAT and eXFAT formats are not supported.

$ mkdir mtk_1200_bsp
$ cd mtk_1200_bsp

2.2 Start to download the sources

  • Attention: current default branch for build image is “kirkstone”. For other branches build, please refer to our ADLINK GitHub repository for paired manifest  .xml accordingly!
$ repo init -u https://github.com/ADLINK/adlink-manifest.git -b rity-kirkstone-v22.2 -m 2v7.xml
$ repo sync

You can verify the cloning access by following the below commands and say yes to clone it.

$ git clone git@github.com:ADLINK/u-boot-mtk.git
$ rm -rfv u-boot-mtk

Setup the build machine

$ source setup_adlink_env.sh -b mtk_yocto

Required modification in conf/local.conf for storage memory.

$ vi <build_dir>/conf/local.conf
IMAGE_ROOTFS_EXTRA_SPACE = "40000000"

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

$ bitbake rity-demo-image

After the build is complete, disk images will be located at work-dir/build-dir/tmp/deploy/images/lec-mtk-i1200-ufs/

3. Flashing the build

Go to the image build directory. Replace with your directory path [work-dir/build-dir].

$ cd work-dir/build-dir/tmp/deploy/images/lec-mtk-i1200-ufs/

Flashing the image on UFS click here.