Build your own Linux for a 15 USD board, from the boot chain to a production image. Nine lessons on the Raspberry Pi Zero 2 W, ending with a gateway that keeps the record of a whole site.
A board with a ready-made image does not start, and nothing says which link of the boot failed. A sensor is wired and its driver is in the kernel, and nothing happens: no error, no reading. A program started by hand stops when the terminal closes, and after a crash at night in a pump house it stays dead until somebody travels there. A year later a customer reports a fault, and nobody can build that image again.
In this course you build every link yourself on a Raspberry Pi Zero 2 W: the cross-compiler, the kernel, the device tree, a driver, a minimal image, the services and a Yocto image you can build again. The last lesson joins them into a gateway that records the readings of ESP32, Pico and STM32 nodes, shows them on a local page, and keeps working when the internet link fails.
How each lesson goes
1Start from a faultThe sensor is wired and nothing happens. Four checks find why.
2See how Linux does itDevice files, drivers, the boot chain, the kernel options.
3Build it on your PCCross-compile, configure and make the image, then write the card.
4Make it ready for the fieldStart at boot, restart after a crash, a root that a power cut cannot damage.
You will be able to
Cross-compile programs and a kernel, and trace a boot from the GPU firmware to init
Describe hardware in a device tree, and reach it from a program or a kernel module
Build a minimal image and a Yocto image that start your services and can be updated safely
New to this? Know C and new to embedded Linux? Start with lesson 1: build every link of the boot by hand.
You need A Raspberry Pi Zero 2 W, about 15 USD, a microSD card of 16 GB or more and a USB-serial adapter. The BME280, LEDs and buttons come from the earlier courses.
The engineering behind it
A small Linux computer that gathers many devices, runs for years and survives power cuts.
A field device is not a desk computer. Each size and each time below comes from a board that nobody is near to repair.
Under 4 secondsfrom power-on to the shell with your own kernel; the stock kernel reaches init in 4 to 6 seconds, a stripped one in 1.5 to 2.5Boot
Under 32 MBof files in the Buildroot image: a kernel, BusyBox and your sensor reader, and no service you did not chooseImage
15 secondsthe watchdog limit: the daemon pings every 5 s, and a hung one is killed and started again 3 s laterServices
Two root slotsof 512 MB each: an update writes the slot that is not running, and a failed image goes back to the old oneUpdates
25 to 40 secondsfor Raspberry Pi OS to boot, with nothing recorded meanwhile; your image holds only your servicesGateway
The node keeps the limits. The gateway keeps the record.
On the node
Fast and safe
Starts in milliseconds, answers in microseconds
Every fast loop and safety limit in its own firmware
Stays safe with the gateway switched off
The test: is it still safe when the gateway is off?
On the gateway
Record and display
A database with months of readings
A local page and alerts for the site
A copy to a remote platform when the link is up
The test: does the site keep its record when the internet fails?
Why build your own Linux
Every byte on the cardYour kernel, your device tree, your root filesystem.
A 15 USD boardThe Raspberry Pi Zero 2 W, under 1 W at idle.
Buildroot and YoctoA minimal image first, then one for a product.
Made for the fieldRead-only root, watchdog, A/B updates with rollback.
Built again a year laterLayers locked to exact revisions, and a list of every license.
Cross-compiled on your PCUbuntu or Debian; WSL2 also works.
Honest limits. Linux can pause for milliseconds, so fast control and safety limits stay in the firmware of the nodes. The gateway records, displays and raises alerts for the site, and passes a copy to a remote record when the link is up.
Before you start
C, and the Linux command line
GPIO, I2C and UART on one microcontroller
A PC with Ubuntu or Debian (WSL2 works)
A Raspberry Pi Zero 2 W, a microSD card and a USB-serial adapter
Microcontrollers run one program. Embedded Linux runs an entire operating system on a chip smaller than a coin. The Raspberry Pi Zero 2 W costs about 15 USD and runs a full Linux kernel with Wi-Fi, USB, and enough processing power for computer vision, web servers, and database logging. This course teaches you to build, customize, and ship Linux-based embedded systems from the ground up. #EmbeddedLinux #RaspberryPi #LinuxKernel
Why Embedded Linux When We Already Have Microcontrollers?
The previous courses in this series (ATmega328P, STM32, ESP32, RPi Pico, RTOS) teach you to read sensors, drive actuators, and communicate over UART/SPI/I2C on bare metal. That is powerful, but there are entire categories of embedded products that microcontrollers simply cannot handle:
What Microcontrollers Cannot Do
Run a database to store months of sensor history. Serve a full web dashboard with authentication. Process camera images with OpenCV. Run Python or Node.js scripts. Connect to USB peripherals with standard drivers. Host an SSH server for remote maintenance. Support over-the-air updates with rollback. These all require an operating system.
What This Course Builds (That MCU Courses Cannot)
A systemd-managed sensor daemon that auto-starts, recovers from crashes, logs structured data to journald, and communicates over Unix sockets. A custom kernel stripped to boot in under 4 seconds. A production-grade Yocto image with A/B OTA updates, license compliance, and an SDK for your team. None of this is possible on a microcontroller.
The Industrial Reality
Industrial gateways, medical devices, smart cameras, point-of-sale terminals, and automotive infotainment all run embedded Linux. Companies hiring for these roles expect you to know kernel configuration, device trees, Buildroot, and Yocto. Bare-metal skills are the foundation; embedded Linux is where the higher-paying jobs are.
Not Raspbian with apt-get
This is not a “use Raspberry Pi OS” course. You will cross-compile your own kernel, write your own device tree overlays, develop a real kernel module (character device driver), build a minimal image with Buildroot, and produce a shippable Yocto image. You control every byte on the SD card.
Course Structure
Each lesson follows a consistent cycle:
The System Problem
A real embedded Linux challenge. Not “install Raspbian” but “build a minimal Linux that boots to your application in 4 seconds.”
Linux Internals
How the relevant subsystem works: boot sequence, device model, virtual filesystem, kernel build system.
Build and Configure
Cross-compile on your PC, configure with menuconfig or devicetree, and deploy to the Pi Zero 2 W.
Deploy and Test
Flash the SD card, boot, connect via serial console, and verify the system behaves as designed.
Production Considerations
What changes when this is not a hobby project: read-only root, watchdog, logging, update mechanisms.
Lessons
Lesson 1: Cross-Compilation and Boot Process
Cross-Compilation and Boot Process. Set up a cross-compilation toolchain, understand the Linux boot sequence (bootloader, kernel, initramfs, root filesystem), and cross-compile a custom binary. Build a “hello from custom Linux” that runs on first boot.
Build: Custom hello binary on first boot. Parts: RPi Zero 2 W, SD card, USB-serial adapter.
Lesson 2: Kernel Configuration and Custom Build
Kernel Configuration and Custom Build. Clone the kernel source, navigate menuconfig, enable and disable subsystems, and build a minimal kernel from scratch. Build a stripped-down kernel that boots in under 4 seconds.
Build: Fast-booting minimal kernel. Parts: No new parts.
Lesson 3: Device Trees and Hardware Description
Device Trees and Hardware Description. Learn DTS syntax, property bindings, and overlay mechanics. Enable custom I2C and SPI devices through device tree overlays without modifying the kernel. Write an overlay for a BME280 sensor.
Build: Custom device tree overlay for BME280. Parts: BME280 module (reuse from prior courses).
Lesson 4: Userspace I/O: GPIO, I2C, SPI
Userspace GPIO, I2C, SPI. Access hardware from userspace using libgpiod, i2c-dev, and spidev. Understand character devices, ioctl, and userspace driver patterns. Build a GPIO doorbell monitor with I2C sensor logging.
Build: GPIO doorbell monitor with sensor logging. Parts: Push button, LED, reuse BME280.
Lesson 5: Linux Kernel Module Development
Kernel Module Development. Write a loadable kernel module from scratch: module skeleton, Makefile, parameters, sysfs attributes, and a character device interface. Build a custom driver that controls LED patterns via /dev/mydevice.
Build: Custom character device driver for LED patterns. Parts: LEDs, resistors (reuse from prior courses).
Lesson 6: Buildroot: Custom Linux from Scratch
Buildroot: Custom Linux Image. Configure Buildroot to produce a minimal Linux image: select packages, add root filesystem overlays, create custom package recipes. Build a minimal image that boots directly to your sensor application.
Build: Minimal Linux image with baked-in sensor app. Parts: No new parts.
Lesson 7: System Services and Process Management
System Services and Process Management. Write systemd unit files, configure watchdog supervision, implement IPC (pipes, shared memory, Unix sockets), and set up real-time scheduling with PREEMPT_RT. Build a systemd-managed sensor daemon.
Build: systemd-managed sensor daemon with IPC. Parts: Reuse existing.
Lesson 8: Yocto Project and Production Images
Yocto Project and Production Images. Set up the Yocto build system with BitBake. Create custom layers, write recipes, generate an SDK, and produce a reproducible production image. Build an OTA-ready production image with your custom BSP layer.
Build: Production-grade Yocto image. Parts: No new parts.
Lesson 9: Edge Gateway for MCU Sensor Networks
Edge Gateway for MCU Sensor Networks. Combine everything from this course and the entire embedded series. Build an edge gateway that receives MQTT data from ESP32/Pico nodes, stores readings in SQLite, serves a live web dashboard, captures USB webcam snapshots, and forwards to the cloud. Does things MCUs cannot handle and does them more reliably than stock Raspberry Pi OS.
Build: Complete edge gateway with MQTT broker, database, dashboard, camera, OTA. Parts: USB webcam (optional).
Parts Kit
Minimal new hardware required. Most parts are reused from earlier courses.
Part
Quantity
First Used
Approximate Cost
Raspberry Pi Zero 2 W
1
Lesson 1
$15
MicroSD card (16GB+)
1
Lesson 1
$5
USB-serial adapter (FTDI or CP2102)
1
Lesson 1
$2-4
Micro USB OTG cable
1
Lesson 1
$1
BME280 sensor module
1
Lesson 3
Reuse
Push button + LED + resistors
Few
Lesson 4
Reuse
USB webcam (any UVC-compatible)
1
Lesson 9
~5 USD (optional)
Total estimated cost: 23 to 30 USD (if you have components from prior courses)
Skill Progression
Skill
Lessons 1-2
Lessons 3-4
Lessons 5-6
Lessons 7-9
System
Cross-toolchain, boot sequence, kernel build
Device trees, userspace drivers
Kernel modules, Buildroot
systemd, Yocto, edge gateway
Linux
menuconfig, initramfs
DTS overlays, /dev nodes
Module Makefile, sysfs, chardev
Unit files, BitBake, MQTT/SQLite
Hardware
Serial console, SD card boot
I2C/SPI from userspace
GPIO from kernel space
Full system + USB camera
Production
Fast boot
Custom hardware support
Minimal root filesystem
Reproducible images, OTA, deployment
Prerequisites
Embedded and Linux command-line experience required
You should be comfortable with:
C programming (pointers, structs, Makefiles)
Linux command line (shell, file permissions, package management, ssh)
Basic embedded concepts from at least one prior course
Get a Raspberry Pi Zero 2 W, a microSD card, and a USB-serial adapter (CP2102 or FTDI). Total cost: about $22.
Use a Linux PC for development. Cross-compilation and kernel building work best on a native Linux machine or VM. Ubuntu 22.04+ recommended. Lessons 6 and 8 (Buildroot, Yocto) require significant disk space (30GB+).
Connect via serial console, not HDMI. The serial adapter gives you boot messages, kernel logs, and a root shell. This is how embedded Linux development actually works.
Start with Lesson 1. Cross-compile a binary on your PC and run it on the Pi. This immediately establishes the embedded Linux development workflow.
Work through lessons in order. Each lesson builds on the system configuration from previous lessons.
Made by
Engineers and researchers who build what they teach.