O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Yocto for Raspberry Pi

Book Description

Create unique and amazing projects by using the powerful combination of Yocto and Raspberry Pi

About This Book

  • Set up and configure the Yocto Project efficiently with Raspberry Pi
  • Deploy multimedia applications from existing Yocto/OE layers
  • An easy-to-follow guide to utilize your custom recipes on your Raspberry Pi

Who This Book Is For

If you are a student or a developer of embedded software, embedded Linux engineer or embedded systems in competence with Raspberry Pi and want to discover the Yocto Project, then this book is for you. Experience with Yocto is not needed.

What You Will Learn

  • Explore the basic concept of Yocto's build system and how it is organized in order to use it efficiently with Raspberry Pi
  • Generate your first image with Yocto for the Raspberry Pi
  • Understand how to customize your Linux kernel within the Yocto Project
  • Customize your image in order to integrate your own applications
  • Write your own recipes for your graphical applications
  • Integrate a custom layer for the Raspberry Pi

In Detail

The Yocto Project is a Linux Foundation workgroup, which produces tools (SDK) and processes (configuration, compilation, installation) that will enable the creation of Linux distributions for embedded software, independent of the architecture of embedded software (Raspberry Pi, i.MX6, and so on). It is a powerful build system that allows you to master your personal or professional development.

This book presents you with the configuration of the Yocto Framework for the Raspberry Pi, allowing you to create amazing and innovative projects using the Yocto/OpenEmbedded eco-system. It starts with the basic introduction of Yocto's build system, and takes you through the setup and deployment steps for Yocto. It then helps you to develop an understanding of Bitbake (the task scheduler), and learn how to create a basic recipe through a GPIO application example. You can then explore the different types of Yocto recipe elements (LICENSE, FILES, SRC_URI, and so on). Next, you will learn how to customize existing recipes in Yocto/OE layers and add layers to your custom environment (qt5 for example).

Style and approach

