Book Image

Yocto for Raspberry Pi

By : TEXIER Pierre-Jean, Petter Mabäcker
Book Image

Yocto for Raspberry Pi

By: TEXIER Pierre-Jean, Petter Mabäcker

Overview of this book

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).
Table of Contents (18 chapters)
Yocto for Raspberry Pi
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
3
Mastering Baking with Hob and Toaster

Preface

This book will cover everything from creating your customized image for the Raspberry Pi to implementing a small home automation project using the Yocto Project and the Raspberry Pi as the base.

The book will start by introducing you to the Yocto Project and presenting the Raspberry Pi platform. With this information in place, you will learn how to integrate the Yocto Project with the Raspberry Pi. Throughout the book, you will learn everything from how to develop a custom application to using a Wii nunchuck and configuring an LCD touchscreen for the Raspberry Pi using the Yocto Project. The book will end with a practical chapter, which will summarize all that you learned throughout the book by creating a home automation project.

What this book covers

Chapter 1, Meeting the Yocto Project, introduces the basic concept of the Yocto Project. It will discuss history of the Yocto Project, OpenEmbedded Core, Poky, and BitBake.

Chapter 2, Building our First Poky Image for the Raspberry Pi, teaches you how to create your first image for the Raspberry Pi using the Yocto Project and how to run it.

Chapter 3, Mastering Baking with Hob and Toaster, teaches you how to use the user-friendly interfaces Hob and Toaster.

Chapter 4, Understanding BitBake, provides you with a deeper understanding of BitBake.

Chapter 5, Creating, Developing, and Deploying on the Raspberry Pi, teaches you how to integrate a custom application with the Raspberry Pi. This will include learning how to generate an SDK for cross-compiling applications.

Chapter 6Working with External Layers, takes you through how layers work and how to integrate external layers with our Raspberry Pi projects.

Chapter 7, Deploying a Custom Layer on the Raspberry Pi, explores how to generate a custom layer with different tools that the Yocto Project offers.

Chapter 8, Diving into the Raspberry Pi's Peripherals and Yocto Recipes, teaches you how to handle the SPI and i2C buses of the Raspberry Pi through the Yocto Project. You will also learn how to create your own recipe for custom applications.

Chapter 9, Making a Media Hub on the Raspberry Pi, goes through how to deploy custom applications in order to make an embedded media hub, which can be used to, for example, monitor CPU temperature. The solution will require HTML5 and Node.js to set up the web interface required for remotely monitoring temperature.

Chapter 10, Playing with an LCD Touchscreen and the Linux Kernel, teaches you some basics about the Linux kernel and how to configure it to support various LCD touchscreens. Further on, the chapter explains how to set up the Yocto Project to run graphical applications or a window system on a Raspberry Pi using an LCD touchscreen.

Chapter 11,  Contributing to the Raspberry Pi BSP Layer, teaches you how to contribute to the meta-raspberrypi layer.

Chapter 12, Home Automation Project – Booting a Custom Image, is the final chapter of the book, in which we summarize all that we learned throughout the book. This is done by creating a home automation project.

Who this book is for

This book is intended for embedded software students, embedded Linux engineers, and embedded systems enthusiasts competent with the Raspberry Pi (or another ARM platform) who want to discover the Yocto Project.

This book is the ideal way to become proficient and broaden your knowledge in order to apply it to your embedded development.

If you are looking for a book to help you develop on the Raspberry Pi and the Yocto Project, this book is the one you need.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles are shown as follows: "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)."

A block of code is set as follows:

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6" BBPATH = "${TOPDIR}" BBFILES ?= "" BBLAYERS ?= " \
/home/packt/RASPBERRYPI/poky/meta \
/home/packt/RASPBERRYPI/poky/meta-yocto \
/home/packt/RASPBERRYPI/poky/meta-yocto-bsp \
"BBLAYERS_NON_REMOVABLE ?= " \
/home/packt/RASPBERRYPI/poky/meta \
/home/packt/RASPBERRYPI/poky/meta-yocto \
"

Any command-line input or output is written as follows:

$ modprobe spidev

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Adding a layer is very simple. We just have to click on the Layers button."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book 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 files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Yocto-for-Raspberry-Pi. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/YoctoforRaspberryPi_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.