You end with a Linux system that you built yourself, booted in QEMU, with a login prompt.
Buildroot is a collection of Makefiles and settings. You choose what the system should contain. Buildroot downloads the source code, builds a cross compiler, builds everything with it, and packs the result into an image. A cross compiler is a compiler that runs on your machine and makes programs for the machine you are building for. We call your machine the host and the machine the system will run on the target.
You describe the system. Buildroot builds it. QEMU runs it.
Step 1.1: A build machine (about 30 minutes)
We use an Ubuntu container with the tools Buildroot needs, plus QEMU to run the result. Make a folder, save this as Dockerfile and build it:
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libncurses-dev wget cpio unzip rsync bc file git \
python3 perl ca-certificates xz-utils bzip2 patch gzip tar \
qemu-system-x86 qemu-system-arm \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash dev \
&& install -d -o dev -g dev /work
USER dev
WORKDIR /work
You are now at a dev@...:/work$ prompt inside the container. Everything we create lives in /work, which is a Docker volume, so it survives if the container stops. To come back later, run docker start -ai br.
Two details are on purpose. We create a normal user because some tools in the build refuse to run as root. And we install QEMU for both x86 and Arm, so the same page works on an Intel PC and on an Apple Silicon Mac.
Run uname -m once. It prints x86_64 or aarch64. That is the kind of machine you will build for, because it is the fastest to emulate on your hardware. Remember which one you got.
Step 1.2: Get Buildroot and look around (about 15 minutes)
cd /work
wget https://buildroot.org/downloads/buildroot-2025.02.14.tar.gz
tar xf buildroot-2025.02.14.tar.gz
cd buildroot-2025.02.14
ls
Look at four folders:
configs/ holds ready-made settings files called defconfigs, one per board.
package/ holds one folder per program Buildroot knows how to build.
board/ holds extra files for specific boards.
output/ does not exist yet. Everything the build makes goes there.
Count the packages and look at the defconfigs for QEMU:
ls package | wc -l
ls configs | grep qemu
You should see thousands of packages and a list of QEMU machines: x86, Arm, MIPS, RISC-V, PowerPC and more. QEMU can pretend to be many kinds of computer, and Buildroot has a starting point for most of them.
Step 1.3: Choose a board (about 20 minutes)
A defconfig is a short text file of settings. Pick the one that matches your uname -m:
# if uname -m printed x86_64
make qemu_x86_64_defconfig
# if uname -m printed aarch64
make qemu_aarch64_virt_defconfig
The command prints something like configuration written to .config. Buildroot expanded the short defconfig into a full .config file with every setting spelled out. Count how much it grew:
wc -l configs/qemu_*_defconfig | head -3
wc -l .config
The defconfig has a few dozen lines. .config has thousands, because it also lists every option you did not touch.
Now browse the settings. Run make menuconfig. It opens a text menu with arrow keys, Enter to go in, Esc twice to go back, and / to search. Look at three places and change nothing:
Target options. The architecture, such as x86_64 or AArch64.
Toolchain. The C library and the kernel headers the compiler uses.
Kernel. The Linux version and the config file it builds with.
Press Esc until it asks whether to save. Choose No. Everything the menu shows is a line in .config.
Step 1.4: The first build (about 50 minutes, mostly waiting)
make -j"$(nproc)"
Now wait. The first build takes somewhere between 30 and 90 minutes, depending on your cores. Watch the lines scroll by. Each one starts with a package name and a stage. You will see the pattern again and again:
(The version number is an example. Yours may differ.) Before the kernel and BusyBox appear, Buildroot builds its own tools and a compiler. That is the long part. Nothing is wrong when the screen sits on gcc-final for a while.
If the build stops with an error, read the last 20 lines. The first line that says error is the one that matters. A missing host tool is the usual cause, and the message names it. Add that package to the Dockerfile and rebuild the image, or install it with apt as root in a second container shell. Then run make again. It continues where it stopped.
Pitfall: do not close the terminal in the middle of a build, and do not run it a second time in another window. Run make once, in a terminal that stays open.
While you wait, read the next step.
Step 1.5: What came out (about 15 minutes)
When the prompt comes back with no error, look at what the build made:
ls output
ls -lh output/images
You should see a folder of images with at least three files:
a kernel image, called bzImage on x86_64 or Image on aarch64,
a root filesystem image, called rootfs.ext2 or rootfs.ext4,
a script called start-qemu.sh.
The kernel is the part of Linux that talks to the hardware. The root filesystem holds everything else: /bin, /etc, the programs. A small system is just those two files.
Now look at the other folders in output/:
ls output/build | headls output/host | headls output/target
Five places to know. Only target and images go into the system.
output/target looks like the root of a Linux system, but do not copy it to a real machine. It is a staging area. The permissions and device files are fixed up later, when the image is packed.
Step 1.6: Boot it (about 20 minutes)
./output/images/start-qemu.sh serial-only
The argument serial-only tells QEMU not to open a window. The console appears in your terminal instead. Lines from the kernel scroll past, then a line that starts with Welcome to Buildroot, then a login prompt:
buildroot login:
Type root and press Enter. The default image has no password. You land at a # prompt. Try these:
uname -a
cat /etc/os-release
ls /
ls -l /sbin/init
ps
free -m
Check what you see. uname -a shows the kernel version and your architecture. os-release says Buildroot 2025.02.14. ls -l /sbin/init is a link to busybox. ps shows only a handful of processes. free -m shows a few hundred megabytes of memory at most.
To leave, type poweroff. QEMU ends and you are back in the container. If the system hangs, press Ctrl-A, then X. That is QEMU's own exit key.
You have just booted a Linux system that you built from source.
Phase 1 done
You have a build machine, a Buildroot tree, a finished image and a booted system. You know that a small Linux system is a kernel plus a root filesystem, and that Buildroot makes both from a settings file. Next we make it ours.