Yocto Project – Build your custom linux

Overview

Scene – 1

Imagine you are one of the naive chefs who is tasked to bake a wedding cake.

Yes, you do have some understanding of how cakes are made (let’s say you’ve watched some videos).

Boy, now you are tasked by your boss to make a whole wedding cake and you know that you can’t screw this up.

First thing that you’d like to do is search for something online and get some help. Perhaps, understand some procedure one can take off-the-shelf and bake something out.

Someone told you that you can get a base cake built from a local bakery shop. This allows you to make whatever cake you’d like – be it a birthday cake or a wedding cake.

Scene – 2

Imagine you are a software engineer tasked to build – wait-for-it – custom Linux distribution.

Yeah!

If you could get your custom suit made from your favourite tailor, your clients can surely demand a teeny-tiny custom Linux distribution from a talented software engineer like you.

Ah, and dare you refuse it. (The naive chef didn’t refuse to make a wedding cake).

Hmm. So what do you do ?

Google Search and see if someone’s built something similar. (That’s such a smart move! Yo, mama will be so impressed)

Voila, you discover Yocto Project

Yocto – Build your custom linux

The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create a custom Linux-based systems for embedded products regardless of the hardware architecture. The toolsets in Yocto project allows users to support multiple hardware and software configurations.

Yocto Project evolved from initial efforts of OpenEmbedded, the build framework for embedded Linux.

Poky is a reference implementation which is always maintained with every release of Yocto. You can take Poky as your base layer and build a custom one for yourself.

Yocto acts as the foundation for many other embedded operating systems including Ostro, Wind River Linux, and Tizen, therefore acting as a mechanism for sharing best practices and code, benefitting all the resulting operating systems.

Who is using Yocto ?

Balena-OS is a Yocto based operating system. It’s a container focussed operating system for embedded devices.

Tizen aims to use Yocto Project to build Tizen images. Currently it uses OBS (Open Build Service) to build images but also supports building images using Yocto. Tizen on Yocto Project is a work in progress which will make Yocto as the main build system along with OBS as an alternative.

WindRiver Linux is a linux offering by WindRiver based on Yocto Project. WindRiver is Yocto Project founding member and the maintainer of key components. You can read more about WindRiver’s contribution to Yocto Project here.

Ecosystem showcase on Yocto Project website also lists a few projects built using it.

How to get started ?

The Yocto Project’s “Getting Started” guide is a good place to build your first linux distribution. Let’s dive into what are major components in building a Linux image using Yocto.

Yocto Components to build a Linux Image

1. Layer Model – Key to customisation

Layer model is what distinguishes Yocto from other build systems. Layers is a collection of files which tells the build system what customisations you’d like in your linux image.

These layers are processed by the build system to generate a custom linux image.As an example, you could have BSP, GUI, distro configuration, middleware, or application layers.

2. Build System

Yocto Project uses BitBake as it’s build tool. It’s a scheduler and execution engine which parses instructions (recipes) and configuration data.

7 step build workflow in BitBake of Yocto Project

For more detailed information on how to use BitBake, refer to its user manual.

Conclusion

Yocto is a great project for someone looking to build their own linux distribution. It is particularly useful for companies looking to ship their linux distribution and need to maintain it for various boards/hardware architecture.

It’s layered model for building an image ensures consistency across build revisions. The community supported board support packages(BSPs) make it easy for a developer to create an image on top of Poky, a reference implementation.

It does have a steep learning curve but the detailed documentation and user manual does provide a direction to a developer who is just getting started.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.