Book Image

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

By : Alex Gonzalez
Book Image

Embedded Linux Development Using Yocto Project Cookbook - Second Edition

By: Alex Gonzalez

Overview of this book

The Yocto Project has become the de facto distribution build framework for reliable and robust embedded systems with a reduced time to market.You'll get started by working on a build system where you set up Yocto, create a build directory, and learn how to debug it. Then, you'll explore everything about the BSP layer, from creating a custom layer to debugging device tree issues. In addition to this, you’ll learn how to add a new software layer, packages, data, scripts, and configuration files to your system. You will then cover topics based on application development, such as using the Software Development Kit and how to use the Yocto project in various development environments. Toward the end, you will learn how to debug, trace, and profile a running system. This second edition has been updated to include new content based on the latest Yocto release.
Table of Contents (13 chapters)
Title Page
Packt Upsell


A few years ago, embedded would have been a synonym for a small, resource-constrained, dedicated system. Nowadays, it's easy to find embedded systems with 1 GB or more of memory, plenty of storage, and dedicated hardware accelerators for things such as graphics, video, cryptography, and even high-end 64-bit multicore systems.

The embedded space is split between small microcontroller-based systems that are direct successors of the embedded systems from a few years back, and a new generation of embedded Linux-based systems which require a different set of tools, skills, and workflows to develop them.

Since the first edition of this book was published, the embedded Linux space has started to be influenced by young engineers with roots in the maker movement who are used to the rapid prototyping of products and ideas with Raspberry Pi-like hardware and PC-like distributions such as Debian, as well as the emergence of the Internet of Things as a disruptive force. This has brought the security of always-available, cloud-connected embedded devices to the front line, but has also blurred the line between professional embedded Linux systems and hobbyist products.

Still, professional embedded systems have a distinct set of requirements that are common to all of them:

  • Industrial specifications, robustness, and reliability
  • Dedicated optimized applications
  • Security guarantees
  • Remote and secure over-the-air updates
  • Power management considerations
  • Fast startup time
  • Graphical user interfaces
  • Some degree of real-time capabilities
  • Long maintenance of line both for hardware and software, usually above 5 years.

When designing embedded products with the preceding requirements in mind, it is clear that educational hardware and desktop-oriented distributions are never going to be able to provide the level of control, configurability, and flexibility needed to design a professional embedded product.

This is why the Yocto Project remains the chosen embedded Linux builder for professional systems. It's flexibility and scalability allows it to build resource-constrained low-end to high-end embedded Linux products and adapt software accordingly.

In this new edition, the content has been completely reviewed and updated to the Yocto Project 2.4 release, and new content has been added to address some of the changes and trends that have appeared since the first edition was published.

Who this book is for

This book is the ideal way for embedded developers learning about embedded Linux and the Yocto project to become proficient and broaden their knowledge with examples that are immediately applicable to embedded developments.

Experienced embedded Yocto developers will find new insights into working methodologies and ARM-specific development competence.

What this book covers

Chapter 1, The Build System, describes and uses the Poky build system and extends it to the Freescale BSP Community layer. It also describes common build system configurations and features to optimize the build of target images, including the use of Toaster and Docker.

Chapter 2, The BSP Layer, guides the reader through the customization of the BSP for their own product. It then explains how to configure, modify, build, and debug the U-Boot boot loader, Linux kernel, and its device tree.

Chapter 3, The Software Layer, describes the process of creating a new software layer to hold new applications, services, or modifications to existing packages; explains size and security optimization methodologies for both the Linux kernel and the root filesystem; and discusses a release process for license compliance.

Chapter 4, Application Development, starts by introducing both the standard and extensible SDKs, and deals with application development in detail, including different graphical backends and development environments such as Eclipse and Qt Creator, and recipe creation for different programming languages.

Chapter 5, Debugging, Tracing and Profiling, discusses debugging tools and techniques, and explores the tracing functionalities offered by the Linux kernel along with some of the user space tracing and profiling tools that make use of them.

To get the most out of this book

This books assumes some basic working knowledge of GNU/Linux systems and applications such as the bash shell and derivatives, as well as standard tools such as grep, patch, and diff. The examples have been tested with an Ubuntu 16.04 LTS system, but any Linux distribution supported by the Yocto project can be used.

The book is structured to follow the usual development workflow of an embedded Linux product, but chapters, or even individual recipes, can be read independently.

Recipes take a practical, hands-on approach using an NXP i.MX6-based system, the Wandboard Quad, as base hardware. However, any other i.MX-based hardware can be used to follow the examples.

Download the example code files

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at We also have other code bundles from our rich catalog of books and videos available at Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "In this case, both imx6q.dtsi and ;imx6qdl-wandboard-revd1.dtsi are overlaid with the contents of imx6qp-wandboard-revd1.dts."

A block of code is set as follows:

#include "imx6q-wandboard-revd1.dts"                                             
#include "imx6qp.dtsi"                                                           
/ {                                                                              
        model = "Wandboard i.MX6QuadPlus rev.D1";                                

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

# Allow override of WANDBOARD_GITHUB_MIRROR to make use of                       
# local repository easier                                                        

Any command-line input or output is written as follows:

$ cd /opt/yocto/fsl-community-bsp/wandboard/tmp/deploy/sdk/$ ./

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Build the project by going to Project | Build Project."


Warnings or important notes appear like this.


Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit


Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit