DESK-MX9-L/Development/Building the Yocto BSP

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2024/01/31

DESK-MX9-L-5.0.0 release

2024/04/09

DESK-MX9-L-5.1.0 release
2025/03/14 DESK-MX9-L-5.2.0 release



Building the Yocto BSP[edit | edit source]

Quick reference[edit | edit source]

Repository Information
Repository Yocto BSP Layer
URL git@git.dave.eu:desk-mx-l/meta-desk-mx.git
stable branch desk-mx9-l-5.x.x
stable tag desk-mx9-l-5.2.0
Build targets
Name Description
dave-image-devel This image include tools for development/debugging
desk-image-qt6 This image include a Qt6 graphic backend on Wayland compositor

Introduction[edit | edit source]

As known, in addition to a bootloader and the o.s. kernel, an embedded Linux system needs a root file system to operate. The root file system must contain everything needed to support the Linux system (applications, settings, data, etc.). The root file system is the file system that is contained on the same partition on which the root directory is located. The Linux kernel, at the end of its startup stage, mounts the root file system on the configured root device and finally launches the /sbin/init, the first user space process and "father" of all the other processes. For more information on the Linux filesystem, please refer to http://www.thegeekstuff.com/2010/09/linux-file-system-structure/.

DESK-MX9-L provides one (or more) pre-built root file system, that can be used during the evaluation/development/deployment cycle. For instance, the root file system included in the desk-mx9-l-5.x.x-image-devel image is suited for the development phase, since it provides a relatively rich set of packages including tools and libraries used to debug the application code. The pre-built root file systems are located here: /home/dvdk/<target_name>/rfs/<kit_name>/.

To generate the supported root file systems, the build of the Yocto BSP has to be run. The output of this process is an image containing the U-Boot binary file, the Linux kernel image, and the selected root file system image. The following sections describe in detail how to execute this operation.

For more general information regarding the Yocto build system, please refer the dedicated category page.

How to build the Yocto BSP images including the U-Boot binary file, the Linux kernel image, and the target root file system image with KAS[edit | edit source]

200px-Emblem-important.svg.png

The following procedure requires the access to the DAVE Embedded Systems' git repositories. The access to such repositories is granted to development kit's owners only. Please refer to this page for detailed instructions on how to get it.


200px-Emblem-important.svg.png

This process requires a lot of hardware resources in terms of disk storage, RAM, and processing power. For this reason, it also is recommended to consider the use of a physical machine. For more details on this topic, please refer to the NXP documentation on this BSP, i.e. the i.MX Yocto Project User's Guide, which talks about the host setup for the Yocto build system.

Initialize the build environment[edit | edit source]

Check that the following packages are install:

dvdk@vagrant:~$ sudo apt-get update && sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool virtualenv

Before running the build, the KAS environment must be initialized properly.

dvdk@vagrant:~$ virtualenv -p /usr/bin/python3 venv
created virtual environment CPython3.8.10.final.0-64 in 351ms
  creator CPython3Posix(dest=/home/dooraim/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/dooraim/.local/share/virtualenv)
    added seed packages: pip==24.0, setuptools==69.1.1, wheel==0.42.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
