29,99 €
Optimize and boost your Linux-based system with Yocto Project and increase its reliability and robustness efficiently and cost-effectively.
About This BookOptimize your Yocto Project tools to develop efficient Linux-based projectsPractical approach to learning Linux development using Yocto ProjectDemonstrates concepts in a practical and easy-to-understand wayWho This Book Is For
If you are an embedded Linux developer with a basic knowledge of Yocto Project and want to broaden your knowledge with examples of embedded development, then this book is for you. This book is also for professionals who want to find new insights into working methodologies for Linux development.
What You Will LearnUnderstand the basic concepts involved in Poky workflows along with configuring and preparing the Poky build environment.Configure a build server and customize images using Toaster.Generate images and fit packages into created images using BitBake.Support the development process by setting up and using Package feeds.Debug Yocto Project by configuring Poky.Build an image for the BeagleBone Black, RaspberryPi 3, and Wandboard, and boot it from an SD card.In Detail
Yocto Project is turning out to be the best integration framework for creating reliable embedded Linux projects. It has the edge over other frameworks because of its features such as less development time and improved reliability and robustness.
Embedded Linux Development using Yocto Project starts with an in-depth explanation of all Yocto Project tools, to help you perform different Linux-based tasks. The book then moves on to in-depth explanations of Poky and BitBake. It also includes some practical use cases for building a Linux subsystem project using Yocto Project tools available for embedded Linux. The book also covers topics such as SDK, recipetool, and others.
By the end of the book, you will have learned how to generate and run an image for real hardware boards and will have gained hands-on experience at building efficient Linux systems using Yocto Project.
Style and approach
A clear, concise, and straightforward book that will enable you to use and implement the latest features of Yocto Project.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Veröffentlichungsjahr: 2017
BIRMINGHAM - MUMBAI
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2014
Second edition: November 2017
Production reference: 1141117
ISBN: 978-1-78847-046-9
www.packtpub.com
Authors
Otavio Salvador
Daiane Angolini
Copy Editors
Safis Editing
Juliana Nair
Reviewer
Radek Dostal
Project Coordinator
Judie Jose
Commissioning Editor
Gebin George
Proofreader
Safis Editing
Acquisition Editor
Prateek Bharadwaj
Indexer
Rekha Nair
Content Development Editor
Nikita Pawar
Graphics
Tanya Dutta
Technical Editor
Manish D Shanbhag
Production Coordinator
Nilesh Mohite
Otavio Salvador loves technology and started his free software activities in 1999. In 2002, he founded O.S. Systems, a company focused on embedded system development services and consultancy worldwide, creating and maintaining customized BSPs and helping companies with their product development challenges. This resulted in him joining the OpenEmbedded community in 2008, where he became an active contributor to the OpenEmbedded project.
Daiane Angolini has been working with embedded Linux since 2008. She has been working as an application engineer at NXP, acting on internal development, porting custom applications from Android, and on-site customer support for i.MX architectures in areas such as Linux kernel, u-boot, Android, Yocto Project, and user space applications. However, it was on the Yocto Project that she found her place.
Radek Dostal is a fan of Linux and has been using it for the last 15 years. During his exchange studies in the US, he acquired a passion for embedded systems, and combining Linux with embedded systems has been his bread and butter ever since. Yocto has had a great impact on Radek's work: he managed to convince his team and managers to switch to Yocto for an important project, which built a solid foundation for several successful follow-up projects. Radek likes to contribute to open source projects as part of his work, as well as during his free time. However, if the weather is good during the weekend, you are most likely to find him in the mountains.
For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/178847046X.
If you'd like to join our team of regular reviewers, you can email us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the color images of this book
Errata
Piracy
Questions
Meeting the Yocto Project
What is the Yocto Project?
Delineating the Yocto Project
Understanding Poky
Using BitBake
OpenEmbedded-Core
Metadata
The alliance of the OpenEmbedded Project and the Yocto Project
Summary
Baking Our Poky-Based System
Configuring a host system
Installing Poky on Debian
Installing Poky on Fedora
Downloading the Poky source code
Preparing the build environment
Knowing the local.conf file
Building a target image
Running images in QEMU
Summary
Using Toaster to Bake an Image
What is Toaster?
Installing Toaster
Starting Toaster
Building an image to QEMU
Summary
Grasping the BitBake Tool
Understanding the BitBake tool
Exploring metadata
Parsing metadata
Dependencies
Preferring and providing recipes
Fetching the source code
Remote file downloads
Git repositories
Optimizing the source code download
Disabling network access
Understanding BitBake's tasks
Extending tasks
Generating a root filesystem image
Summary
Detailing the Temporary Build Directory
Detailing the build directory
Constructing the build directory
Exploring the temporary build directory
Understanding the work directory
Understanding the sysroot directories
Summary
Assimilating Packaging Support
Using supported package formats
List of supported package formats
Choosing a package format
Running code during package installation
Understanding shared state cache
Explaining package versioning
Specifying runtime package dependencies
Package feeds
Using package feeds
Summary
Diving into BitBake Metadata
Using metadata
Working with metadata
The basic variable setting
Variable expansion
Setting a default value using ?=
Setting a default value using ??=
Immediate variable expansion
Appending and prepending
Override syntax operators
Conditional metadata set
Conditional appending
File inclusion
Python variable expansion
Defining executable metadata
Defining Python functions in the global namespace
The inheritance system
Summary
Developing with the Yocto Project
Deciphering the software development kit
Working with the Poky SDK
Using an image-based SDK
Generic SDK – meta-toolchain
Using an SDK
Developing applications on the target
Integrating with Eclipse
Summary
Debugging with the Yocto Project
Differentiating metadata and application debugging
Tracking image, package, and SDK contents
Debugging packaging
Logging information during task execution
Utilizing a development shell
Using the GNU Project Debugger for debugging
Summary
Exploring External Layers
Powering flexibility with layers
Detailing the layer's source code
Adding meta layers
The Yocto Project layer ecosystem
Summary
Creating Custom Layers
Making a new layer
Adding metadata to the layer
Creating an image
Adding a package recipe
Automatically creating a base package recipe using recipetool
Adding support to a new machine definition
Wrapping an image for your machine
Using a custom distribution
MACHINE_FEATURES versus DISTRO_FEATURES
Understanding the variables scope
Summary
Customizing Existing Recipes
Common use cases
Adding extra options to recipes based on Autoconf
Applying a patch
Adding extra files to the existing packages
Understanding file searching paths
Changing recipe feature configuration
Customizing BusyBox
Customizing the linux-yocto framework
Summary
Achieving GPL Compliance
Understanding copyleft
Copyleft compliance versus proprietary code
Some guidelines for license compliance
Managing software licensing with Poky
Commercial licenses
Using Poky to achieve copyleft compliance
License auditing
Providing the source code
Providing compilation scripts and source code modifications
Providing license text
Summary
Booting Our Custom Embedded Linux
Exploring the boards
Discovering the right BSP layer
Baking for the hardware
Baking for BeagleBone Black
Baking for Raspberry Pi 3
Baking for the Wandboard
Booting our baked image
Booting BeagleBone Black from the SD card
Booting Raspberry Pi 3 from the SD card
Booting Wandboard from the SD card
Next steps
Summary
In the current technology trend, Linux is the next big thing. Linux has consistently released cutting-edge open source products, and Embedded Systems have been wrought in the technological portfolio of mankind.
The Yocto Project is in an optimal position to be the choice for your projects, and it provides a rich set of tools to help you use most of your energy and resources in your product development, instead of reinventing the wheel.
The usual tasks and requirements of Embedded Linux-based products and development teams were the guideline for this book’s conception. Being written by active community members, with a practical and straightforward approach, it is a stepping stone for both your learning curve and the product’s project.
Chapter 1, Meeting the Yocto Project, presents the first concepts and premises to introduce parts of the Yocto Project and their main tools.
Chapter 2, Baking Our Poky-Based System, introduces the environment needed for the first build.
Chapter 3, Using Toaster to Bake an Image, shows the user-friendly web interface that can be used as a wrapper for configuration and as a build tool.
Chapter 4, Grasping the BitBake Tool, presents the BitBake tool and how it manages the tasks and its dependencies.
Chapter 5, Detailing the Temporary Build Directory, details the temporary output folder of a build.
Chapter 6, Assimilating Packaging Support, explains the packaging mechanism used as base to create and manage all the binary packages.
Chapter 7, Diving into BitBake Metadata, details the BitBake metadata language which will be used for all the other chapters.
Chapter 8, Developing with the Yocto Project, demonstrates the workflow needed to obtain a development environment.
Chapter 9, Debugging with the Yocto Project, shows how to use Poky to generate a debug environment and how to use it.
Chapter 10, Exploring External Layers, explores one of the most important concepts of the Yocto Project—the flexibility of using external layers.
Chapter 11, Creating Custom Layers, practices the steps on layers creation.
Chapter 12, Customizing Existing Recipes, presents examples on how to customize the existing recipes.
Chapter 13, Achieving GPL Compliance, summarizes the tasks and concepts involved for a copyleft compliance product.
Chapter 14, Booting Our Custom Embedded Linux, uses real hardware machines together with the Yocto Project’s tools.
To understand this book better, it is important that you have some previous background about some topics which are not covered or are just briefly mentioned along the text, such as Git and Linux Kernel general knowledge, and basic compilation process.
In order to understand the big picture of the Yocto Project before going to the technical concepts detailed in this book, we recommend the open sourced booklet, Heading for the Yocto Project, found under the Git repository athttps://git.io/vFUiI; the content of this booklet is intended to help newcomers to gain a better understanding of the goals of the Yocto Project and its potential uses, and it intends to provide an overview of the project, before diving into the technical details on how things can be done.
A basic understanding of the use of the GNU/Linux environment and Embedded Linux is required as well as that of the general concepts used in development such as compilation, debugging, deployment, and installation. Some experience with Shell Script and Python is a bonus, because these programming languages are core technologies used extensively by the Yocto Project’s tools.
You shouldn’t take any missing concepts—of those we enumerated above—as a deterrent, but as something you can learn and at the same time, practice its use, with this book. However, if you prefer to learn more about those topics, we recommend the book Mastering Embedded Linux Programming, ISBN: 9781787283282, by Chris Simmonds.
Any concept enumerated above, should not discourage you from reading this book because these can be learned concurrently.
This book is intended for engineers and enthusiasts with an Embedded Linux experience, willing to learn the Yocto Project’s tools for evaluation, comparison, or use in a project. This book is aimed to get you up to sprint quickly and to prevent you from getting trapped into the usual learning curve pitfalls.