• Stars
    star
    460
  • Rank 91,676 (Top 2 %)
  • Language
    C
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mastering Embedded Linux Programming Third Edition, published by Packt

Mastering Embedded Linux Programming – Third Edition

Mastering Embedded Linux Programming – Third Edition

This is the code repository for Mastering Embedded Linux Programming – Third Edition, published by Packt.

Create fast and reliable embedded solutions with Linux 5.4 and the Yocto Project 3.1 (Dunfell)

What is this book about?

Embedded Linux runs many of the devices we use every day. From smart TVs and Wi-Fi routers to test equipment and industrial controllers, all of them have Linux at their heart. The Linux OS is one of the foundational technologies comprising the core of the Internet of Things (IoT). This book starts by breaking down the fundamental elements that underpin all embedded Linux projects: the toolchain, the bootloader, the kernel, and the root filesystem. After that, you will learn how to create each of these elements from scratch and automate the process using Buildroot and the Yocto Project.

This book covers the following exciting features:

  • Use Buildroot and the Yocto Project to create embedded Linux systems
  • Troubleshoot BitBake build failures and streamline your Yocto development workflow
  • Update IoT devices securely in the field using Mender or balena
  • Prototype peripheral additions by reading schematics, modifying device trees, soldering breakout boards, and probing pins with a logic analyzer
  • Interact with hardware without having to write kernel device drivers

If you feel this book is for you, get your copy today!

Instructions and Navigations

All of the code is organized into folders. For example, Chapter02.

The code will look like the following:

if (test expression)
{
  Statement upon condition is true
}

Following is what you need for this book: If you’re a systems software engineer or system administrator who wants to learn Linux implementation on embedded devices, then this book is for you. Embedded systems engineers accustomed to programming for low-power microcontrollers can use this book to help make the leap to high-speed systems on chips that can run Linux. Anyone responsible for developing new hardware that needs to run Linux will also find this book useful. Basic working knowledge of the POSIX standard, C programming, and shell scripting is assumed.

With the following software and hardware list you can run all code examples present in the book (Chapter 1-21).

Software and Hardware List

Chapters Software/Hardware Required OS Required
3, 4, 5, 6, 9, 11, 12, 15, 21 BeagleBone Black Not Applicable
4, 6, 7, 10, 14, 19, 20 Raspberry Pi 4 Not Applicable
4, 5, 6 QEMU (32-bit arm) Linux (Any)
6, 7, 8, 10, 13, 19, 21 Yocto Project 3.1 (Dunfell) Compatible Linux Distribution
6, 12, 13, 14, 19, 20, 21 Buildroot 2020.02 LTS Linux (Any)
2, 3, 4, 5 Crosstool-NG 1.24.0 Linux (Any)
3, 9 U-Boot v2021.01 Linux (Any)
4 Linux Kernel 5.4 Linux (Any)

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.

Errata

Preface: In the Download Color Images section link https://static.packt-cdn.com/downloads/9781801071000_ColorImages.pdf should be https://static.packt-cdn.com/downloads/9781789530384_ColorImages.pdf

Page 26: The crosstool-ng-1.24.0 tag of crosstool-ng no longer builds because its expat-2.2.6 and isl-0.20 dependencies were relocated to different hosts. The simplest fix is to clone the latest version of the crosstool-ng source from the master branch of the Git repo.

$ git clone https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=${PWD}
$ make
$ make install

When crosstool-ng's maintainers tag a release after 1.24.0 readers can downgrade to that for stability.

Page 43: http://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz may be no longer available. Replace it with an up-to-date source code URL from SQLite Download Page and adjust the subsequent tar and cd commands' arguments.

Page 44: The path where the SQLite header files are installed is wrong. Here is their correct location.

  • <sysroot>/usr/include: sqlite3.h, sqlite3ext.h: These are the header files.

Page 55: TI's x-loader code was integrated into upstream U-Boot back a long time ago. There should be no mention of it when discussing open source SPLs.

Page 67: "which would be sdb in the first example" should use sda instead.

Page 107: The exercise on building a kernel for QEMU is missing a critical step where the versatile_defconfig is selected and a .config file is generated prior to compiling.

