Embedded Linux Development Using Yocto Project Cookbook - Second Edition

Book description

Over 79 hands-on recipes for professional embedded Linux developers to optimize and boost their Yocto Project know-how

About This Book
  • Optimize your Yocto setup to speed up development and debug build issues
  • Use what is quickly becoming the standard embedded Linux product builder framework—the Yocto Project
  • Recipe-based implementation of best practices to optimize your Linux system
Who This Book Is For

If you are an embedded Linux developer with the basic knowledge of Yocto Project, this book is an ideal way to broaden your knowledge with recipes for embedded development.

What You Will Learn
  • Optimize your Yocto Project setup to speed up development and debug build issues
  • Use Docker containers to build Yocto Project-based systems
  • Take advantage of the user-friendly Toaster web interface to the Yocto Project build system
  • Build and debug the Linux kernel and its device trees
  • Customize your root filesystem with already-supported and new Yocto packages
  • Optimize your production systems by reducing the size of both the Linux kernel and root filesystems
  • Explore the mechanisms to increase the root filesystem security
  • Understand the open source licensing requirements and how to comply with them when cohabiting with proprietary programs
  • Create recipes, and build and run applications in C, C++, Python, Node.js, and Java
In Detail

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.

Style and approach

This recipe-based book will guide you through all the development stages of an embedded Linux product design using the Yocto Project.