dvdk@vagrant:~$ source venv/bin/activate
(venv) dvdk@vagrant:~$ pip3 install kas==3.2.3
Collecting kas==3.2.3
  Downloading kas-3.2.3.tar.gz (33 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting distro<2,>=1.0.0
  Downloading distro-1.9.0-py3-none-any.whl (20 kB)
Collecting kconfiglib<15,>=14.1.0
  Downloading kconfiglib-14.1.0-py2.py3-none-any.whl (145 kB)
     |████████████████████████████████| 145 kB 9.7 MB/s
Collecting PyYAML<6,>=3.0
  Downloading PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
     |████████████████████████████████| 662 kB 17.7 MB/s
Collecting jsonschema<4,>=2.5.0
  Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 1.4 MB/s
Collecting six>=1.11.0
  Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting attrs>=17.4.0
  Downloading attrs-25.3.0-py3-none-any.whl (63 kB)
     |████████████████████████████████| 63 kB 751 kB/s
Collecting pyrsistent>=0.14.0
  Downloading pyrsistent-0.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (121 kB)
     |████████████████████████████████| 121 kB 17.9 MB/s
Requirement already satisfied: setuptools in ./venv/lib/python3.8/site-packages (from jsonschema<4,>=2.5.0->kas==3.2.3) (44.0.0)
Building wheels for collected packages: kas
  Building wheel for kas (PEP 517) ... done
  Created wheel for kas: filename=kas-3.2.3-py3-none-any.whl size=51547 sha256=3c4a40e00e085a563e1766ddd2ba6f0c70fa5a646bf0c63b9936a513c18aa9a0
  Stored in directory: /home/norlando/.cache/pip/wheels/73/96/a8/6863bdbd951d017f6710f796605142cfa4b97316a1936cfb90
Successfully built kas
Installing collected packages: distro, kconfiglib, PyYAML, six, attrs, pyrsistent, jsonschema, kas
Successfully installed PyYAML-5.4.1 attrs-25.3.0 distro-1.9.0 jsonschema-3.2.0 kas-3.2.3 kconfiglib-14.1.0 pyrsistent-0.20.0 six-1.17.0

then, create an working directory and fetch the meta-desk-mx repositories with the proper branch:

(venv) dvdk@vagrant:~$ mkdir desk-mx-l/yocto
(venv) dvdk@vagrant:~$ cd desk-mx-l/yocto
(venv) dvdk@vagrant:~/desk-mx-l/yocto$ git clone git@git.dave.eu:desk-mx-l/meta-desk-mx.git -b desk-mx9-l-5.2.0

Running the build[edit | edit source]

Please note that even the basic root file system requires a few hours to build on a mid/hi range desktop (4-6 cores, 8-12 GiB RAM) also depending on your Internet connection speed (all sources are fetched from the network). Nearly 200GiB of disk space is required for the build; this means that an external VDI disk should be created and mounted for a complete Yocto build. The process may be slowed down significantly since the performances of a virtual machine are reduced if compared to the physical hardware. Thus, it's recommended to check the hardware capabilities of the host system and, when building with Yocto is required, to consider the following options:

  • Migrating the build system to a physical machine
  • Assuming that the host system has the required resources, extending the hardware capabilities of the default MVM (e.g. adding more cores and disk space).

Once completed the initialization phase, developers can launch the Yocto image build with KAS, with the following commands:

  • for build dave-image-devel image with DESK-MX9-L machine
(venv) dvdk@vagrant:~/desk-mx-l/yocto/meta-desk-mx$ kas build kas/desk-mx93-rev1_dave-image-devel_wayland.yml

Once the build process is completed, the resulting files (the U-Boot binaries, the Linux kernel image, the device tree blob, the .tar.gz compressed root file system image, etc.) will be available in build/tmp/deploy/images/<machine_name>.

Generating the SDKs[edit | edit source]

In way to get the corresponding SDK for QT6, perform the following command:

  • for DESK-MX9-L machine
(venv) dvdk@vagrant:~/desk-mx-l/yocto/meta-desk-mx$ KAS_TASK="populate_sdk" kas build kas/desk-mx93-rev1_desk-image-qt6_wayland.yml

Generating the Toolchain[edit | edit source]

Toolchain can be created by the following command:

  • for DESK-MX9-L machine
(venv) dvdk@vagrant:~/desk-mx-l/yocto/meta-desk-mx$ KAS_TARGET="meta-toolchain" kas build kas/desk-mx93-rev1_dave-image-devel_wayland.yml

Building additional packages[edit | edit source]

To build additional packages, for example memtester the user need to perform the following command

(venv) dvdk@vagrant:~/desk-mx-l/yocto/meta-desk-mx$ KAS_TARGET="memtester" kas build kas/desk-mx93-rev1_dave-image-devel_wayland.yml

The resulting packages (the default format is deb) can be found inside build/tmp/deploy/deb.