How to install packages in Yocto Project


The Yocto Project® (YP) is an open source collaboration project that helps developers create custom Linux-based systems regardless of the hardware architecture.

The project provides a flexible set of tools and a space where embedded developers worldwide can share technologies, software stacks, configurations, and best practices that can be used to create tailored Linux images for embedded and IOT devices, or anywhere a customized Linux OS is needed.

This is a high-level tutorial and the intention is not to cover the Yocto Project in depth. If you are interested in detailed information, we recommend that you read the Yocto Project Mega-Manual.

This tutorial will cover how to add packages to any given image utilizing local.conf.



To follow this tutorial, you will need:


For the sake of this tutorial lets set a couple of requirements that we want to accomplish on our target device.

We would like our image to contain the following:

  • inotify-tools

inotify-tools is a C library and a set of command-line programs for Linux providing a simple interface to inotify. These programs can be used to monitor and act upon filesystem events

Additionally we would like the following packages that are suitable for development:

  • SSH server running on the device
  • gdb, gdbserver and strace installed on the device
  • evtest, i2c-tools, ethtool, fbset, memtester
    • these are all applications useful during testing debugging various parts of the system

Building a package

Bitbake supports building individual packages. In the following example I will compile and package inotify-tools:

bitbake inotify-tools

This will not include inotify-tools in any image and it will only create a inotify-tools package, one can actually inspect and see that it created several packages:

ls -1 tmp/deploy/rpm/*/inotify-tools-*

NOTE! The cortexa7t2hf_neon_vfpv4 architecture string might be different in your environment depending on what device you are targeting.

I will not cover in detail how these where created but if you are interested there is a very detailed explanation in the Yocto Project Mega Manual that explains all the steps executed when we ran bitbake dropbear.

How to figure out what packages are available?

Before we move on, I wanted to quickly cover some tricks on how to look up what packages actually are available within Yocto as this is not not always to figure out, especially since you might not have that specific layer in your environment that provides a recipe for the desired package.

The best tool for looking up recipes/packages is the OpenEmbedded Layer Index which keeps an index of all provided packages of the layers that are registered at the site (most are).

If you are interested in getting a list of available packages in your current environment you can run:

bitbake-layers show-recipes

The output of above command can of course be filtering using some simple shell tricks, e.g to find provided python3 modules you can run:

bitbake-layers show-recipes | grep python3-*

Customizing images using local.conf

The simplest way of adding a package to an image target is with small modification to local.conf.

A simple way of ensuring that inotify-tools is installed to any give image is by adding the following to local.conf:

echo 'IMAGE_INSTALL_append = " inotify-tools"' >> conf/local.conf
  • IMAGE_INSTALL - Image recipes set IMAGE_INSTALL to specify the packages to install into an image.

  • _append - This is an override that will append the specific string to a variable. The space at the beginning is important!

And if we now build core-image-base it will have included the inotify-tools:

bitbake core-image-base

We can add one more entry to add the packages that we want for our development image:

echo 'IMAGE_INSTALL_append = " dropbear gdb gdbserver strace evtest i2c-tools ethtool fbset memtester"' >> conf/local.conf

With these changes we are ensuring that regardless what image you build the above defined packages will be included.

NOTE! local.conf is considered a “local file” and any changes made to this file are not preserved should you reset your build environment. It is also encouraged not to try to use this file for any other purpose then temporary local modifications. Have a look at the How to create custom images using Yocto Project tutorial which covers how do accomplish a similar result as defined here in a more sustainable way.


In this tutorial we have covered the basics of how install packages utilizing local.conf in the Yocto Project, in the hopes that it will help you get started quickly without need of digging to deep in Yocto Project internals.

For further reading visit:

1 Like