ebook img

Mastering Embedded Linux Programming: Unleash the full potential of Embedded Linux with Linux 4.9 and Yocto Project 2.2 (Morty) Updates, 2nd Edition PDF

468 Pages·2017·5.143 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Mastering Embedded Linux Programming: Unleash the full potential of Embedded Linux with Linux 4.9 and Yocto Project 2.2 (Morty) Updates, 2nd Edition

Mastering Embedded Linux Programming Second Edition Unleash the full potential of Embedded Linux Chris Simmonds BIRMINGHAM - MUMBAI Mastering Embedded Linux Programming Second Edition 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 author, 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: December 2015 Second edition: June 2017 Production reference: 1280617 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78728-328-2 www.packtpub.com Credits Author Copy Editors Chris Simmonds Madhusudan Uchil Stuti Shrivastava Reviewers Project Coordinator Daiane Angolini Virginia Dias Otavio Salvador Alex Tereschenko Commissioning Editor Proofreader Kartikey Pandey Safis Editing Acquisition Editor Indexer Prateek Bharadwaj Rekha Nair Content Development Editor Graphics Sharon Raj Kirk D'Penha Technical Editor Production Coordinator Vishal Kamal Mewada Melwyn Dsa About the Author Chris Simmonds is a software consultant and trainer living in southern England. He has almost two decades of experience in designing and building open-source embedded systems. He is the founder and chief consultant at 2net Ltd, which provides professional training and mentoring services in embedded Linux, Linux device drivers, and Android platform development. He has trained engineers at many of the biggest companies in the embedded world, including ARM, Qualcomm, Intel, Ericsson, and General Dynamics. He is a frequent presenter at open source and embedded conferences, including the Embedded Linux Conference and Embedded World. You can see some of his work on the Inner Penguin blog at www.2net.co.uk. I would like to thank Shirley Simmonds for being so supportive during the long hours that I was shut in my home office researching and writing this book. I would also like to thank all the people who have helped me with the research of the technical aspects of this book, whether they realized that is what they were doing or not. In particular, I would like to mention Klaas van Gend, Thomas Petazzoni, and Ralph Nguyen for their help and advice. Lastly, I would like to thank Sharon Raj, Vishal Mewada, and the team at Packt Publishing for keeping me on track and bringing the book to fruition. About the Reviewers 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-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. She has coauthored the books Embedded Linux Development with Yocto Project and Heading for the Yocto Project, and learned a lot in the process. 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's development challenges. This resulted in him joining the OpenEmbedded community in 2008, when he became an active contributor to the OpenEmbedded project. He has coauthored the books Embedded Linux Development with Yocto Project and Heading for the Yocto Project. Alex Tereschenko is an embedded systems engineer by day, and an avid maker by night, who is convinced that computers can do a lot of good for people when they are interfaced with real-world objects, as opposed to just crunching data in a dusty corner. That's what's driving him in his projects, and this is why embedded systems and the Internet of Things are the topics he enjoys the most. www.PacktPub.com 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.comand 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. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser Customer Feedback 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/1787283283. If you'd like to join our team of regular reviewers, you can e-mail 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! Table of Contents Preface 1 Chapter 1: Starting Out 8 Selecting the right operating system 9 The players 10 Project life cycle 12 The four elements of embedded Linux 12 Open source 13 Licenses 13 Hardware for embedded Linux 15 Hardware used in this book 16 The BeagleBone Black 16 QEMU 17 Software used in this book 18 Summary 19 Chapter 2: Learning About Toolchains 20 Introducing toolchains 21 Types of toolchains 22 CPU architectures 23 Choosing the C library 25 Finding a toolchain 26 Building a toolchain using crosstool-NG 28 Installing crosstool-NG 28 Building a toolchain for BeagleBone Black 28 Building a toolchain for QEMU 30 Anatomy of a toolchain 31 Finding out about your cross compiler 31 The sysroot, library, and header files 34 Other tools in the toolchain 34 Looking at the components of the C library 35 Linking with libraries – static and dynamic linking 36 Static libraries 37 Shared libraries 38 Understanding shared library version numbers 39 The art of cross compiling 40 Simple makefiles 40 Autotools 41 An example: SQLite 43 Package configuration 44 Problems with cross compiling 45 Summary 46 Chapter 3: All About Bootloaders 47 What does a bootloader do? 48 The boot sequence 48 Phase 1 – ROM code 49 Phase 2 – secondary program loader 50 Phase 3 – TPL 51 Booting with UEFI firmware 52 Moving from bootloader to kernel 53 Introducing device trees 54 Device tree basics 55 The reg property 56 Labels and interrupts 57 Device tree include files 58 Compiling a device tree 60 Choosing a bootloader 60 U-Boot 61 Building U-Boot 61 Installing U-Boot 63 Using U-Boot 65 Environment variables 66 Boot image format 66 Loading images 67 Booting Linux 69 Automating the boot with U-Boot scripts 69 Porting U-Boot to a new board 70 Board-specific files 71 Configuring header files 73 Building and testing 73 Falcon mode 75 Barebox 75 Getting barebox 75 Building barebox 76 Using barebox 77 Summary 78 [ ii ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.