Yocto Project Minimal Build

Posted in

Published: January 7th, 2024

Last modified: January 7th, 2024

Many people think that Poky is the easiest way to build a distribution with the Yocto Project. Poky is easy to build, but there’s a simple way to build a minimal image that takes even less time!

This minimal image includes OE (OpenEmbedded) core and bitbake. Those two repositories contain all you need to boot. I use such a minimal build to test changes in the main components of the OE (like the cve-check), test kernel updates, and more.

The advantage of the minimal build is that it is faster and takes less space than Poky. It also contains fewer packages, so you can customize it to fit your needs better. It is also a base of secure distros I build.

Before you start

I assume you have installed all the dependencies for the Yocto Project.

Getting the code

The commands to use are:

First clone all needed repositories:

git clone git://git.openembedded.org/openembedded-core
cd openembedded-core
git clone git://git.openembedded.org/bitbake
cd ..

(Optional) Switch to other release

If you want to use a different branch than master, like one of the LTS versions, you need to switch branches.

For openembedded-core, use branches like master, scathgap etc.

git checkout scarthgap

For bitbake, find the bitbake version corresponding to the YP release from https://wiki.yoctoproject.org/wiki/Releases


In our example, scarthgap corresponds to bitbake 2.8, so you can do:

cd bitbake
git checkout 2.8
cd ..

Configure your build environment

Now configure your build environment with:

source ./oe-init-build-env

This command will set up the environment, set you up the ‘build’ directory and move you to that directory (in simple terms you will be in your openembedded-core/build )

At this point you might want to adjust variables in your local.conf

I recommend having $DL_DIR and $SSTATE_DIR pointing each to one specific directory on your machine that you use for all builds.

When you have finished with local.conf (that is located in conf/local.conf)

Build it!

Then build your image as usual

bitbake core-image-minimal

DONE!

Hint: you can also use this method to test experimental features of the YP by testing branches like master-next

Leave a Reply

Your email address will not be published. Required fields are marked *