A step by step guide covering the fundamentals to create amazing new projects with Raspberry Pi and Yocto.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Yocto for Raspberry Pi
    1. Yocto for Raspberry Pi
    2. Credits
    3. About the Authors
    4. About the Reviewers
    5. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    7. 1. Meeting the Yocto Project
      1. The Yocto Project
        1. Understanding the build system
      2. The core components
        1. What is Poky?
        2. The Chief - BitBake
        3. OpenEmbedded-Core
        4. Exploring metadata
      3. Yocto Project - workflow
      4. Summary
    8. 2. Building our First Poky Image for the Raspberry Pi
      1. Installing the required packages for the host system
        1. Poky on Ubuntu
        2. Poky on Fedora
        3. Downloading the Poky metadata
        4. Downloading the Raspberry Pi BSP metadata
        5. The oe-init-build-env script
        6. Editing the local.conf file
        7. Editing the bblayers.conf file
      2. Building the Poky image
        1. Choice of image
        2. Running BitBake
        3. Creating an SD card
      3. Booting the image on the Raspberry Pi
      4. Summary
    9. 3. Mastering Baking with Hob and Toaster
      1. Hob
        1. Preparing the environment for Hob
        2. Running Hob
        3. Configuring recipes and packages
        4. Building the image
      2. Exploring Toaster
        1. Installing the required packages for the host system
        2. Running Toaster
        3. Running BitBake
        4. Running the web interface
      3. Summary
    10. 4. Understanding BitBake
      1. BitBake
      2. Metadata
        1. Configuration
        2. Classes
        3. Recipes
      3. Parsing metadata
      4. Preferences and providers
      5. Dependencies
      6. Fetching
        1. The local file fetcher
        2. The HTTP fetcher
        3. The Git fetcher
      7. Understanding BitBake's tasks
      8. Summary
    11. 5. Creating, Developing, and Deploying on the Raspberry Pi
      1. Software development kits (SDKs)
        1. A generic SDK - meta-toolchain
        2. image.bb -c populate_sdk
        3. The Qt SDK - meta-toolchain-qt
        4. The Qt5 SDK - meta-toolchain-qt5
        5. Cross-compilation - an example
          1. Configuration of the SDK environment
          2. List of tools
          3. Compilation
      2. Raspberry Pi and a package manager
        1. Package format availablility
        2. Choosing a package format
        3. Installing and updating a package on the target
        4. RPM packages
          1. Installing manually
          2. Installing automatically
      3. IPK packages
        1. Installing manually
        2. Installing automatically
      4. Our application - an introduction
      5. Our application - creating the recipe
        1. The recipe explained
      6. Summary
    12. 6. Working with External Layers
      1. Introducing layers
      2. The basic concepts of layers
        1. Theory
        2. The software layer
          1. README and COPYING
          2. The classes folder
          3. The conf folder
          4. The recipes-* directory
        3. The machine (BSP) layer
      3. Adding external layers to the Raspberry Pi
      4. Summary
    13. 7. Deploying a Custom Layer on the Raspberry Pi
      1. Creating the meta-packt_rpi layer with the yocto-layer script
      2. Adding gpio-packt to meta-packt_rpi
      3. Patching gpio-packt
        1. Generating the patch
        2. Adding the patch to the recipe file
      4. Creating the raspberry-packt-image.bb image
        1. Creating the environment
        2. Modifying the recipe file
      5. Deploying the raspberry-packt-image.bb image
      6. Summary
    14. 8. Diving into the Raspberry Pi's Peripherals and Yocto Recipes
      1. The SPI bus
        1. The spi-tools project
        2. Inclusion in the meta-oe layer
        3. Baking spi-tools
        4. Testing on the Raspberry Pi
          1. spi-config
          2. spi-pipe
        5. Conclusion
      2. The i2c bus
      3. The Wii Nunchuck
        1. The Nunchuck connector
      4. The Raspberry Pi connection
        1. The Nunchuck's protocol
          1. Encryption
          2. Requesting sensor data
        2. Testing the i2c connection
        3. Creating the Nunchuck application
        4. Integrating with meta-packt_rpi
        5. Creating the Nunchuck recipe
        6. Testing the Nunchuck application
        7. V4L presentation
        8. Video support
        9. v4l-utils integration
      5. Summary
    15. 9. Making a Media Hub on the Raspberry Pi
      1. Project description – CPU temperature monitoring
        1. Overview
        2. Hardware/software requirements
      2. Creating the main application
        1. server.js
        2. index.html
      3. Creating the Yocto/OE environment
        1. Modifying the image
        2. Creating the recipe file
          1. Explanation
        3. Autostarting - the init file
          1. Explanation
        4. Autostarting - the recipe file
        5. Explanation
      4. Deploying raspberry-packt-image
      5. Testing the application
      6. The future of this project
      7. Summary
    16. 10. Playing with an LCD Touchscreen and the Linux Kernel
      1. The Linux kernel
        1. The Linux kernels versus the Raspberry Pi Linux kernel
        2. Getting started with the Linux kernel
          1. Configuring the kernel in Yocto
        3. Configuring the kernel with LCD support
          1. The Raspberry Pi device tree
          2. Configuring the touchscreen from the kernel perspective
      2. Setting up an LCD display for the Raspberry Pi using the Yocto Project
        1. The Raspberry Pi 7 touchscreen
        2. The PiTFT 2.8 resistive touchscreen
      3. Developing applications and using them on an LCD display
        1. Developing a custom application using Qt
      4. Summary
    17. 11. Contributing to the Raspberry Pi BSP Layer
      1. Open source
      2. Contributing to open source projects
      3. Exploring Git
        1. What is Git?
        2. Working with Git
      4. Contributing to the Yocto Project
        1. Contributing to meta-raspberrypi
          1. Setting up your Git repository
        2. Creating your commit
        3. Sending changes to the community
        4. Follow-up
        5. Practical example - sending a custom tool upstream
      5. Summary
    18. 12. Home Automation Project - Booting a Custom Image
      1. Home automation using a Raspberry Pi
        1. Material required for the project
      2. Setting up the base for the project
        1. Creating a new layer
        2. Customizing the image recipe
        3. Building and booting the image
      3. Creating the server side
      4. Creating a packet list for your image
        1. Setting up a customized package list
        2. Start using a customized package list in meta-packt-iot
      5. Putting it all together
        1. Serial and SSH connections to the Raspberry Pi
      6. Controlling the relay using the Raspberry Pi
      7. Controlling the lamp using the Raspberry Pi
      8. Turning on/off the lamp from a smartphone
      9. Extra - using a Raspberry Pi with an LCD as the client
      10. Summary