Book Image

Embedded Linux Development Using Yocto Project - Third Edition

By : Otavio Salvador, Daiane Angolini
Book Image

Embedded Linux Development Using Yocto Project - Third Edition

By: Otavio Salvador, Daiane Angolini

Overview of this book

The Yocto Project is the industry standard for developing dependable embedded Linux projects. It stands out from other frameworks by offering time-efficient development with enhanced reliability and robustness. With Embedded Linux Development Using Yocto Project, you’ll acquire an understanding of Yocto Project tools, helping you perform different Linux-based tasks. You’ll gain a deep understanding of Poky and BitBake, explore practical use cases for building a Linux subsystem project, employ Yocto Project tools available for embedded Linux, and uncover the secrets of SDK, recipe tool, and others. This new edition is aligned with the latest long-term support release of the aforementioned technologies and introduces two new chapters, covering optimal emulation in QEMU for faster product development and best practices. By the end of this book, you’ll be well-equipped to generate and run an image for real hardware boards. You’ll gain hands-on experience in building efficient Linux systems using the Yocto Project.
Table of Contents (20 chapters)

Building a target image

Poky provides several predesigned image recipes we can use to build our binary image. We can check the list of available images by running the following command from the poky directory:

$ ls meta*/recipes*/*images/*.bb

All the recipes provide images that are a set of unpacked and configured packages, generating a filesystem that we can use with hardware or one of the supported QEMU machines.

Next, we can see the list of most commonly used images:

  • core-image-minimal: This is a small image allowing a device to boot. It is handy for kernel and bootloader tests and development.
  • core-image-base: This console-only image provides basic hardware support for the target device.
  • core-image-weston: This image provides the Wayland protocol libraries and the reference Weston compositor.
  • core-image-x11: This is a basic X11 image with a terminal.
  • core-image-sato: This is an image with Sato support and a mobile environment for mobile devices that use X11. It provides applications such as a terminal, editor, file manager, media player, and so on.
  • core-image-full-cmdline: A console-only image with more full-featured Linux system functionality installed.

There are other reference images available from the community. Several images support features, such as Real Time, initramfs, and MTD (flash tools). It is good to check the source code or the Yocto Project Reference Manual (https://docs.yoctoproject.org/4.0.4/ref-manual/index.html) for the complete and updated list.

The process of building an image for a target is straightforward. But first, we need to set up the build environment using source oe-init-build-env [build-directory] before using BitBake. To build the image, we can use the template in the following command:

Figure 2.3 – How to build a recipe using BitBake

Figure 2.3 – How to build a recipe using BitBake

Note

We will use MACHINE = "qemux86-64" in the following examples. You can set it in build/conf/local.conf accordingly.

For example, to build core-image-full-cmdline, run the following command:

$ bitbake core-image-full-cmdline

The Poky build looks like the following figure:

Figure 2.4 – The result of bitbake core-image-full-cmdline

Figure 2.4 – The result of bitbake core-image-full-cmdline