2.3 Embedded Linux distributions

Beginners often talk about “Embedded Linux” as if it were a stripped-down, separate operating system from the Linux running on cloud servers or workstations. In reality, there is no separate “Embedded Linux” kernel. Whether a system is a 128-core cloud server, an Android smartphone, or a Raspberry Pi 4 gateway sitting in a greenhouse, it runs a kernel built from the same Linux source tree, which Linus Torvalds started in 1991 and which is released under the GNU General Public License version 2 (GPL-2.0).1 Vendors often build from a downstream branch of that tree: the Raspberry Pi kernel is the mainline long-term kernel plus Raspberry Pi’s own drivers and patches.
What makes a Linux system “embedded” is how the kernel is configured (Kconfig), how the hardware is described to it (Devicetree), and what user-space tools, libraries, and services are packaged around it to form a Linux distribution.
Kernel space, user space, and OS architecture
Section titled “Kernel space, user space, and OS architecture”To understand how an embedded Linux distribution is put together, we first need to draw the boundary between kernel space and user space:
User space and kernel space
Click any block or link to see what it does.
Click a layer or a crossing, or pick a trace to follow a call to the hardware.
Figure 2.8. The hard memory boundary between unprivileged user space (EL0) and privileged kernel space (EL1) on an Arm Cortex-A gateway.
On an Armv8-A processor (such as the Cortex-A72 in the Raspberry Pi 4 or Cortex-A76 in the Pi 5)2, the CPU hardware enforces distinct Exception Levels (EL):3
- User space (
EL0): Every application runs in unprivileged mode inside its own virtual memory space managed by the MMU. User-space code cannot touch physical hardware registers or another process’s memory directly. To access a sensor on an I²C bus or send an MQTT packet, the application calls a standard library function (open(),ioctl(),write()), which executes a synchronous hardware trap instruction (svc) to cross into the kernel. - Kernel space (
EL1): The Linux kernel executes with full hardware privilege in a single shared address space. It validates the user’s permissions, talks to the physical I/O controllers, handles hardware interrupts, and copies the result back to the user-space buffer.
Monolithic (but modular) vs microkernel design
Section titled “Monolithic (but modular) vs microkernel design”In the 1992 debate between Andrew Tanenbaum (creator of the MINIX microkernel) and Linus Torvalds, Tanenbaum argued that monolithic kernels were obsolete compared to microkernels.4 Understanding the difference clarifies why Linux dominates gateways while other kernels appear in safety-critical automotive domains:
- Microkernels (e.g., QNX Neutrino, seL4, MINIX 3): Only the bare minimum (thread scheduling, low-level interrupt dispatch, and Inter-Process Communication, IPC) runs in privileged kernel mode. Device drivers, file systems, and networking stacks run as separate, isolated user-space server processes. If a network driver crashes, the microkernel restarts that user-space server without bringing down the system. The trade-off is IPC overhead: every read or write across subsystems requires context switches and message passing between separate address spaces. (Note: macOS XNU and Windows NT are hybrid kernels that keep drivers and networking inside the kernel address space for performance, not pure microkernels).
- Monolithic but modular (Linux): In Linux, the scheduler, memory manager, virtual file system, network stack, and all device drivers share one privileged address space and call each other directly via C function pointers with zero IPC message-passing overhead. That direct call path is why a monolithic kernel achieves such high I/O and networking throughput, not because its codebase is small (the Linux kernel source tree is about 40 million lines).
Most of that source is drivers and architecture code that a given board never uses. The kernel configuration (Kconfig) selects what is compiled at all, and for each driver whether it is built into the kernel image or built as a Loadable Kernel Module (LKM, a .ko file). When you plug a USB-to-CAN adapter into a Raspberry Pi or enable an I²C real-time clock in a Devicetree overlay, systemd-udevd loads only the required .ko driver module into kernel space at runtime, and can unload it (rmmod / modprobe -r) when no longer needed. We will write and load our own custom Linux kernel modules in Chapter 10.
Criteria for choosing an embedded Linux distribution
Section titled “Criteria for choosing an embedded Linux distribution”When selecting a Linux distribution for a connected gateway, an engineer evaluates five practical criteria:
- Stability and long-term security support: Gateways deployed in buildings or factories must run unattended for 5 to 10 years and receive timely CVE security patches. The EU Cyber Resilience Act makes this a legal obligation for products sold in Europe: its vulnerability-reporting duties have applied since 11 September 2026 and the remaining obligations apply from 11 December 2027 (Chapter 19).5
- Package management and toolchain maturity: During development, can you install pre-compiled C/C++ libraries (
libgpiod-dev,libpaho-mqtt-dev,qt6-base-dev), debuggers (gdbserver), and brokers (mosquitto) in seconds, with matching cross-compilers available on your host PC? - Memory and storage footprint: A headless gateway should not waste
600 MBof RAM and4 GBof flash running a desktop window manager (Wayland/X11), office suites, or background GUI indexing daemons. - Hardware and vendor kernel support: Does the distribution ship with tested kernel drivers and Devicetree overlays for your board’s exact SoC, Wi-Fi chipset, and I/O southbridge?
- Reproducibility and field-update friendliness: For commercial fleet deployment, can you lock down exact software versions, generate a Software Bill of Materials (SBOM), and ship atomic read-only image updates?
Binary distributions vs source-built custom distributions
Section titled “Binary distributions vs source-built custom distributions”Embedded Linux distributions fall into two broad camps: binary package distributions (where you install a pre-built OS image and add .deb or .rpm packages with a package manager) and custom image build systems (where you compile an entire bespoke root file system and kernel from source on a workstation).
Table 2.4. Comparison of embedded Linux distribution approaches for gateway development and production.
| Distribution / Build System | Package Format & Architecture | Typical RootFS Size | Strengths | Limitations & Ideal Use Case |
|---|---|---|---|---|
| Raspberry Pi OS Lite (64-bit) (Debian 13 Trixie; Bookworm is the Legacy release)6 | Binary .deb packages via apt / dpkg (arm64 / aarch64) | ~1.8–2.5 GB (~180 MB RAM idle) | Official Raspberry Pi Ltd support; 60,000+ Debian packages; 6.18 LTS vendor kernel and EEPROM tools; stable. | General-purpose mutable rootfs by default (requires hardening for production). Our standard OS for EEN1071. |
| Ubuntu Server / Ubuntu Core | .deb (apt) on Server; transactional Snaps on Ubuntu Core | ~2.5 GB (Server); ~400 MB (Core) | Ubuntu Core uses a strictly read-only, transactional squashfs rootfs with atomic rollback and containerised Snaps; Ubuntu Core 26 has 10 years of support.7 | Higher RAM/CPU overhead from snapd confinement; slower boot time than minimal Debian. |
| DietPi / Alpine Linux | Minimal Debian (.deb) or apk (musl libc + BusyBox) | ~130–600 MB (~40–90 MB RAM idle) | Very small RAM and flash footprint; Alpine can run entirely from RAM (diskless mode), eliminating SD card wear.8 | Alpine uses musl instead of glibc, which can break pre-compiled proprietary C++ binaries or SDKs. |
| Buildroot | Source-compiled firmware image generator (Kconfig / Makefile based) | 5 MB – 60 MB (< 25 MB RAM idle) | Builds a complete read-only squashfs rootfs, kernel and bootloader, with a first build that takes tens of minutes; images can boot in a few seconds; the easier of the two build systems to learn. | No runtime package manager (apt does not exist on the target); updating a library requires rebuilding and reflashing the image. |
| The Yocto Project / OpenEmbedded | Industrial recipe-based (BitBake) custom distribution builder | 20 MB – 500 MB (tailored to exact spec) | Industry standard for commercial embedded products (Kunbus, TI, NXP, Qualcomm); generates custom SDKs, licence manifests, and SPDX SBOMs (by default since release 5.2). | Steep learning curve; requires 100 GB+ of host disk space and hours of compile time for the initial build. |
Why we use Raspberry Pi OS (64-bit) in this book
Section titled “Why we use Raspberry Pi OS (64-bit) in this book”(Note: If you read older documentation or my 2016 book,9 Raspberry Pi OS was called Raspbian, named after Debian, which itself was named by its founder Ian Murdock after his then-girlfriend Debra Lynn and Ian!10 The distribution was renamed Raspberry Pi OS in May 2020, when the first 64-bit beta appeared.11 The 64-bit arm64 image was released as a supported version in February 2022).12
For learning connected embedded systems and building research or pre-production prototypes, 64-bit Raspberry Pi OS (Debian 13 Trixie) is the practical choice:
- It ships with the Linux 6.18 LTS kernel.6 The
PREEMPT_RTreal-time support was merged into mainline Linux in kernel6.12in late 2024,13 so this kernel includes it (Chapter 12). - It uses Raspberry Pi OS Lite (the headless server image without the
labwcWayland desktop compositor) when you want a lean gateway, or the full Desktop image if you want to develop directly on the board or display a local Qt 6 dashboard (Chapter 14). - You get immediate
aptaccess to every tool in the Debianarm64archive without waiting three hours for a Yocto BitBake build to finish.
When a commercial product outgrows Debian: Buildroot and Yocto
Section titled “When a commercial product outgrows Debian: Buildroot and Yocto”Once your prototype works on Raspberry Pi OS and your company prepares to manufacture 10,000 gateways on a custom Compute Module 5 or TI Sitara carrier board, shipping a mutable 2.5 GB Debian installation with a compiler, manual pages, and hundreds of unused system binaries becomes a liability:
- Every unused package increases flash cost, widens the cybersecurity attack surface, and creates licensing compliance work.
- Under the GPLv2 licence of the Linux kernel and LGPL/GPL user-space libraries, commercial manufacturers who distribute a binary firmware image are legally required to provide the exact corresponding source code, build scripts, and licence notices for every open-source component inside the device.15
That is why commercial firmware teams transition from Debian to Buildroot or The Yocto Project (discussed further in Chapter 20 on fleet updates and Chapter 19 on regulatory compliance). Both tools compile your C++ application, the exact required libraries, the Devicetree, and the kernel from source into a minimal, read-only squashfs firmware image (20–80 MB) and help with the compliance work. Yocto generates an SPDX Software Bill of Materials (SBOM) by default.16 Buildroot’s make legal-info collects the licence texts and source archives, and third-party tools turn its package list into a CycloneDX SBOM.17
🧩 Knowledge Check
Section titled “🧩 Knowledge Check”Match the distribution or build system to its description
What makes a Linux system 'embedded'?
You plug a USB-to-CAN adapter into a Raspberry Pi. How does Linux add the driver for it?
A company moves its prototype from Raspberry Pi OS to a product on a Compute Module 5. Which of the following are reasons to switch to Buildroot or Yocto?
Footnotes
Section titled “Footnotes”-
The Linux Kernel Documentation, Linux kernel licensing rules. Available: docs.kernel.org/process/license-rules.html. ↩
-
Raspberry Pi Ltd, Processors: BCM2711 and BCM2712, Raspberry Pi Documentation. Available: raspberrypi.com/documentation/computers/processors.html. ↩
-
Arm Ltd, Learn the Architecture: AArch64 Exception Model, Dec. 2022. Available: documentation-service.arm.com. ↩
-
“Appendix A: The Tanenbaum-Torvalds Debate,” in Open Sources: Voices from the Open Source Revolution, O’Reilly, 1999. Available: oreilly.com/openbook/opensources/book/appa.html. ↩
-
European Parliament and Council of the European Union, Regulation (EU) 2024/2847 on horizontal cybersecurity requirements for products with digital elements (Cyber Resilience Act), Official Journal of the European Union, Nov. 2024; and European Commission, Cyber Resilience Act: Reporting obligations. Available: digital-strategy.ec.europa.eu/en/policies/cra-reporting. ↩
-
Raspberry Pi Ltd, Raspberry Pi OS downloads (Raspberry Pi OS Lite 64-bit: Debian 13 (trixie), kernel 6.18; Legacy: Debian 12 (bookworm), kernel 6.12; release of 6 Oct. 2026). Available: raspberrypi.com/software/operating-systems. ↩ ↩2
-
Canonical, Ubuntu Core support duration, Ubuntu Core documentation; and Canonical, “Canonical launches Ubuntu Core 26,” May 2026. Available: documentation.ubuntu.com/core/reference/support-duration. ↩
-
Alpine Linux, Diskless Mode, Alpine Linux Wiki. Available: wiki.alpinelinux.org/wiki/Diskless_Mode. ↩
-
D. Molloy, Exploring Raspberry Pi: Interfacing to the Real World with Embedded Linux. Indianapolis, IN, USA: Wiley, 2016, ISBN 978-1-119-18868-1. ↩
-
Debian Project, “Chapter 1. Introduction: What is the Debian Project?,” in A Brief History of Debian. Available: debian.org/doc/manuals/project-history/intro.en.html. ↩
-
Raspberry Pi Ltd, “8GB Raspberry Pi 4 on sale now at $75,” Raspberry Pi News, May 2020. Available: raspberrypi.com/news/8gb-raspberry-pi-4-on-sale-now-at-75. ↩
-
G. Hollingworth, “Raspberry Pi OS (64-bit),” Raspberry Pi News, 2 Feb. 2022. Available: raspberrypi.com/news/raspberry-pi-os-64-bit. ↩
-
Kernel Newbies, Linux 6.12, released 17 Nov. 2024. Available: kernelnewbies.org/Linux_6.12. ↩
-
Raspberry Pi Ltd, “Manage software and firmware updates,” Raspberry Pi OS, Raspberry Pi Documentation. Available: raspberrypi.com/documentation/computers/os.html. ↩
-
Free Software Foundation, GNU General Public License, Version 2, June 1991, Section 3. Available: gnu.org/licenses/old-licenses/gpl-2.0.html. ↩
-
The Yocto Project, “Creating a Software Bill of Materials,” Yocto Project Development Tasks Manual. Available: docs.yoctoproject.org/dev-manual/sbom.html. ↩
-
Buildroot, The Buildroot User Manual, “Legal notice and licensing” and “Generating CycloneDX SBOM”. Available: buildroot.org/downloads/manual/manual.html. ↩
© 2026 Derek Molloy, Dublin City University. All rights reserved.