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

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2025/12/16 DESK-RX-L-1.0.0 release



Building the Yocto BSP[edit | edit source]

Quick reference[edit | edit source]

Repository Information
Repository Yocto BSP Layer
URL https://git.dave.eu/git/desk-rz-l/meta-desk-rz.git
stable branch desk-rz-l-1.x.x
stable tag desk-rz-l-1.0.1
Build targets
Name Description
desk-image-devel This image includes tools for development/debugging

Introduction[edit | edit source]

As is known, in addition to a bootloader and the OS. An embedded Linux system, such as a kernel, requires 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-RZ-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-rz-l-1.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>/rootfs/.

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 access to the DAVE Embedded Systems' git repositories. Access to such repositories is granted to the 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 is also recommended to consider the use of a physical machine.

Initialize the build environment[edit | edit source]

Check that the following packages are installed:

dvdk@vagrant:~$ sudo apt-get update && sudo apt install  bc bmap-tools cpio curl debianutils gawk gcc git git-core iperf3 iputils-ping libc6-dev-i386 libncurses5-dev libyaml-dev libtinfo5 lintian mesa-common-dev p7zip-full picocom python python3 python3-jinja2 python3-pexpect python3-pip python3-subunit pylint3 sudo u-boot-tools unzip vim virtualenv wget xz-utils chrpath texinfo diffstat zstd gcc-multilib libegl1-mesa libgmp-dev libmpc-dev libsdl1.2-dev pylint python3-git socat xterm libpulse-dev gdb libssl-dev libelf-dev libncurses-dev build-essential lzop python-yaml gparted syslinux pxelinux net-tools

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

dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ rm -rf venv/
dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ virtualenv -p /usr/bin/python3 venv
created virtual environment CPython3.8.10.final.0-64 in 374ms
  creator CPython3Posix(dest=/home/dvdk/desk-rz-l/meta-desk-rz/venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/dvdk/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ source venv/bin/activate
(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ pip install kas==3.2
Processing /home/dvdk/.cache/pip/wheels/d5/02/dd/e144e9739df0fafa1eaa987b8ce055da75ef433941a9f95fcb/kas-3.2-py3-none-any.whl
Collecting jsonschema<4,>=2.5.0
  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Collecting kconfiglib<15,>=14.1.0
  Using cached kconfiglib-14.1.0-py2.py3-none-any.whl (145 kB)
Collecting PyYAML<6,>=3.0
  Using cached PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB)
Collecting distro<2,>=1.0.0
  Using cached distro-1.9.0-py3-none-any.whl (20 kB)
Collecting pyrsistent>=0.14.0
  Using cached pyrsistent-0.20.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (121 kB)
Requirement already satisfied: setuptools in ./venv/lib/python3.8/site-packages (from jsonschema<4,>=2.5.0->kas==3.2) (44.0.0)
Collecting six>=1.11.0
  Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting attrs>=17.4.0
  Using cached attrs-25.3.0-py3-none-any.whl (63 kB)
Installing collected packages: pyrsistent, six, attrs, jsonschema, kconfiglib, PyYAML, distro, kas
Successfully installed PyYAML-5.4.1 attrs-25.3.0 distro-1.9.0 jsonschema-3.2.0 kas-3.2 kconfiglib-14.1.0 pyrsistent-0.20.0 six-1.17.0
(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$

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-RZ-L machine
(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ kas build desk-rz-l_devel.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 order to get the corresponding SDK, perform the following command:

  • for DESK-RZ-L machine
(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ KAS_TASK="populate_sdk" kas build desk-rz-l_devel.yml

Generating the Toolchain[edit | edit source]

The toolchain can be created by the following command:

  • for DESK-RZ-L machine
(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ KAS_TARGET="meta-toolchain" kas build desk-rz-l_devel.yml

Building additional packages[edit | edit source]

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

(venv) dvdk@vagrant:~/desk-rz-l/meta-desk-rz$ KAS_TARGET="memtester" kas build desk-rz-l_devel.yml

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