Zum Hauptinhalt springen
Nicht aus der Schweiz? Besuchen Sie lehmanns.de

Mastering Embedded Linux Development (eBook)

Craft fast and reliable embedded solutions with Linux 6.6 and The Yocto Project 5.0 (Scarthgap)
eBook Download: EPUB
2025
710 Seiten
Packt Publishing (Verlag)
978-1-80324-146-3 (ISBN)

Lese- und Medienproben

Mastering Embedded Linux Development -  Chris Simmonds,  Frank Vasquez
Systemvoraussetzungen
29,99 inkl. MwSt
(CHF 29,30)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Mastering Embedded Linux Development is designed to be both a learning resource and a reference for your embedded Linux projects.
In this fourth edition, you'll learn the fundamental elements that underpin all embedded Linux projects: the toolchain, the bootloader, the kernel, and the root filesystem. First, you will download and install a pre-built toolchain. After that, you will cross-compile each of the remaining three elements from scratch and learn to automate the process using Buildroot and the Yocto Project. The book progresses with coverage of over-the-air software updates and rapid prototyping with add-on boards. Two new chapters tackle modern development practices, including Python packaging and deploying containerized applications. These are followed by a chapter on writing multithreaded code and another on techniques to manage memory efficiently. The final chapters demonstrate how to debug your code, whether it resides in user space or in the Linux kernel itself. In addition to GNU debugger (GDB), the book also covers the different tracers and profilers that are available for Linux so that you can quickly pinpoint any performance bottlenecks in your system.
By the end of this book, you will be able to create efficient and secure embedded devices with Linux that will delight your users.


Written by Frank Vasquez, an embedded Linux expert, this new edition enables you to harness the full potential of Linux to create versatile and robust embedded solutionsAll formats include a free PDF and an invitation to the Embedded System Professionals communityKey FeaturesLearn how to develop and configure reliable embedded Linux devicesDiscover the latest enhancements in Linux 6.6 and the Yocto Project 5.0, codename ScarthgapExplore different ways to debug and profile your code in both user space and the Linux kernelPurchase of the print or Kindle book includes a free PDF eBookBook DescriptionMastering Embedded Linux Development is designed to be both a learning resource and a reference for your embedded Linux projects. In this fourth edition, you'll learn the fundamental elements that underpin all embedded Linux projects: the toolchain, the bootloader, the kernel, and the root filesystem. First, you will download and install a pre-built toolchain. After that, you will cross-compile each of the remaining three elements from scratch and learn to automate the process using Buildroot and the Yocto Project. The book progresses with coverage of over-the-air software updates and rapid prototyping with add-on boards. Two new chapters tackle modern development practices, including Python packaging and deploying containerized applications. These are followed by a chapter on writing multithreaded code and another on techniques to manage memory efficiently. The final chapters demonstrate how to debug your code, whether it resides in user space or in the Linux kernel itself. In addition to GNU debugger (GDB), the book also covers the different tracers and profilers that are available for Linux so that you can quickly pinpoint any performance bottlenecks in your system. By the end of this book, you will be able to create efficient and secure embedded devices with Linux that will delight your users.What you will learnCross-compile embedded Linux images with Buildroot and YoctoEnable Wi-Fi and Bluetooth connectivity with a Yocto board support packageUpdate IoT devices securely in the field with Mender or balenaPrototype peripheral additions by connecting add-on boards, reading schematics, and coding test programsDeploy containerized software applications on edge devices with DockerDebug devices remotely using GDB and measure the performance of systems using tools like perf and plyWho this book is forIf you are a systems software engineer or system administrator who wants to learn how to apply Linux to embedded devices, then this book is for you. The book is also for embedded software engineers accustomed to programming low-power microcontrollers and will help them make the leap to a high-speed system-on-chips that can run Linux. Anyone who develops hardware for Linux will find something useful in this book. But before you get started, you will need a solid grasp of the POSIX standard, C programming, and shell scripting.]]>

Preface


Linux has been the mainstay of embedded computing for many years. And yet, there are remarkably few books that cover the topic as a whole: this book is intended to fill that gap. The term embedded Linux is not well-defined and can be applied to the operating system inside a wide range of devices ranging from thermostats to Wi-Fi routers to industrial control units. However, they are all built on the same basic open source software. Those are the technologies that I describe in this book, based on my experience as an engineer.

Technology does not stand still. The industry based around embedded computing is just as susceptible to Moore’s law as mainstream computing. The exponential growth that this implies has meant that a surprisingly large number of things have changed since the first edition of this book was published. This fourth edition is fully revised to use the latest versions of the major open source components, which include Linux 6.6, Yocto Project 5.0 Scarthgap, and Buildroot 2024.02 LTS. In addition to Autotools, the book now covers CMake, a modern build system that has seen increased adoption in recent years.

Who this book is for


This book is written for developers with an interest in embedded computing and Linux, who want to extend their knowledge into the various branches of the subject. In writing the book, I assume a basic understanding of the Linux command line, and in the programming examples, a working knowledge of the C and Python languages. Several chapters focus on the hardware that goes into an embedded target board, so a familiarity with hardware and hardware interfaces will be a definite advantage in these cases.

What this book covers


Chapter 1, Starting Out, sets the scene by describing the embedded Linux ecosystem and the choices available to you as you start your project.

Chapter 2, Learning about Toolchains, describes the components of a toolchain and where to obtain a toolchain for cross-compiling code for your target board.

Chapter 3, All about Bootloaders, explains the role of the bootloader in loading the Linux kernel into memory, and uses U-Boot as an example. It also introduces device trees as the mechanism used to encode the details of hardware in almost all embedded Linux systems.

