knaxuslearn · build · ship

Projects / Embedded Linux image

Buildroot · about 10 hours · 4 phases

Build your own Linux image with Buildroot

When we buy a router, a smart TV or a car dashboard, a small Linux system runs inside it. Nobody installed it with a wizard. Someone chose a kernel, picked a few programs, put them into one file and wrote that file onto the device. In about 10 hours we will do the same thing ourselves with Buildroot, a tool that builds a whole Linux system from source: a kernel, a root filesystem and a cross compiler, boiled down to a few megabytes. We boot it in QEMU, so you do not need any board, and we end with a system that is described by a handful of small files that you can rebuild from nothing.

You work in four phases of about 2.5 hours each. Every phase ends with something you can run and see. By the end you will have:

  • a Linux system that you built from source and booted in an emulator,
  • a clear map of what Buildroot downloads, builds and puts where,
  • your own files, settings, a login password and a start-up script inside the image,
  • your own program, packaged and installed like any other package,
  • a project folder with a small config file that rebuilds the same image from scratch.

You need to be comfortable with a Linux command line: cd, ls, nano or any editor. You do not need to know C. The one C program we use is short and we read it together.

The four phases

  1. Build and boot the stock image

    You end with a Linux system that you built yourself, booted in QEMU, with a login prompt.

    • 1.1 A build machine30 min
    • 1.2 Get Buildroot and look around15 min
    • 1.3 Choose a board20 min
    • 1.4 The first build50 min
    • 1.5 What came out15 min
    • 1.6 Boot it20 min
  2. Make it yours

    You end with an image with your own name, banner and password, your own files and a new tool, all repeatable with make.

    • 2.1 Where does a file come from?20 min
    • 2.2 A name and a banner30 min
    • 2.3 A password20 min
    • 2.4 Your own files40 min
    • 2.5 Add a package25 min
    • 2.6 Is the network up?15 min
  3. What is inside and how it starts

    You end with a clear picture of the boot, a start-up script of your own, and a kernel you changed.

    • 3.1 Read the boot log30 min
    • 3.2 Init and the start scripts25 min
    • 3.3 A start script of your own40 min
    • 3.4 BusyBox and the kernel35 min
    • 3.5 Measure what you built20 min
  4. Your own package and a repeatable build

    You end with a project folder that holds your overlay, your package and one config file, and a second build from that folder that boots the same system.

    • 4.1 An external tree25 min
    • 4.2 Your own package40 min
    • 4.3 Build it and run it15 min
    • 4.4 Save the whole config in one file25 min
    • 4.5 Put the last pieces in files25 min
    • 4.6 A second build, from the files only20 min

Start with the setup →