411 REFERENCE · Wikibooks
Embedded Systems/Linux
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Linux on embedded systems Embedded Linux systems can range from consumer electronics like smartphones and smart TVs to industrial machinery, medical devices, automotive systems, communication equipment and more. Linux brings the power, flexibility, and stability to these resource-constrained devices.
Core components of an Linux on embedded systems are boot loader, custom Linux kernel and root file system. Source code is compiled by Cross_compiler#GCC_and_cross_compilation GCC cross compiler.
Common boot loader is Das U-Boot – the Universal Boot Loader.
Root FS usually is based on BusyBox – software suite that provides many Unix utilities in a single executable file.
Local debugging often is limited, so gdbserver can be used.
Basic embedded Linux system can be compiled manually from modules above. There are tools for complete system generation from old and simple Buildroot to huge Yocto Project, which creates customized embedded Linux distributions. PC distributions Debian, Ubuntu ant others have build for ARM architecture ARM processors.
Raspberry Pi, BeagleBoard and Nvidia Jetson are examples of popular single-board computers supporting embedded Linux.
Unlike regular desktop or server distributions of Linux these versions of Linux usually have much fewer libraries and application, firmware is smaller and typically boot from flash memory or SD card.
Projects
Build frameworks and environments
Wear OS – Android for smartwatches and other wearables.
Android_(operating_system)#AOSP AOSP – Android Open Source Project
Buildroot – old simple patch and make based build environment
Yocto Project and OpenEmbedded – a BitBake based build framework and environment
BitBake – make-like build tool
OpenWrt – open wireless router
Embeddable Linux Kernel Subset – for ancient 16-bit x86 machines and emulators
Components
The Linux Kernel
"init" implementations: OpenRC, runit
GUIs: LXQt, LXDE, Xfce, FLTK
coreboot – lightweight BIOS
C standard library variants
General purpose GNU C Library glibc, 7.9 MB
uClibc, 560 KB
musl, 527 KB
dietlibc, 185 KB
Newlib
klibc – primarily for booting Linux systems
Bionic (software) Bionic – originally developed by Google for the Android embedded system operating system
Further reading:
Comparison of C/POSIX standard library implementations for Linux
Choosing System C library
Distributions
Distributions for ARM architecture ARM processors:
Arch Linux ARM – port of Arch Linux for ARM architecture ARM processors
Armbian – Debian and Ubuntu_(operating_system) Ubuntu based
RedSleeve – port of Red Hat Enterprise Linux
emteria.OS – proprietary Android (operating system) Android based
Lightweight cloud oriented systems:
Alpine Linux – uses musl, BusyBox and OpenRC.
Fedora_Linux#CoreOS Fedora CoreOS
RHCOS – Red Hat Enterprise Linux CoreOS for OpenShift Container Platform
https://MicroShift.io/ – lightweight Kubernetes distribution designed for edge and IoT computing environments
Lightweight multi-platform distributions:
Gentoo Linux
Tiny Core Linux
Kali Linux
Lubuntu
Slackware
Void Linux
Xubuntu
Common multi-platform distributions:
Debian
Fedora (operating system) Fedora
openSUSE
Ubuntu_(operating_system) Ubuntu
Features of Linux kernel for embedded systems
I/O and buses:
GPIO
drivers/gpio, tools/gpio, General Purpose Input/Output driver-api/gpio
SPI
drivers/spi, tools/spi, Serial Peripheral Interface spi
I2C
⚲ UAPI: Instantiate I2C devices from user-space i2c/instantiating-devices.html?#method-4-instantiate-from-user-space
drivers/i2c, https://i2c.wiki.kernel.org
I2C/SMBus Subsystem i2c
drivers/net/can – CAN bus Controller Area Network bus
drivers/mfd – Multi-Function Devices
drivers/usb/gadget – peripheral USB device implementation
drivers/iio – Industrial I/O
drivers/pwm – Pulse-width modulation
drivers/regulator – Generic Voltage and Current Regulator support
drivers/fpga
drivers/slimbus
SLOB – Simple List Of Blocks memory allocator
Devicetree – describes hardware components for the kernel
Multimedia
Audio
ASoC – ALSA System on Chip
snd_soc_card
ASoC – ALSA SoC Layer sound/soc
https://www.alsa-project.org/wiki/ASoC
TFT (LCD) – Thin-film-transistor liquid-crystal display
fbtft_display
File systems and storage
UBIFS – Unsorted Block Image FS
SquashFS – a compressed read-only FS with low Overhead (computing) overhead
drivers/mtd – Memory Technology Device block device
More: YAFFS, JFFS2
MMU less
Linux was originally designed on a processor with a memory management unit (MMU).
Most embedded systems do not have a MMU, as we discussed earlier
(Embedded Systems/Memory) and are called microcontrollers.
Microcontrollers without a MMU are cheaper consumes less power.
Benefits of using a processor with a MMU:
can isolate running "untrusted" machine code from running "critical" code, so the "untrusted" code is guaranteed (in the absence of hardware failures) not to interfere with the "critical" code
makes it easier for the OS to present the illusion of virtual memory
can run "normal" Linux (could also run "μClinux", but what's the point?)
μClinux – "MicroController Linux" is a version of the Linux kernel that supports Altera NIOS, ARM, Freescale M68K (including DragonBall, ColdFire, PowerQUICC and others), Hitachi H8, MIPS, and Xilinx MicroBlaze processors.
Disabling parameter CONFIG_MMU enables nommu mode.
Real-time
People use a variety of methods to combine Real-time computing real-time tasks with Linux:
Run the real-time tasks on a dedicated microcontroller; communicate with a (non-real-time) PC that handles non-real-time tasks. This is pretty much your only choice if you need real-time response times below 1 microsecond.
Run the real-time tasks in a "underlying" dedicated real-time operating system; run Linux as a "nested operating system" inside one low-priority task on top of the real-time operating system. Some of these systems claim real-time response times below 500 microseconds.
use a Linux kernel designed to emphasize real-time tasks, and run the real-time tasks with a high priority (perhaps even as a kernel thread).
Examples of RT distributions:
Xenomai
RTAI
RTLinux
MontaVista#Linux MontaVista Linux
Red Hat Enterprise Linux for Real Time
Real-time Ubuntu
Several RT features provide real time capabilities:
RT preemption
RT scheduling
CPU partitioning and isolation
Dynticks (Tickless, nohz)
...
Further readings about Embedded Linux:
Embedded Linux Conference (ELC) @ EOSS 2023
https://elinux.org
Category:Embedded_Linux
Linux kernel interfaces
ARM support
arch/arm, ARM Architecture arch/arm
https://lwn.net/Kernel/Index/#Architectures-ARM
arch/arm64, ARM64 Architecture arch/arm64
architecture-specific initialization
Learning the vi Editor
Linux