Chapter 4, Configuring and Building the Kernel, provides information on how to select a Linux kernel for an embedded system and configure it for the hardware within the device. It also covers how to port Linux to the new hardware.

Chapter 5, Building a Root Filesystem, introduces the ideas behind the user space part of an embedded Linux implementation by means of a step-by-step guide on how to configure a root filesystem.

Chapter 6, Selecting a Build System, covers two commonly used embedded Linux build systems, Buildroot and The Yocto Project, which automate the steps described in the previous four chapters.

Chapter 7, Developing with Yocto, demonstrates how to build system images on top of an existing BSP layer, develop onboard software packages with Yocto’s extensible SDK, and roll your own embedded Linux distribution complete with runtime package management.

Chapter 8, Yocto under the Hood, is a tour of Yocto’s build workflow and architecture, including an explanation of Yocto’s unique multi-layer approach. It also breaks down the basics of BitBake syntax and semantics with examples from actual recipe files.

Chapter 9, Creating a Storage Strategy, discusses the challenges created by managing flash memory, including raw flash chips and embedded MMC (eMMC) packages. It describes the filesystems that are applicable to each type of technology.

Chapter 10, Updating Software in the Field, examines various ways of updating the software after the device has been deployed, and includes fully managed Over-the-Air (OTA) updates. The key topics under discussion are reliability and security.

Chapter 11, Interfacing with Device Drivers, describes how kernel device drivers interact with the hardware by implementing a simple driver. It also describes the various ways of calling device drivers from user space.

Chapter 12, Prototyping with Add-On Boards, demonstrates how to prototype hardware and software quickly using a pre-built Debian image for the BeaglePlay together with MikroElektronika peripheral add-on boards.

Chapter 13, Starting Up – The init Program, explains how the first user space program, init, starts the rest of the system. It describes three versions of the init program, each suitable for a different group of embedded systems, ranging from the simplicity of the BusyBox init, through System V init, to the current state-of-the-art, systemd.

Chapter 14, Managing Power, considers the various ways that Linux can be tuned to reduce power consumption, including dynamic frequency and voltage scaling, selecting deeper idle states, and system suspend. The aim is to make devices that run longer on a battery charge and also run cooler.

Chapter 15, Packaging Python, explains what choices are available for bundling Python modules together for deployment and when to use one method over another. It covers pip, virtual environments, and conda.

Chapter 16, Deploying Container Images, introduces the principles of the DevOps movement and demonstrates how to apply them to embedded Linux. First, we use Docker to bundle a Python application together with its user space environment inside a container image. Then we use GitHub Actions to set up a CI/CD pipeline for our container image. Lastly, we use Docker to perform containerized software updates on a Raspberry Pi 4.

Chapter 17, Learning about Processes and Threads, describes embedded systems from the point of view of the application programmer. This chapter looks at processes and threads, inter-process communications, and scheduling policies.

Chapter 18, Managing Memory, examines the ideas behind virtual memory and how the address space is divided into memory mappings. It also describes how to measure memory usage accurately and how to detect memory leaks.

Chapter 19, Debugging with GDB, shows you how to use the GNU debugger, GDB, together with the debug agent, gdbserver, to debug applications running remotely on the target device. It goes on to show how you can extend this model to debug kernel code, making use of the kernel debug stubs, KGDB.

Chapter 20, Profiling and Tracing, covers the techniques available to measure system performance, starting from whole system profiles and then zeroing in on specific areas where bottlenecks are causing poor performance. It also describes how to use Valgrind to check the correctness of an application’s use of thread synchronization and memory allocation.

Chapter 21, Real-Time Programming, provides a detailed guide to real-time programming on Linux using the recently merged PREEMPT_RT real-time kernel patch.

To get the most out of this book


The software used in this book is entirely open source. In almost all cases, I have used the latest stable versions available at the time of writing. While I have tried to describe the main features in a manner that is not version-specific, it is inevitable that some of the examples will need adaptation to work with later software. Here is the primary hardware and software used throughout the book:

  • QEMU (64-bit Arm)
  • Raspberry Pi 4
  • BeaglePlay
  • Yocto Project 5.0 Scarthgap
  • Buildroot 2024.02
  • Bootlin aarch64 glibc stable toolchain 2024.02-1
  • Arm GNU AArch32 bare-metal target (arm-none-eabi) toolchain 13.2.Rel1
  • U-Boot v2024.04
  • Linux kernel 6.6

Embedded development involves two systems: the host, which is used for developing the programs, and the target, which runs them. For the host system, I chose Ubuntu 24.04 LTS because of its widespread adoption and long-term maintenance guarantees. You may decide to run Linux on Docker, a virtual machine, or Windows Subsystem for Linux, but be aware that some tasks, such as building a distribution using The Yocto Project, are quite demanding and run better on a native installation of Linux.

For the targets, I chose the QEMU emulator, the Raspberry Pi 4, and the BeaglePlay. Using QEMU means that you can try out most of the examples without having to invest in any additional hardware. On the other hand, some things work better with real hardware. For that, I picked the Raspberry Pi 4 because it is inexpensive, widely available, and has very good community support. The BeaglePlay replaces the BeagleBone Black used in previous editions of the book. Of course, you are not limited to just these three targets. The idea behind the book is to provide you with general solutions to problems so that you can apply them to a wide range of target boards.

Download the example code files


The code...

Erscheint lt. Verlag 27.5.2025
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Betriebssysteme / Server
ISBN-10 1-80324-146-2 / 1803241462
ISBN-13 978-1-80324-146-3 / 9781803241463
Informationen gemäß Produktsicherheitsverordnung (GPSR)
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Ohne DRM)

Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopier­schutz. Eine Weiter­gabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persön­lichen Nutzung erwerben.

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich