About This E-Book
EPUB is an open, industry-standard format for e-books. However, support for EPUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturers Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the e-book in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a Click here to view code image link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app.
Embedded Linux Systems with the Yocto Project
Rudolf J. Streif
Boston Columbus Indianapolis New York San Francisco Amsterdam Cape Town
Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City
So Paulo Sidney Hong Kong Seoul Singapore Taipei Tokyo
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the U.S., please contact .
Visit us on the Web: informit.com/ph
Cataloging-in-Publication Data is on file with the Library of Congress.
Copyright 2016 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/.
ISBN-13: 978-0-13-344324-0
ISBN-10: 0-13-344324-8
Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana.
First printing, May 2016
To Janan, Dominic, Daniel, and Jonas
Contents
Foreword
The embedded Linux landscape is a little bit like the Old West: different outposts of technology scattered here and there, with barren and often dangerous landscape in between. If youre going to travel there, you need to be well stocked, be familiar with the territory, and have a reliable guide.
Just as people moved West during the Gold Rush in the mid-1800s, developers are moving into the embedded Linux world with the rush to the Internet of Things. As increased population brought law, order, and civilization to the Old West, important new open source software projects are bringing order to embedded Linux.
The Yocto Project is a significant order-bringer. Its tools let you focus on designing your project (what you want to build) and devote only the necessary minimum of your time and effort to putting it all together (how you build what you want to build).
This book is your reliable guide. In logically ordered chapters with clear and complete instructions, it will help you get your work done and your IoT project to market. And with some luck, youll have fun along the way!
Enjoy your adventure!
Arnold Robbins
Series Editor
Preface
Smart home. Smart car. Smart phone. Smart TV. Smart thermostat. Smart lights. Smart watch. Smart washer. Smart dryer. Smart fridge. Smart basketball. Welcome to the brave new world of smart everything!
The proliferation of embedded computers in almost everything we touch and interact with in our daily lives has moved embedded systems engineering and embedded software development into the spotlight. Hidden from the direct sight of their users, embedded systems lack the attractiveness of web applications with their flashy user interfaces or the coolness of computer games with their animations and immersive graphics. It comes as no surprise that computer science students and software developers hardly ever think of embedded software engineering as their first career choice. However, the smart-everything revolution and the Internet of Things (IoT) are driving the demand for specialists who can bridge hardware and software worlds. Experts who speak the language of electric schematics as well as programming languages are sought after by employers.
Linux has become the first choice for an explosively growing number of embedded applications. There are good reasons for this choice, upon which we will elaborate in the coming chapters. Through my journey as an embedded software developer for various industries, I have learned Linux for embedded systems the hard way. There is no shortage of excellent development tools for virtually any programming language. The vast majority of libraries and applications for Linux can easily be built natively because of their tooling. Even building the Linux kernel from scratch is almost a breeze with the kernels own build system. However, when it comes to putting it all together into a bootable system, the choices are scarce.
The Yocto Project closes that gap by providing a comprehensive set of integrated tools with the OpenEmbedded build system at its center. From source code to bootable system in a matter of a few hoursI wish I had that luxury when I started out with embedded Linux!
What This Book Is and What It Is Not
A build system that integrates many different steps necessary to create a fully functional Linux OS stack from scratch is rather complex. This book is dedicated to the build system itself and how you can effectively use it to build your own custom Linux distributions. This book is not a tutorial on embedded Linux. Although how the build system assembles the many different components into an operational system), I do not go into the details of embedded Linux as such. If you are a beginning embedded Linux developer, I strongly recommend Christopher Hallinans excellent Embedded Linux Primer, published in this same book series.
In this book, you will learn how the OpenEmbedded build system works, how you can write recipes to build your own software components, how to use and create Yocto Project board support packages to support different hardware platforms, and how to debug build failures. You will learn how to build software development kits for application development and integrate them with the popular Eclipse integrated development environment (IDE) for seamless round-trip development.