$ cd linux-stable
$ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- mrproper
$ make ARCH=arm versatile_defconfig
$ make -j4 ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- zImage
$ make -j4 ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- modules
$ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi- dtbs

These commands are also captured in a build-linux-versatilepb.sh script under the Chapter04 directory.

Page 109: The exercise where we boot Linux for the first time on the BeagleBone Black is missing the serial baud rate from the kernel boot parameters. Before entering bootz 0x80200000 - 0x80f00000 at the U-Boot prompt enter the following command:

setenv bootargs console=ttyO0,115200

This command replaces the incomplete setenv bootargs console=ttyO0 command that was printed on that page of the book. The baud rate (115200 in this case) needs to match the setting used in the host terminal program (e.g. gtkterm, minicom, or screen) otherwise we won't see any messages after Starting the kernel ... in the serial console.

Some readers have remarked that the letter O in console=ttyO0 looks like a typo and asked if the console kernel boot parameter should instead be set to tty00 with two zeros. The answer is no, console=ttyO0 is in fact not a typo and console=tty00 is never a valid option. Nowadays, it is best to use console=ttyS0 with TI boards like the BeagleBone Black.

There are two kernel configuration options for the serial driver on the TI AM335x: either SERIAL_8250_OMAP or the generic SERIAL_8250. The OMAP driver is preferable because is supports additional features, but for a serial console it really makes no difference. In older versions of Linux, the OMAP driver was named ttyO using the letter O, but code was added in Linux 3.18 to handle both ttyS and ttyO.

Page 156: The commands for mounting a root filesystem on QEMU and the BeagleBone Black using NFS are missing the v3 option from the nfsroot kernel boot parameter.

The QEMU start command should look like this:

QEMU_AUDIO_DRV=none \
qemu-system-arm -m 256M -nographic -M versatilepb -kernel ${KERNEL} -append "console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=${HOST_IP}:${ROOTDIR},v3 ip=${TARGET_IP}" -dtb ${DTB} -net nic -net tap,ifname=tap0,script=no

The U-Boot commands should look like this:

setenv serverip <host IP>
setenv ipaddr <target IP>
setenv npath <path to staging directory>
setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=${serverip}:${npath},v3 ip=${ipaddr}
fatload mmc 0:1 0x80200000 zImage
fatload mmc 0:1 0x80f00000 am335x-boneblack.dtb
bootz 0x80200000 - 0x80f00000

Replace <host IP>, <target IP>, and <path to staging directory> with their actual values. Note that these same placeholder values also need to be updated in the run-qemu-nfsroot.sh and uEnv.txt scripts for Chapter05.

Page 554: To cross-compile the shared-mem-demo example program for Arm Cortex-A8 SoCs:

$ arm-cortex_a8-linux-gnueabihf-gcc shared-mem-demo.c -lrt -pthread \
-o shared-mem-demo

The command printed in the book generates an executable named arm-cortex_a8-linux-gnueabihf-gcc by mistake.

Related products

Get to Know the Authors

Frank Vasquez is a Staff Embedded Software Engineer at Element Energy. He has over a decade of experience designing and building embedded Linux systems. During that time, he has shipped numerous devices including a rackmount DSP audio server, a diver-held sonar camcorder, and a consumer IoT hotspot. Before his career as an embedded Linux engineer, Frank was a database kernel developer at IBM where he worked on Db2. He lives in Silicon Valley.

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.

Other books by the authors

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781789530384

More Repositories

1

Deep-Reinforcement-Learning-Hands-On

Hands-on Deep Reinforcement Learning, published by Packt
Python
2,750
star
2

The-Kaggle-Book

Code Repository for The Kaggle Book, Published by Packt Publishing
Jupyter Notebook
2,056
star
3

Advanced-Deep-Learning-with-Keras

Advanced Deep Learning with Keras, published by Packt
Python
1,700
star
4

Hands-On-Machine-Learning-for-Algorithmic-Trading

Hands-On Machine Learning for Algorithmic Trading, published by Packt
Jupyter Notebook
1,280
star
5

Node.js-Design-Patterns-Third-Edition

Node.js Design Patterns Third Edition, published by Packt
JavaScript
1,162
star
6

Machine-Learning-for-Algorithmic-Trading-Second-Edition_Original

Machine Learning for Algorithmic Trading, Second Edition - published by Packt
Jupyter Notebook
1,083
star
7

Deep-Learning-with-Keras

Code repository for Deep Learning with Keras published by Packt
Jupyter Notebook
1,047
star
8

Deep-Reinforcement-Learning-Hands-On-Second-Edition

Deep-Reinforcement-Learning-Hands-On-Second-Edition, published by Packt
Jupyter Notebook
1,028
star
9

Learning-JavaScript-Data-Structures-and-Algorithms-Third-Edition

Learning JavaScript Data Structures and Algorithms (Third Edition), published by Packt
JavaScript
1,007
star
10

40-Algorithms-Every-Programmer-Should-Know

40 Algorithms Every Programmer Should Know, published by Packt
Python
910
star
11

Learn-CUDA-Programming

Learn CUDA Programming, published by Packt
Cuda
849
star
12

3D-Graphics-Rendering-Cookbook

3D Graphics Rendering Cookbook, published by Packt.
C++
847
star
13

Vulkan-Cookbook

Code repository for Vulkan Cookbook by Packt
C++
784
star
14

Linux-Kernel-Programming

Linux Kernel Programming, published by Packt
Makefile
759
star
15

Learn-Algorithmic-Trading

Learn Algorithmic Trading, Published by Packt
Python
730
star
16

Django-4-by-example

Django 4 by example (4th Edition) published by Packt
Python
718
star
17

Django-3-by-Example

Django 3 by Example (3rd Edition) published by Packt
Python
710
star
18

Node.js_Design_Patterns_Second_Edition_Code

Code repository for Node.js Design Patterns Second Edition, published by Packt
JavaScript
706
star
19

Python-for-Finance-Cookbook

Python for Finance Cookbook, published by Packt
Jupyter Notebook
665
star
20

Pandas-Cookbook

Pandas Cookbook, published by Packt
Jupyter Notebook
623
star
21

Hands-on-Exploratory-Data-Analysis-with-Python

Hands-on Exploratory Data Analysis with Python, published by Packt
Jupyter Notebook
619
star
22

Java-Coding-Problems

Java Coding Problems, published by Packt
Java
615
star
23

Hands-On-Domain-Driven-Design-with-.NET-Core

Hands-On Domain-Driven Design with .NET Core, published by Packt
C#
602
star
24

Modern-Computer-Vision-with-PyTorch

Modern Computer Vision with PyTorch, published by Packt
Jupyter Notebook
585
star
25

Hands-On-GPU-Accelerated-Computer-Vision-with-OpenCV-and-CUDA

Hands-On GPU Accelerated Computer Vision with OpenCV and CUDA, published by Packt
C++
584
star
26

Django-2-by-Example

Django 2 by Example (2nd Edition) published by Packt
Python
567
star
27

Learning-OpenCV-4-Computer-Vision-with-Python-Third-Edition

Learning OpenCV 4 Computer Vision with Python 3 – Third Edition, published by Packt
Python
562
star
28

Learn-Data-Structures-and-Algorithms-with-Golang

Learn Data Structures and Algorithms with Golang, published by Packt
Go
557
star
29

Causal-Inference-and-Discovery-in-Python

Causal Inference and Discovery in Python by Packt Publishing
Jupyter Notebook
555
star
30

TensorFlow-Machine-Learning-Cookbook

Code repository for TensorFlow Machine Learning Cookbook by Packt
Python
552
star
31

Transformers-for-Natural-Language-Processing

Transformers for Natural Language Processing, published by Packt
Jupyter Notebook
539
star
32

Data-Engineering-with-Python

Data Engineering with Python, published by Packt
Python
537
star
33

Mastering-OpenCV-4-Third-Edition

Mastering OpenCV 4, Third Edition, published by Packt publishing
Assembly
520
star
34

Cpp17-STL-Cookbook

Code files by Packt
C++
514
star
35

Clean-Code-in-Python

Clean Code in Python, published by Packt
Python
513
star
36

Hands-On-Graph-Neural-Networks-Using-Python

Hands-On Graph Neural Networks Using Python, published by Packt
Jupyter Notebook
500
star
37

Getting-Started-with-TensorFlow

Getting Started with TensorFlow, published by Packt
Python
491
star
38

Hands-On-Data-Structures-and-Algorithms-with-Rust

Hands-On Data Structures and Algorithms with Rust, published by Packt
Rust
486
star
39

Linux-Device-Drivers-Development

Linux Device Drivers Development, published by Packt
C
482
star
40

Python-Machine-Learning-Second-Edition

Python Machine Learning - Second Edition, published by Packt
Jupyter Notebook
477
star
41

Mastering-Graphics-Programming-with-Vulkan

C++
469
star
42

Learn-LLVM-12

Learn LLVM 12, published by Packt
C++
465
star
43

Python-3-Object-Oriented-Programming-Third-Edition

Python 3 Object-Oriented Programming – Third Edition, published by Packt
Python
453
star
44

Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud

Hands-On Microservices with Spring Boot and Spring Cloud, published by Packt
Java
452
star
45

Software-Architecture-with-Cpp

Software Architecture with C++, published by Packt
C++
447
star
46

Full-Stack-React-Projects-Second-Edition

Full-Stack React Projects - Second Edition, published by Packt
JavaScript
445
star
47

Python-Feature-Engineering-Cookbook

Python Feature Engineering Cookbook, published by Packt
Jupyter Notebook
442
star
48

Deep-Learning-with-PyTorch

Deep Learning with PyTorch, published by Packt
Jupyter Notebook
437
star
49

Interpretable-Machine-Learning-with-Python

Interpretable Machine Learning with Python, published by Packt
Jupyter Notebook
423
star
50

Python-Machine-Learning-Cookbook

Code files for Python-Machine-Learning-Cookbook
Python
416
star
51

Modern-CMake-for-Cpp

Modern CMake for C++, published by Packt
Dockerfile
411
star
52

Artificial-Intelligence-with-Python

Code repository for Artificial Intelligence with Python, published by Packt
Python
408
star
53

Hands-On-Software-Engineering-with-Golang

Hands-On Software Engineering with Golang, published by Packt
Go
406
star
54

Mastering-Python-for-Finance-Second-Edition

Mastering Python for Finance – Second Edition, published by Packt
Jupyter Notebook
394
star
55

Go-Design-Patterns

This is the code repository for the book, Go Design Patterns, published by Packt
Go
394
star
56

Mastering-Python-Design-Patterns-Second-Edition

Mastering-Python-Design-Patterns-Second-Edition, published by Packt
Python
389
star
57

Mastering-Go-Second-Edition

Mastering Go Second Edition, published by Packt
Go
384
star
58

Hands-On-Machine-Learning-with-CPP

Hands-On Machine Learning with C++, published by Packt
C++
377
star
59

Learn-OpenCV-4-By-Building-Projects-Second-Edition

Learn OpenCV 4 By Building Projects, Second Edition, published by Packt
C++
367
star
60

Hands-On-Computer-Vision-with-TensorFlow-2

Hands-On Computer Vision with TensorFlow 2, published by Packt
Jupyter Notebook
366
star
61

Mastering-OpenCV-4-with-Python

Mastering OpenCV 4 with Python, published by Packt
Python
362
star
62

Hands-On-Microservices-with-Rust

Hands-On Microservices with Rust 2018, published by Packt
Rust
354
star
63

Hands-On-Design-Patterns-with-CPP

Hands-On Design Patterns with C++, published by Packt
C
353
star
64

Python-Machine-Learning-Blueprints

Code repository for Python Machine Learning Blueprints, published by Packt
Jupyter Notebook
349
star
65

Practical-Time-Series-Analysis

Practical Time-Series Analysis, published by Packt
Jupyter Notebook
345
star
66

Machine-Learning-for-Algorithmic-Trading-Bots-with-Python

Jupyter Notebook
337
star
67

Machine-Learning-for-Finance

Machine Learning for Finance, published by Packt
Jupyter Notebook
336
star
68

Effective-Python-Penetration-Testing

Effective Python Penetration Testing by Packt Publishing
Python
334
star
69

Python-Algorithmic-Trading-Cookbook

Python Algorithmic Trading Cookbook, published by Packt
Jupyter Notebook
325
star
70

Hands-On-Intelligent-Agents-with-OpenAI-Gym

Code for Hands On Intelligent Agents with OpenAI Gym book to get started and learn to build deep reinforcement learning agents using PyTorch
Python
322
star
71

Python-Artificial-Intelligence-Projects-for-Beginners

Python Artificial Intelligence Projects for Beginners, published by Packt
Jupyter Notebook
321
star
72

Hands-On-Reactive-Programming-in-Spring-5

Hands-On Reactive Programming in Spring 5, published by Packt
Java
320
star
73

Micro-State-Management-with-React-Hooks

Micro State Management with React Hooks, published by Packt
TypeScript
317
star
74

The-Azure-Cloud-Native-Architecture-Mapbook

The Azure Cloud Native Architecture Mapbook, published by Packt
C#
315
star
75

Godot-Game-Engine-Projects

Godot Game Engine Projects, published by Packt
GDScript
315
star
76

Modern-Time-Series-Forecasting-with-Python

Modern Time Series Forecasting with Python, published by Packt
Jupyter Notebook
315
star
77

Python-GUI-Programming-Cookbook-Second-Edition

Python GUI Programming Cookbook, Second Edition, published by Packt
Python
312
star
78

Computer-Vision-with-OpenCV-3-and-Qt5

Computer Vision with OpenCV 3 and Qt5, published by Packt
C++
305
star
79

Learning-PySpark

Code repository for Learning PySpark by Packt
Jupyter Notebook
303
star
80

Deep-Learning-with-TensorFlow-2-and-Keras

Deep Learning with TensorFlow 2 and Keras, published by Packt
Jupyter Notebook
302
star
81

PyTorch-Computer-Vision-Cookbook

PyTorch Computer Vision Cookbook, Published by Packt
Jupyter Notebook
302
star
82

Mastering-Machine-Learning-for-Penetration-Testing

Mastering Machine Learning for Penetration Testing, published by Packt
Python
298
star
83

Learning-Vuejs-2

This is the code repository for Learning Vue.js 2, published by Packt.
JavaScript
296
star
84

Building-Data-Science-Applications-with-FastAPI

Building Data Science Applications with FastAPI, Published by Packt
Python
295
star
85

OpenGL-4-Shading-Language-Cookbook-Third-Edition

OpenGL 4 Shading Language Cookbook - Third Edition, published by Packt
C
295
star
86

Mastering-Transformers

Mastering Transformers, published by Packt
Jupyter Notebook
289
star
87

Neural-Network-Projects-with-Python

Neural Network Projects with Python, Published by Packt
Python
289
star
88

Bioinformatics-with-Python-Cookbook-Second-Edition

Bioinformatics with Python Cookbook Second Edition, published by Packt
OpenEdge ABL
287
star
89

Hands-on-Python-for-Finance

Hands-on Python for Finance published by Packt.
Jupyter Notebook
284
star
90

Full-Stack-React-TypeScript-and-Node

Full-Stack React, TypeScript, and Node, published by Packt
TypeScript
282
star
91

CPP-Data-Structures-and-Algorithms

C++ Data Structures and Algorithms, published by Packt
C++
279
star
92

The-Modern-Cpp-Challenge

The Modern C++ Challenge, published by Packt
C
276
star
93

The-Complete-Coding-Interview-Guide-in-Java

The Complete Coding Interview Guide in Java, published by Packt
Java
272
star
94

Pandas-Cookbook-Second-Edition

Pandas Cookbook Second Edition, published by Packt
Jupyter Notebook
271
star
95

Full-Stack-React-Projects

Full-Stack React Projects, published by Packt
JavaScript
271
star
96

Machine-Learning-for-Cybersecurity-Cookbook

Machine Learning for Cybersecurity Cookbook, published by Packt
Jupyter Notebook
270
star
97

Natural-Language-Processing-with-TensorFlow

Natural Language Processing with TensorFlow, published by Packt
Jupyter Notebook
269
star
98

50-Projects-In-50-Days---HTML-CSS-JavaScript

50 Projects In 50 Days - HTML, CSS & JavaScript, by Packt Publishing
CSS
269
star
99

Hands-On-Image-Processing-with-Python

Jupyter Notebook
264
star
100

Mastering-Distributed-Tracing

"Mastering Distributed Tracing" by Yuri Shkuro, published by Packt
Java
264
star