In this tutorial series, we will show you how to set up your own embedded Linux distribution for the Raspberry Pi 3B. We assume you’re new to embedded Linux and have no prior knowledge. By the end of this tutorial, you will have learned the major components in an embedded Linux distribution, how to integrate them together, and tips for arranging your build directory.
Where relevant, we’ll also include links to other resources where you can learn more. Although our distribution is targeted for the Raspberry Pi 3B, the general process is broad enough to be used on other boards as well.
We will use plain old Makefiles to explain the concepts. Once you’re familiar with them, feel free to explore popular build systems, such as Yocto or Buildroot, which are the industry standards nowadays. The skills you gain from this tutorial will help you learn these other build systems.
This tutorial is split into 3 parts:
- Toolchain Setup: If you build a ‘hello world’ program from your current laptop and try to execute it on the Raspberry Pi, it will not even start (give it a try!). This section explains why it won’t start and how to fix it. We’ll look at crosstool-ng and binutils.
- Board Support Packages: This is a fancy term that means “getting low-level software to run once the Raspberry Pi is plugged into a power source”. We’ll work with the Linux kernel, bootloader, drivers, device tree binary, and initramfs.
- Root filesystem: When you navigate to the root directory ($cd /), there’s a lot of files and directories. These are needed to get the Linux system fully working. We will create all these for the Raspberry Pi (it’s not as intimidating as it might sound). This section explores BusyBox, the File System Hierarchy, dropbear, and several other commonly used programs
If you’re following along, we strongly recommend you to get a serial console cable. This is an invaluable tool for debugging and interacting with the Raspberry Pi before your distribution is fully set up. You can get one from Adafruit: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview.
Let’s get started! (Part 2 coming soon)