Yocto: Part 2 – Setting up Ubuntu host

In the last post, we introduced the Yocto Project and discussed topics like open-embedded, poky, bitbake, recipes and so on. If you missed that post, check it out here!

In this post, we discuss the process of setting up an Ubuntu host to perform your Yocto builds. According to the documentation of the Yocto Project, Ubuntu is a supported linux distribution on the host side, although not all versions are equally supported. It is recommended to use LTS versions as your host build PC. You can see the list of supported linux distributions here. In this post we talk about setting up your PC running Ubuntu 20.04 LTS as the operating system.

Absolute Minimum Requirements

Free Memory Requirement

It is recommended to have at least 50 GB free memory on your hard disk. The more free memory, the more future proof your builds would be!

Software Tools Requirement

The most essential software tools for performing Yocto builds on your PC, you need the below. These are common across all kinds of hosts including Ubuntu 20.04.

  1. Git: As we saw in the last post, git is used to fetch the source code from various software repositories.
  2. Tar: Most source code is downloaded as a tarball to minimise data usage and make the fetch faster.
  3. Python3: Although Ubuntu should already have Python3 installed, it does not hurt to check that the installation is good and the version is >= Python 3.6.0
  4. Gcc: The toolchain used to perform the humongous amount of builds as a part of the package generation and finally image generation process is gcc.

To install these software tools, execute the below commands. For the second command, you may need to press the Enter/Return key when prompted by the package manager to fetch the packages and install them.

$ sudo apt update
$ sudo apt install git git-lfs tar python3 python3-pip gcc

Ubuntu-specific package requirements

Essential Packages Requirement

Other than the minimum requirements listed above, you also need certain host packages to perform yocto builds successfully. These packages are required in the various steps (1 to 8) as listed in the previous post.

To install these packages, execute the below command and press the Enter/Return key when prompted by the package manager to fetch the packages and install them.

$ 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

You may have noticed that the python3 and python3-pip are present in this command as well – this is not a problem as the package manager will simply skip them if they are already installed!

Documentation Packages Requirement (OPTIONAL)

Yocto releases also contain the source of the documentation. You can generate this documentation yourself and also optionally, add your own documentation into the mix using – you guessed it – your own meta layer! Some packages are needed to be able to build the Yocto documentation.

To install these packages, execute the below command and press the Enter/Return key when prompted by the package manager to fetch the packages and install them.

$ sudo apt install make python3-pip
$ sudo pip3 install sphinx sphinx_rtd_theme pyyaml

Depending on your internet speed, it can take anywhere between 5 to 15 minutes to perform the above steps. Once done, you have successfully set up your Ubuntu 20.04 PC for your first Yocto build!

The process of install all the above software packages is captured in the below screencast.

Do subscribe to KickstartEmbedded on YouTube!

What’s Next?

In the next post, we will download the Yocto sources and try to do our first basic Yocto build and run the resulting image generated at the end of this build.

5 thoughts on “Yocto: Part 2 – Setting up Ubuntu host

Leave a Reply