Reader small image

You're reading from  Using Yocto Project with BeagleBone Black

Product typeBook
Published inJun 2015
Reading LevelIntermediate
Publisher
ISBN-139781785289736
Edition1st Edition
Languages
Right arrow
Authors (2):
Irfan Sadiq
Irfan Sadiq
author image
Irfan Sadiq

H M Irfan Sadiq was a Linux enthusiast as a graduate student. He started his career as an embedded system development engineer and has been working as an H.264 Decoder developer and optimizer for the VLIW architecture. He got an opportunity to work on multiple multimedia frameworks that are open source as well as proprietary. He tried to work in a start-up in the entirely different domain of web development. He has been working on OpenEmbedded and Yocto Project technologies since he joined Mentor Graphics as the technical lead back in 2010. He has been working on derivative technologies of Yocto Project and OpenEmbedded for quite some time now, spanning more than 4 years. He has also been working on various hardware platforms based on the ARM, PPC, and x86 architecture. The diverse nature of subsequent BSPs has challenges in the context of QA. One of the challenges was to keep the QA packages in one place in such a way that they could be applied to all different product/platform combinations. He addressed this by creating a Yocto Project-based layer for which he is a maintainer as well as a gatekeeper.
Read more about Irfan Sadiq

View More author details
Right arrow

Chapter 2. What's BitBake All About?

In the previous chapter, we created a working image for BeagleBone using Yocto Project. We also briefly discussed the different concepts while working on the exercises. In this chapter, we will move one step ahead by detailing different aspects of the basic engine behind Yocto Project, and other similar projects. This engine is BitBake. Covering all the various aspects of BitBake in one chapter is not possible; it will require a complete book. We will familiarize you as much as possible with this tool.

We will cover the following topics in this chapter:

  • A brief history of BitBake

  • Legacy tools and BitBake

  • Execution of BitBake

  • BitBake options

A brief history of BitBake


BitBake drew inspiration from the Gentoo package management tool, Portage. Gentoo has a unique philosophy of building binaries on the system where they are supposed to run, so that maximum optimizations can be applied to the code. This philosophy fits best in the case of embedded systems, where you always have a different set of hardware in hand, and you need to prepare board support packages for that hardware. Initially, BitBake was a part of OpenEmbedded.

Later on, an OpenEmbedded project team member, Chris Larson, split it into two separate pieces:

  • BitBake: This is a generic task executor

  • OpenEmbedded: This is a metadata set utilized by BitBake

Now, BitBake is the base for OpenEmbedded and Yocto Project, which are being used to build and maintain multiple Linux distributions.

Legacy tools and BitBake


This discussion does not intend to invoke any religious row between other alternatives and BitBake. Every step in the evolution has its own importance, which cannot be denied, and so do other available tools. BitBake was developed keeping in mind the Embedded Linux Development domain. So, it tried to solve the problems faced in this core area, and in my opinion, it addresses these in the best way till date. You might get the same output using other tools, such as Buildroot, but the flexibility and ease provided by BitBake in this domain is second to none. The major difference is in addressing the problem. Legacy tools are developed considering packages in mind, but BitBake evolved to solve the problems faced during the creation of BSPs, or embedded distributions. Let's go through the challenges faced in this specific domain and understand how BitBake helps us face them.

Cross-compilation

BitBake takes care of cross compilation. You do not have to worry about it for...

BitBake execution


To get us to a successful package or image, BitBake performs some steps that we need to go through to get an understanding of the workflow. In certain cases, some of these steps can be avoided; but we are not discussing such cases, considering them as corner cases. For details on these, we should refer to the BitBake user manual.

Parsing metadata

When we invoke the BitBake command to build our image, the first thing it does is parse our base configuration metadata. This metadata, as we have already seen in the previous chapter, consists of build_bb/conf/bblayers.conf, multiple layer/conf/layer.conf, and poky/meta/conf/bitbake.conf. This data can be of the following types:

  • Configuration data

  • Class data

  • Recipes

Key variables BBFILES and BBPATH, which are constructed from the layer.conf file. Thus, the constructed BBPATH variable is used to locate configuration files under conf/ and class files under class/ directories. The BBFILES variable is used to find recipe files (.bb and...

BitBake options


BitBake also follows the standard of the -h or --help option. So, anytime, we can list all the available options by running BitBake with any of these options. Thus, we won't get into their details. We will try to discuss only those options that we will encounter most, or we need the most. Another standard or generic option is to get the --version version of BitBake, which is also available. We used the simplest form of BitBake in the previous chapter to build our images:

$ bitbake core-image-sato

Here, core-image-sato was the name of the image recipe we were building.

The format of bitbake command as inferred from bitbake -h is as follows:

Usage: bitbake [options] [recipe name/target …]

In the preceding example, we did not provide any option, as it was not required in the scenario we were building.

Now, issue BitBake with -h, as shown here from the build directory that we created in the first chapter:

$ bitbake -h 

We will skip the output here due to the length and discuss some...

Summary


In this chapter, we discussed a brief history of BitBake. You learned the goals and problem areas that BitBake has considered, thus making itself a unique option for Embedded Linux Development. You also learned how BitBake actually works. Finally, we went through different options of BitBake, using examples to illustrate the important ones.

In the next chapter, you will learn how to create a basic hello world recipe and discuss its different elements.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Using Yocto Project with BeagleBone Black
Published in: Jun 2015Publisher: ISBN-13: 9781785289736
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Irfan Sadiq

H M Irfan Sadiq was a Linux enthusiast as a graduate student. He started his career as an embedded system development engineer and has been working as an H.264 Decoder developer and optimizer for the VLIW architecture. He got an opportunity to work on multiple multimedia frameworks that are open source as well as proprietary. He tried to work in a start-up in the entirely different domain of web development. He has been working on OpenEmbedded and Yocto Project technologies since he joined Mentor Graphics as the technical lead back in 2010. He has been working on derivative technologies of Yocto Project and OpenEmbedded for quite some time now, spanning more than 4 years. He has also been working on various hardware platforms based on the ARM, PPC, and x86 architecture. The diverse nature of subsequent BSPs has challenges in the context of QA. One of the challenges was to keep the QA packages in one place in such a way that they could be applied to all different product/platform combinations. He addressed this by creating a Yocto Project-based layer for which he is a maintainer as well as a gatekeeper.
Read more about Irfan Sadiq