Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Yocto for Raspberry Pi
Yocto for Raspberry Pi

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

By TEXIER Pierre-Jean , Petter Mabäcker
$29.99 $20.98
Book Jun 2016 214 pages 1st Edition
eBook
$29.99 $20.98
Print
$38.99
Subscription
$15.99 Monthly
eBook
$29.99 $20.98
Print
$38.99
Subscription
$15.99 Monthly

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Jun 29, 2016
Length 214 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781785281952
Vendor :
Raspberry Pi
Category :
Concepts :
Table of content icon View table of contents Preview book icon Preview Book

Yocto for Raspberry Pi

Chapter 1.  Meeting the Yocto Project

In this chapter, we will discover the Yocto Project and its main principles. All the concepts used throughout the book will be introduced here. We will discuss the history of the Yocto Project, the build system, Poky, OpenEmbedded-Core, BitBake, metadata, and the Yocto Project workflow.

The Yocto Project


The Yocto Project is an umbrella project covering a fairly wide gamut of embedded Linux technologies. It is not a Linux distribution, as explained on the Yocto Project website:

"The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create custom Linux-based systems for embedded products regardless of the hardware architecture."

Sponsored by the Linux Foundation, the Yocto Project is more than a build system. It provides tools, processes, templates and methods so that developers can rapidly create and deploy products for embedded devices(the Raspberry Pi, Beagleboard, Nitrogen6x, SAMA5D3, Olinuxino, and so on) or QEMU. The two main components that make up the Yocto Project are:

  • Poky: This is the build system (the reference distribution).

  • BitBake: This is the scheduler. It is a tool based on the Gentoo distribution.

Around November 2010, the Linux Foundation announced that this entire work would continue under the banner of the Yocto Project as a project sponsored by the Linux Foundation (with Richard Purdie, Fellow of the Linux Foundation, as Architect). It was then established that the Yocto Project and OpenEmbedded would coordinate on a core set of package metadata called OE-Core, combining the best of both Poky and OpenEmbedded with an increased use of layering for additional components.

Understanding the build system

As mentioned before, we are in the world of build systems with the Yocto Project. A build system enables you to:

  • Compile or cross-compile applications

  • Package applications

  • Test output binaries and ecosystem compatibility

  • Deploy generated images

To perform these steps, several tools exist. These are some of them:

For example, Buildroot is a set of makefiles for automated generation in embedded systems. It supports compiling the bootloader (U-Boot, for example), kernel (zImage or bzImage), and basic controls through BusyBox and third-party applications. Buildroot works on various architectures, such as ARM, x86, and MIPS. For further information, refer to the full documentation in English at https://buildroot.org/docs.html .

"Buildroot is a tool maintained in part by a French company that specializes in embedded Linux development called Free Electrons"

Buildroot is a much more simplistic approach than the one we will discover through this book on the Yocto Project. Buildroot is rather dedicated to firmware generation, while Yocto/OpenEmbedded is oriented towards distribution. Buildroot offers 700 recipes compared to the Yocto Project, which offers over 8000.

The core components


The core components (other available tools are optional) of the Yocto Project are:

  • BitBake

  • OpenEmbedded-Core

  • Poky

  • The BSP layer (meta-raspberry, meta-fsl-arm, meta-ti, meta-intel, meta-sunxi, and so on)

The following diagram shows all the layers that we will discover through this book. We will study all the tools through various examples, allowing better comprehension.

What is Poky?

Poky is the reference Yocto Project distribution. It contains some of basic components (called the build system) of OpenEmbedded and a set of metadata for creating embedded distributions for a number of targets. It is platform independent and performs cross-compiling using the BitBake tool (a task scheduler), OpenEmbedded-Core, and a default set of metadata, as shown in the following figure. It provides the mechanism to build and combine thousands of distributed open source projects.

The Poky build system is poised to become the reference in the industrial world as evinces by industry leaders such as Wind River, Intel, Montavista, and Mentor Graphics.

Note

Angstrom ( http://www.angstrom-distribution.org/ ) is another distribution based on OpenEmbedded-Core. You might consider Angstrom and Poky to be close cousins, because Poky is also based on OpenEmbedded-Core.

The Chief - BitBake

BitBake, the build engine, is a task scheduler (like GNU Make) which parses several scripts (shell and Python, for example).

Once the environment is built, BitBake will execute the task that has been requested. If no task is provided, BitBake will run the default task, called build.

To run a task, BitBake will first look for an environment variable called do_ <task name>, which will contain the task code to execute (in Python or a shell). So, to compile a Yocto recipe, use the code contained in the do_compile variable.

In short, from the information contained in the recipes (or metadata), it downloads the sources of projects from the Internet, a local directory, or a version-control system (such as Git), and then builds in the order determined by the dependency graph generated dynamically. Finally, it installs binaries, generates the corresponding package, and builds the final image, which can be installed on the target (Raspberry Pi for us).

The following picture shows how BitBake works:

OpenEmbedded-Core

The OpenEmbedded-Core metadata collection (meta in the following diagram) provides the engine of the Poky build tool. It is designed to provide the core features (several recipes). It provides support for six different processor architectures (ARM, x86, x86-64, PowerPC, MIPS, and MIPS64), supporting only QEMU-emulated machines.

The organization of OpenEmbedded-Core is depicted here:

This layer includes different recipes, which describe how to fetch, configure, compile and package applications and images.

Note

For the rest of the book, we will mix this layer with the BSP layer of the Raspberry Pi, meta-raspberrypi.

Exploring metadata

Metadata, which is composed of a mix of Python and shell script text files (.conf, .bb, .bbclass, and .inc), provides a tremendously flexible system. Metadata refers to the build instructions themselves as well as the data used to control what things get built and to affect how they are built. The metadata also includes commands and data used to indicate which versions of software are used and where they are obtained from. Poky uses this to extend OpenEmbedded-Core and includes two different layers, which are another metadata subset. Here are their details:

  • * meta-yocto: This layer provides the default and supported distributions, visual branding, and metadata tracking information (maintainers, upstream status, and so on)

  • * meta-yocto-bsp: This layer, on top of it, provides the hardware reference board support (BSP) for use in Poky

We will discover metadata in depth through Chapter 4, Understanding the BitBake tool.

Yocto Project - workflow


The following diagram represents the Yocto Project development environment at a high level in order to present the cross-compilation framework:

Let's look at what the components in the diagram stand for:

  • * User Configuration : This is metadata you can use to control the build process.

  • * Metadata layers : These are various layers that provide software, machine, and distribution metadata.

  • * Source files : These contain upstream releases, local projects, and source control management (Git, SVN, and so on).

  • * Build system : These are processes under the control of BitBake. This block expands on how BitBake fetches source files, applies patches, completes compilation, analyzes output for package generation, creates and tests packages, generates images, and generates cross-development tools.

  • * Package feeds : These are directories containing output packages (RPM, DEB, or IPK), which are subsequently used in the construction of an image or SDK produced by the build system. These feeds can also be copied and shared using a web server or other means to facilitate extending or updating existing images on devices at runtime if runtime package management is enabled.

  • * Images : These are images produced by the development process (the pieces that compose the operating system, such as the kernel image, bootloader, and rootfs).

  • * Application development SDK : These are cross-development tools that are produced along with an image or separately with BitBake.

Summary


This first chapter provided an overview on how the Yocto Project works, the core components that form it, such as Poky, OpenEmbedded-Core, and BitBake, and how they work within the Yocto Project.

In the next chapter, we will practice the workflow of the Yocto Project with different steps to download, configure, and prepare the Poky build environment in order to generate our first Poky image for the Raspberry Pi.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

Description

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).

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

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Jun 29, 2016
Length 214 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781785281952
Vendor :
Raspberry Pi
Category :
Concepts :

Table of Contents

18 Chapters
Yocto for Raspberry Pi Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
About the Authors Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
Meeting the Yocto Project Chevron down icon Chevron up icon
Building our First Poky Image for the Raspberry Pi Chevron down icon Chevron up icon
Mastering Baking with Hob and Toaster Chevron down icon Chevron up icon
Understanding BitBake Chevron down icon Chevron up icon
Creating, Developing, and Deploying on the Raspberry Pi Chevron down icon Chevron up icon
Working with External Layers Chevron down icon Chevron up icon
Deploying a Custom Layer on the Raspberry Pi Chevron down icon Chevron up icon
Diving into the Raspberry Pi's Peripherals and Yocto Recipes Chevron down icon Chevron up icon
Making a Media Hub on the Raspberry Pi Chevron down icon Chevron up icon
Playing with an LCD Touchscreen and the Linux Kernel Chevron down icon Chevron up icon
Contributing to the Raspberry Pi BSP Layer Chevron down icon Chevron up icon
Home Automation Project - Booting a Custom Image Chevron down icon Chevron up icon

Customer reviews

Filter icon Filter
Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.