Table of contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  2. The Build System
    1. Introduction
    2. Setting up the host system
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Installing Poky
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Creating a build directory
      1. How to do it...
      2. How it works...
      3. There's more...
    5. Building your first image
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    6. Explaining the NXP Yocto ecosystem
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Installing support for NXP hardware
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Building Wandboard images
      1. How to do it...
      2. How it works...
      3. See also
    9. Using the Toaster web interface
      1. Getting ready
      2. How to do it...
        1. Administrator interface
        2. Starting a build
        3. Customizing images with Toaster
        4. Building SDKs with Toaster
      3. How it works...
      4. There's more...
    10. Running a Toaster Docker container
      1. How to do it...
      2. See also
    11. Configuring network booting for a development setup
      1. Getting ready
        1. Installing a TFTP server
        2. Installing an NFS server
      2. How to do it...
    12. Using Docker as a Yocto build system container
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    13. Sharing downloads
      1. Getting ready
      2. How to do it...
    14. Sharing the shared state cache
      1. How to do it...
      2. There's more...
    15. Setting up a package feed
      1. Getting ready
        1. Versioning packages
      2. How to do it...
      3. There's more...
        1. Generating signed packages
        2. Using signed package feeds
        3. Creating a GNUPG key pair
        4. Backing up your keys
      4. See also
    16. Using build history
      1. How to do it...
      2. How it works...
        1. Looking at build history
      3. There's more...
    17. Working with build statistics
      1. How to do it...
      2. How it works...
      3. There's more...
      4. See also
    18. Debugging the build system
      1. Getting ready
        1. Finding recipes
        2. Dumping BitBake's environment
        3. Using the development shell
      2. How to do it...
        1. Task log and run files
        2. Adding logging to recipes
        3. Looking at dependencies
        4. Debugging dependencies
        5. Debugging BitBake
        6. Error reporting tool
  3. The BSP Layer
    1. Introduction
    2. Creating a custom BSP layer
      1. How to do it...
      2. How it works...
      3. There's more...
        1. Adding a new machine
        2. Adding a custom device tree to the Linux kernel
        3. Adding a custom U-Boot machine
        4. Adding a custom formfactor file
        5. Build your custom machine
      4. See also
    3. Adding a custom kernel and bootloader
      1. Getting ready
        1. Finding the Linux kernel source
        2. Finding the U-Boot source
        3. Developing using a Git repository fork
      2. How to do it...
      3. How it works...
    4. Building the U-Boot bootloader
      1. Getting ready
      2. How to do it...
      3. There's more...
    5. Describing Linux's build system
      1. How to do it...
      2. How it works...
      3. There's more...
    6. Configuring the Linux kernel
      1. Getting ready
      2. How to do it...
        1. Using Yocto to configure the Linux kernel
      3. There's more...
    7. Building the Linux kernel
      1. How to do it...
        1. Using Yocto to build the Linux kernel
      2. There's more...
    8. Building external kernel modules
      1. Getting ready
      2. How to do it...
      3. There's more...
        1. Module auto-loading
      4. See also
    9. Debugging the Linux kernel and modules
      1. How to do it...
      2. How it works...
      3. There's more...
        1. Using dynamic debug
        2. Rate-limiting debug messages
      4. See also
    10. Debugging the Linux kernel booting process
      1. How to do it...
      2. How it works...
        1. Dumping the kernel's printk buffer from the bootloader
      3. There's more...
    11. Using the kernel function tracing system
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. Filtering function traces
        2. Enabling trace options
        3. Using the function tracer on oops
        4. Getting a stack trace for a given function
        5. Configuring the function tracer at boot
      5. See also
    12. Managing the device tree
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. The compatible property
        2. The Wandboard device tree file
        3. Defining buses and memory-addressable devices
      4. There's more...
        1. Modifying and compiling the device tree in Yocto
      5. See also
    13. Debugging device tree issues
      1. How to do it...
      2. How it works...
        1. Looking at the device tree from U-Boot
        2. Looking at the device tree from the Linux kernel
  4. The Software Layer
    1. Introduction
    2. Exploring an image's contents
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Adding a new software layer
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Selecting a specific package version and provider
      1. How to do it...
        1. How do we select which provider to use?
        2. How do we select which version to use?
        3. How do we select which version not to use?
    5. Adding supported packages
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. Configuring packages
    6. Adding new packages
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Package licensing
        2. Fetching package contents
        3. Specifying task overrides
        4. Configuring packages
        5. Splitting into several packages
        6. Setting machine-specific variables
    7. Adding data, scripts, or configuration files
      1. How to do it...
      2. There's more...
    8. Managing users and groups
      1. Getting ready
      2. How to do it...
      3. There's more...
    9. Using the sysvinit initialization manager
      1. Getting ready
      2. How to do it...
    10. Using the systemd initialization manager
      1. Getting ready
      2. How to do it...
      3. There's more...
        1. Installing systemd unit files
      4. See also
    11. Installing package installation scripts
      1. Getting ready
      2. How to do it...
      3. How it works...
    12. Reducing the Linux kernel image size
      1. How to do it...
      2. How it works...
    13. Reducing the root filesystem size
      1. How to do it...
      2. How it works...
    14. Memory-based root filesystems
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    15. Securing the root filesystem
      1. Getting ready
      2. How to do it...
        1. Setting up SELinux
        2. Setting up SMACK
      3. How it works...
        1. Looking into SELinux
        2. Looking into SMACK
      4. See also
    16. Releasing software
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    17. Analyzing your system for compliance
      1. How to do it...
      2. There's more...
    18. Working with open source and proprietary code
      1. How to do it...
      2. How it works...
        1. The U-Boot bootloader
        2. The Linux kernel
        3. glibc
        4. musl
        5. BusyBox
        6. The Qt framework
        7. The X Windows system
      3. There's more...
      4. See also
  5. Application Development
    1. Introduction
    2. Introducing toolchains
      1. Getting ready
      2. How to do it...
    3. Preparing an SDK
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Customizing standard and extensible SDKs
        2. Adding packages to the SDKs
    4. Using the extensible SDK
      1. Getting ready
        1. Exploring the extensible SDK contents
      2. How to do it...
      3. How it works...
        1. The workspace layer
        2. Recipe development workflow
        3. Adding a recipe to the workspace layer
        4. Removing a recipe from the workspace layer
        5. Modifying a recipe in the workspace layer
        6. Building and testing your recipe
        7. Updating a recipe with your changes
        8. Finishing work on a recipe
      4. There's more...
    5. Using the Eclipse IDE
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    6. Developing GTK+ applications
      1. Getting ready
      2. How to do it...
      3. There's more...
    7. Using the Qt Creator IDE
      1. Getting ready
      2. How to do it...
    8. Developing Qt applications
      1. Getting ready
      2. How to do it...
      3. There's more...
    9. Describing workflows for application development
      1. How to do it...
      2. How it works...
        1. External development
        2. Working directory development
        3. External source development
    10. Working with GNU make
      1. How to do it...
      2. See also
    11. Working with the GNU build system
      1. Getting ready
      2. How to do it...
      3. See also
    12. Working with the CMake build system
      1. Getting ready
      2. How to do it...
      3. See also
    13. Working with the SCons builder
      1. Getting ready
      2. How to do it...
      3. See also
    14. Developing with libraries
      1. Getting ready
        1. Building a static library
        2. Building a shared dynamic library
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    15. Working with the Linux framebuffer
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    16. Using the X Windows system
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    17. Using Wayland
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    18. Adding a web browser application
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    19. Adding Python applications
      1. Getting ready
      2. How to do it...
      3. There's more...
    20. Integrating the Open Java Development Kit
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    21. Integrating Java applications
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    22. Integrating Node.js applications
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    23. Running Docker application containers
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  6. Debugging, Tracing, and Profiling
    1. Introduction
    2. Analyzing core dumps
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    3. Native GDB debugging
      1. Getting ready
      2. How to do it...
      3. There's more...
    4. Cross GDB debugging
      1. Getting ready
      2. How to do it...
      3. There's more...
    5. Using strace for application debugging
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    6. Using the kernel's performance counters
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Using static kernel tracing
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Using dynamic kernel tracing
      1. Getting ready
      2. How to do it...
      3. There's more...
      4. See also
    9. Using dynamic kernel events
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    10. Exploring Yocto's tracing and profiling tools
      1. Getting ready
      2. How to do it...
      3. There's more...
    11. Tracing and profiling with perf
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Reading tracing data
      4. There's more...
        1. Profile charts
        2. Using perf as a strace substitute
      5. See also
    12. Using SystemTap
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    13. Using LTTng
      1. Getting ready
      2. How to do it...
      3. How it works...
        1. Extending application profiling
      4. There's more...
      5. See also
    14. Using blktrace
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  7. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Embedded Linux Development Using Yocto Project Cookbook - Second Edition
  • Author(s): Alex Gonzalez
  • Release date: January 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788399210