Embedded Linux Systems with the Yocto Project

Book description

Build Complete Embedded Linux Systems Quickly and Reliably

Developers are increasingly integrating Linux into their embedded systems: It supports virtually all hardware architectures and many peripherals, scales well, offers full source code, and requires no royalties. The Yocto Project makes it much easier to customize Linux for embedded systems. If you’re a developer with working knowledge of Linux, Embedded Linux Systems with the Yocto Project™ will help you make the most of it.

An indispensable companion to the official documentation, this guide starts by offering a solid grounding in the embedded Linux landscape and the challenges of creating custom distributions for embedded systems. You’ll master the Yocto Project’s toolbox hands-on, by working through the entire development lifecycle with a variety of real-life examples that you can incorporate into your own projects.

Author Rudolf Streif offers deep insight into Yocto Project’s build system and engine, and addresses advanced topics ranging from board support to compliance management.

You’ll learn how to

  • Overcome key challenges of creating custom embedded distributions

  • Jumpstart and iterate OS stack builds with the OpenEmbedded Build System

  • Master build workflow, architecture, and the BitBake Build Engine

  • Quickly troubleshoot build problems

  • Customize new distros with built-in blueprints or from scratch

  • Use BitBake recipes to create new software packages

  • Build kernels, set configurations, and apply patches

  • Support diverse CPU architectures and systems

  • Create Board Support Packages (BSP) for hardware-specific adaptations

  • Provide Application Development Toolkits (ADT) for round-trip development

  • Remotely run and debug applications on actual hardware targets

  • Ensure open-source license compliance

  • Scale team-based projects with Toaster, Build History, Source Mirrors, and Autobuilder

Table of contents

  1. Cover Page
  2. About This E-Book
  3. Title Page
  4. Copyright Page
  5. Dedication Page
  6. Contents
  7. Foreword
  8. Preface
    1. What This Book Is and What It Is Not
    2. Who Should Read This Book
    3. How This Book Is Organized
    4. Hands-on Experience
  9. Acknowledgments
  10. About the Author
  11. 1. Linux for Embedded Systems
    1. 1.1 Why Linux for Embedded Systems?
    2. 1.2 Embedded Linux Landscape
      1. 1.2.1 Embedded Linux Distributions
      2. 1.2.2 Embedded Linux Development Tools
    3. 1.3 A Custom Linux Distribution—Why Is It Hard?
    4. 1.4 A Word about Open Source Licensing
    5. 1.5 Organizations, Relevant Bodies, and Standards
      1. 1.5.1 The Linux Foundation
      2. 1.5.2 The Apache Software Foundation
      3. 1.5.3 Eclipse Foundation
      4. 1.5.4 Linux Standard Base
      5. 1.5.5 Consumer Electronics Workgroup
    6. 1.6 Summary
    7. 1.7 References
  12. 2. The Yocto Project
    1. 2.1 Jumpstarting Your First Yocto Project Build
      1. 2.1.1 Prerequisites
      2. 2.1.2 Obtaining the Yocto Project Tools
      3. 2.1.3 Setting Up the Build Host
      4. 2.1.4 Configuring a Build Environment
      5. 2.1.5 Launching the Build
      6. 2.1.6 Verifying the Build Results
      7. 2.1.7 Yocto Project Build Appliance
    2. 2.2 The Yocto Project Family
    3. 2.3 A Little Bit of History
      1. 2.3.1 OpenEmbedded
      2. 2.3.2 BitBake
      3. 2.3.3 Poky Linux
      4. 2.3.4 The Yocto Project
      5. 2.3.5 The OpenEmbedded and Yocto Project Relationship
    4. 2.4 Yocto Project Terms
    5. 2.5 Summary
    6. 2.6 References
  13. 3. OpenEmbedded Build System
    1. 3.1 Building Open Source Software Packages
      1. 3.1.1 Fetch
      2. 3.1.2 Extract
      3. 3.1.3 Patch
      4. 3.1.4 Configure
      5. 3.1.5 Build
      6. 3.1.6 Install
      7. 3.1.7 Package
    2. 3.2 OpenEmbedded Workflow
      1. 3.2.1 Metadata Files
      2. 3.2.2 Workflow Process Steps
    3. 3.3 OpenEmbedded Build System Architecture
      1. 3.3.1 Build System Structure
      2. 3.3.2 Build Environment Structure
      3. 3.3.3 Metadata Layer Structure
    4. 3.4 Summary
    5. 3.5 References
  14. 4. BitBake Build Engine
    1. 4.1 Obtaining and Installing BitBake
      1. 4.1.1 Using a Release Snapshot
      2. 4.1.2 Cloning the BitBake Development Repository
      3. 4.1.3 Building and Installing BitBake
    2. 4.2 Running BitBake
      1. 4.2.1 BitBake Execution Environment
      2. 4.2.2 BitBake Command Line
    3. 4.3 BitBake Metadata
    4. 4.4 Metadata Syntax
      1. 4.4.1 Comments
      2. 4.4.2 Variables
      3. 4.4.3 Inclusion
      4. 4.4.4 Inheritance
      5. 4.4.5 Executable Metadata
      6. 4.4.6 Metadata Attributes
      7. 4.4.7 Metadata Name (Key) Expansion
    5. 4.5 Source Download
      1. 4.5.1 Using the Fetch Class
      2. 4.5.2 Fetcher Implementations
      3. 4.5.3 Mirrors
    6. 4.6 HelloWorld—BitBake Style
    7. 4.7 Dependency Handling
      1. 4.7.1 Provisioning
      2. 4.7.2 Declaring Dependencies
      3. 4.7.3 Multiple Providers
    8. 4.8 Version Selection
    9. 4.9 Variants
    10. 4.10 Default Metadata
      1. 4.10.1 Variables
      2. 4.10.2 Tasks
    11. 4.11 Summary
    12. 4.12 References
  15. 5. Troubleshooting
    1. 5.1 Logging
      1. 5.1.1 Log Files
      2. 5.1.2 Using Logging Statements
    2. 5.2 Task Execution
      1. 5.2.1 Executing Specific Tasks
      2. 5.2.2 Task Script Files
    3. 5.3 Analyzing Metadata
    4. 5.4 Development Shell
    5. 5.5 Dependency Graphs
    6. 5.6 Debugging Layers
    7. 5.7 Summary
  16. 6. Linux System Architecture
    1. 6.1 Linux or GNU/Linux?
    2. 6.2 Anatomy of a Linux System
    3. 6.3 Bootloader
      1. 6.3.1 Role of the Bootloader
      2. 6.3.2 Linux Bootloaders
    4. 6.4 Kernel
      1. 6.4.1 Major Linux Kernel Subsystems
      2. 6.4.2 Linux Kernel Startup
    5. 6.5 User Space
    6. 6.6 Summary
    7. 6.7 References
  17. 7. Building a Custom Linux Distribution
    1. 7.1 Core Images—Linux Distribution Blueprints
      1. 7.1.1 Extending a Core Image through Local Configuration
      2. 7.1.2 Testing Your Image with QEMU
      3. 7.1.3 Verifying and Comparing Images Using the Build History
      4. 7.1.4 Extending a Core Image with a Recipe
      5. 7.1.5 Image Features
      6. 7.1.6 Package Groups
    2. 7.2 Building Images from Scratch
    3. 7.3 Image Options
      1. 7.3.1 Languages and Locales
      2. 7.3.2 Package Management
      3. 7.3.3 Image Size
      4. 7.3.4 Root Filesystem Types
      5. 7.3.5 Users, Groups, and Passwords
      6. 7.3.6 Tweaking the Root Filesystem
    4. 7.4 Distribution Configuration
      1. 7.4.1 Standard Distribution Policies
      2. 7.4.2 Poky Distribution Policy
      3. 7.4.3 Distribution Features
      4. 7.4.4 System Manager
      5. 7.4.5 Default Distribution Setup
    5. 7.5 External Layers
    6. 7.6 Hob
    7. 7.7 Summary
  18. 8. Software Package Recipes
    1. 8.1 Recipe Layout and Conventions
      1. 8.1.1 Recipe Filename
      2. 8.1.2 Recipe Layout
      3. 8.1.3 Formatting Guidelines
    2. 8.2 Writing a New Recipe
      1. 8.2.1 Establish the Recipe
      2. 8.2.2 Fetch the Source Code
      3. 8.2.3 Unpack the Source Code
      4. 8.2.4 Patch the Source Code
      5. 8.2.5 Add Licensing Information
      6. 8.2.6 Configure the Source Code
      7. 8.2.7 Compile
      8. 8.2.8 Install the Build Output
      9. 8.2.9 Setup System Services
      10. 8.2.10 Package the Build Output
      11. 8.2.11 Custom Installation Scripts
      12. 8.2.12 Variants
    3. 8.3 Recipe Examples
      1. 8.3.1 C File Software Package
      2. 8.3.2 Makefile-Based Software Package
      3. 8.3.3 CMake-Based Software Package
      4. 8.3.4 GNU Autotools-Based Software Package
      5. 8.3.5 Externally Built Software Package
    4. 8.4 Devtool
      1. 8.4.1 Round-Trip Development Using Devtool
      2. 8.4.2 Workflow for Existing Recipes
    5. 8.5 Summary
    6. 8.6 References
  19. 9. Kernel Recipes
    1. 9.1 Kernel Configuration
      1. 9.1.1 Menu Configuration
      2. 9.1.2 Configuration Fragments
    2. 9.2 Kernel Patches
    3. 9.3 Kernel Recipes
      1. 9.3.1 Building from a Linux Kernel Tree
      2. 9.3.2 Building from Yocto Project Kernel Repositories
    4. 9.4 Out-of-Tree Modules
      1. 9.4.1 Developing a Kernel Module
      2. 9.4.2 Creating a Recipe for a Third-Party Module
      3. 9.4.3 Including the Module with the Root Filesystem
      4. 9.4.4 Module Autoloading
    5. 9.5 Device Tree
    6. 9.6 Summary
    7. 9.7 References
  20. 10. Board Support Packages
    1. 10.1 Yocto Project BSP Philosophy
      1. 10.1.1 BSP Dependency Handling
    2. 10.2 Building with a BSP
      1. 10.2.1 Building for the BeagleBone
      2. 10.2.2 External Yocto Project BSP
    3. 10.3 Inside a Yocto Project BSP
      1. 10.3.1 License Files
      2. 10.3.2 Maintainers File
      3. 10.3.3 README File
      4. 10.3.4 README.sources File
      5. 10.3.5 Prebuilt Binaries
      6. 10.3.6 Layer Configuration File
      7. 10.3.7 Machine Configuration Files
      8. 10.3.8 Classes
      9. 10.3.9 Recipe Files
    4. 10.4 Creating a Yocto Project BSP
      1. 10.4.1 Yocto Project BSP Tools
      2. 10.4.2 Creating a BSP with the Yocto Project BSP Tools
    5. 10.5 Tuning
    6. 10.6 Creating Bootable Media Images
      1. 10.6.1 Creating an Image with Cooked Mode
      2. 10.6.2 Creating an Image with Raw Mode
      3. 10.6.3 Kickstart Files
      4. 10.6.4 Kickstart File Directives
      5. 10.6.5 Plugins
      6. 10.6.6 Transferring Images
    7. 10.7 Summary
    8. 10.8 References
  21. 11. Application Development
    1. 11.1 Inside a Yocto Project ADT
    2. 11.2 Setting Up a Yocto Project ADT
      1. 11.2.1 Building a Toolchain Installer
      2. 11.2.2 Installing the Toolchain
      3. 11.2.3 Working with the Toolchain
      4. 11.2.4 On-Target Execution
      5. 11.2.5 Remote On-Target Debugging
    3. 11.3 Building Applications
      1. 11.3.1 Makefile-Based Applications
      2. 11.3.2 Autotools-Based Applications
    4. 11.4 Eclipse Integration
      1. 11.4.1 Installing the Eclipse IDE
      2. 11.4.2 Integrating a Yocto Project ADT
      3. 11.4.3 Developing Applications
      4. 11.4.4 Deploying, Running, and Testing on the Target
    5. 11.5 Application Development Using an Emulated Target
      1. 11.5.1 Preparing for Application Development with QEMU
      2. 11.5.2 Building an Application and Launching It in QEMU
    6. 11.6 Summary
    7. 11.7 References
  22. 12. Licensing and Compliance
    1. 12.1 Managing Licenses
      1. 12.1.1 License Tracking
      2. 12.1.2 Common Licenses
      3. 12.1.3 Commercially Licensed Packages
      4. 12.1.4 License Deployment
      5. 12.1.5 Blacklisting Licenses
      6. 12.1.6 Providing License Manifest and Texts
    2. 12.2 Managing Source Code
    3. 12.3 Summary
    4. 12.4 References
  23. 13. Advanced Topics
    1. 13.1 Toaster
      1. 13.1.1 Toaster Operational Modes
      2. 13.1.2 Toaster Setup
      3. 13.1.3 Local Toaster Development
      4. 13.1.4 Toaster Configuration
      5. 13.1.5 Toaster Production Deployment
      6. 13.1.6 Toaster Web User Interface
    2. 13.2 Build History
      1. 13.2.1 Enabling Build History
      2. 13.2.2 Configuring Build History
      3. 13.2.3 Pushing Build History to a Git Repository Server
      4. 13.2.4 Understanding the Build History
    3. 13.3 Source Mirrors
      1. 13.3.1 Using Source Mirrors
      2. 13.3.2 Setting Up Source Mirrors
    4. 13.4 Autobuilder
      1. 13.4.1 Installing Autobuilder
      2. 13.4.2 Configuring Autobuilder
    5. 13.5 Summary
    6. 13.6 References
  24. A. Open Source Licenses
    1. A.1 MIT License (MIT)
    2. A.2 GNU General Public License (GPL) Version 2
      1. Preamble
      2. Terms and Conditions for Copying, Distribution and Modification
      3. No Warranty
      4. How to Apply These Terms to Your New Programs
    3. A.3 GNU General Public License (GPL) Version 3
      1. Preamble
      2. Terms and Conditions
      3. How to Apply These Terms to Your New Programs
    4. A.4 Apache License Version 2.0
      1. TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
      2. APPENDIX: How to Apply the Apache License to Your Work
  25. B. Metadata Reference
  26. Index
  27. Code Snippets

Product information

  • Title: Embedded Linux Systems with the Yocto Project
  • Author(s): Rudolf J. Streif
  • Release date: May 2016
  • Publisher(s): Pearson
  • ISBN: 9780133443301