Skip to content
You Start with one site
Amounts in Start with one site
Engineering · Embedded Systems & Electronics

Embedded Linux with RPi

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.

Found this useful?
The system of the last lesson. Three sensor nodes, an ESP32 with a BME280, a Pico W with a light sensor and an STM32 with an ESP-01, send their readings over Wi-Fi with MQTT to the Mosquitto broker on the Raspberry Pi Zero 2 W. From the broker the readings go to the SQLite database, the Flask dashboard, the camera trigger and the cloud bridge.

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
  1. 1Start from a faultThe sensor is wired and nothing happens. Four checks find why.
  2. 2See how Linux does itDevice files, drivers, the boot chain, the kernel options.
  3. 3Build it on your PCCross-compile, configure and make the image, then write the card.
  4. 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
  1. Cross-compile programs and a kernel, and trace a boot from the GPU firmware to init
  2. Describe hardware in a device tree, and reach it from a program or a kernel module
  3. 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.

Lessons
Lesson 1 · 15 minCross-Compilation and Boot ProcessCompile on your PC for the ARM board, prepare the card stage by stage, and see your program run at first boot.Cross-compilerBoot stagesSerial consoleRoot filesystem Lesson 2 · 16 minKernel Configuration and BuildKeep only the drivers your board needs, and reach the shell in under 4 seconds.KconfigmenuconfigBuilt-in or moduleBoot time Lesson 3 · 14 minDevice Trees and HardwareTell the kernel a BME280 is on the I2C bus, and read it from plain files with no driver code.DTS syntaxOverlaysdtcIIO Lesson 4 · 10 minUserspace GPIO, I2C, SPIA doorbell monitor: a button event switches an LED and logs a reading, with no kernel code.libgpiodi2c-devspidevEvents Lesson 5 · 10 minKernel Module DevelopmentA driver loaded into the running kernel: write a pattern to /dev/mydevice and three LEDs blink it.Character devicesysfsprocfsioctl Lesson 6 · 11 minBuildroot Custom LinuxAn image with under 32 MB of files that boots straight into your sensor program.BuildrootCustom packageOverlaysRead-only root Lesson 7 · 14 minSystem Services and ProcessesA sensor daemon that starts at boot, is started again after a crash or a hang, and answers over a socket.systemdWatchdogjournaldIPC Lesson 8 · 16 minYocto Production ImagesAn image any PC can build again, with an SDK for your team and two root slots for safe updates.BitBakeLayersRecipesA/B updates Lesson 9 · 20 minEdge Gateway for MCU NetworksA gateway that records every node on the site, shows a local page, and forwards a copy when the link is up.MosquittoSQLiteFlaskMQTT bridge
More about this course

Every number has a reason

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
The full course notes

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:

  1. The System Problem A real embedded Linux challenge. Not “install Raspbian” but “build a minimal Linux that boots to your application in 4 seconds.”

  2. Linux Internals How the relevant subsystem works: boot sequence, device model, virtual filesystem, kernel build system.

  3. Build and Configure Cross-compile on your PC, configure with menuconfig or devicetree, and deploy to the Pi Zero 2 W.

  4. Deploy and Test Flash the SD card, boot, connect via serial console, and verify the system behaves as designed.

  5. 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.

PartQuantityFirst UsedApproximate Cost
Raspberry Pi Zero 2 W1Lesson 1$15
MicroSD card (16GB+)1Lesson 1$5
USB-serial adapter (FTDI or CP2102)1Lesson 1$2-4
Micro USB OTG cable1Lesson 1$1
BME280 sensor module1Lesson 3Reuse
Push button + LED + resistorsFewLesson 4Reuse
USB webcam (any UVC-compatible)1Lesson 9~5 USD (optional)

Total estimated cost: 23 to 30 USD (if you have components from prior courses)

Skill Progression

SkillLessons 1-2Lessons 3-4Lessons 5-6Lessons 7-9
SystemCross-toolchain, boot sequence, kernel buildDevice trees, userspace driversKernel modules, Buildrootsystemd, Yocto, edge gateway
Linuxmenuconfig, initramfsDTS overlays, /dev nodesModule Makefile, sysfs, chardevUnit files, BitBake, MQTT/SQLite
HardwareSerial console, SD card bootI2C/SPI from userspaceGPIO from kernel spaceFull system + USB camera
ProductionFast bootCustom hardware supportMinimal root filesystemReproducible 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
  • Our Embedded Programming: ATmega328P or another embedded course

Helpful but not required:

  • Kernel/OS concepts (processes, virtual memory, filesystems)
  • Git version control
  • Python (for build system scripting)

Getting Started

  1. Get a Raspberry Pi Zero 2 W, a microSD card, and a USB-serial adapter (CP2102 or FTDI). Total cost: about $22.

  2. 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+).

  3. 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.

  4. 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.

  5. Work through lessons in order. Each lesson builds on the system configuration from previous lessons.

© 2021-2026 SiliconWit®. All rights reserved.

9 lessons, in order.

SiliconWit makes these courses. We also run siliconwit.io, a monitoring service.