Host Machine Setup for Yocto
Introduction
This article provides instructions on how to set up an environment to Build a Reference Image with Yocto, including the required host configuration and the installation of the bitbake-setup tool.
For an overview of Toradex BSP versions, Yocto layers, and Reference Images, refer to BSP Layers and Reference Images for Yocto Project - Overview.
This article complies with the Typographic Conventions for Toradex Documentation.
Prerequisites
From BSP version 8 onward, Toradex uses the bitbake-setup tool to configure the host machine and manage the Yocto build environment. The build instructions in this article therefore use bitbake-setup.
The repo tool used with earlier BSP versions remains available as an alternative to bitbake-setup. This article documents the workflow using bitbake-setup.
BitBake requires a Linux host machine to build Yocto images. Before starting the build, ensure that the host:
- Runs a supported Linux distribution;
- Meets the Yocto Project system requirements;
- Includes all required build host dependencies.
Configure the Git credentials and the locale settings after installing the required dependencies:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ sudo locale-gen en_US.UTF-8
$ sudo update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
Building on Virtual Machines, Containers and Cloud Builds
To build a Toradex Reference Image on a Virtual Machine, Container, or a public cloud provider, consider the following points:
- Virtual Machines (VM): Toradex does not recommends using a VM for building Yocto images, as it may lead to performance issues and longer build times.
- Containers: containers have a negligible performance penalty. Use bind-mounts or volumes to keep persistent data and reduce build time.
- Cloud Builds: cloud infrastructure providers have powerful machines that significantly reduce the build time for a Yocto Project build. Similar to containers, it is necessary to plan how to store the output of a build.
Set Up the Build Environment
The bitbake-setup tool acts as a top-level utility to set up the build environment for Yocto, performing the following tasks:
- Parse a JSON configuration file that describes what layers and which snippets of configuration to use
- Clone the layers at the versions specified in the configuration file
- Create and set up a directory ready for building what is specified in configuration files
- Behave according to global or per-project settings
- Synchronize with upstream configuration changes
Install the Setup Tool
To install the bitbake-setup tool in a Python virtual environment, run the following commands:
$ python3 -m venv --clear ./bitbake-setup-venv
$ source ./bitbake-setup-venv/bin/activate
$ pip install bitbake-setup
Run the following command to update the bitbake-setup tool:
$ pip install --upgrade bitbake-setup
Next Steps
After setting up the build environment, continue with the Build a Reference Image with Yocto documentation.