How it works
When you runmake, the build system:
- Downloads all required source archives from the internet (or a local mirror)
- Builds host-side tools needed to drive the rest of the build
- Builds a cross-compilation toolchain (GCC, musl/uClibc-ng, binutils) targeting your chosen hardware
- Cross-compiles the Linux kernel for the target
- Cross-compiles every selected package against the toolchain
- Assembles a root filesystem and produces flashable firmware images
make world target.
Build pipeline
tools
Host utilities required by later stages are compiled first (e.g.
quilt, cmake, ninja, swig). These are installed into staging_dir/host/.toolchain
The cross-compiler toolchain — binutils, GCC, and the C library (musl by default) — is built for the target architecture and installed into
staging_dir/toolchain-*/.target/linux
The Linux kernel is configured and compiled for the target platform. Kernel modules are built as part of this step.
packages
All selected packages are cross-compiled using the toolchain. Package
.ipk or .apk files are written to bin/packages/.Key directories
include/
Core build rules and Makefile fragments.
toplevel.mk bootstraps the entire build; package.mk defines how packages are built.scripts/
Helper scripts used during the build — feed management (
feeds), version detection (getver.sh), config diffing (diffconfig.sh), and more.package/
Package definitions. Each subdirectory contains a
Makefile that describes how to download, patch, compile, and install a package.target/
Platform-specific targets.
target/linux/ holds kernel configuration and patches for each supported architecture and board.toolchain/
Build rules for GCC, binutils, and the C library. These are built before any target packages.
feeds/
Symlinks to packages obtained from external feeds after running
./scripts/feeds install.The world target
make world is the top-level target that drives a complete firmware build. It depends on prepare, which in turn builds tools and the toolchain, followed by the kernel, packages, and final image assembly.
make without arguments also invokes world because it is the first real target declared in the top-level Makefile.
The build system enforces a strict dependency order. You cannot, for example, compile a package before the toolchain is ready. The stamp-file mechanism (
stamp-compile, stamp-install) tracks which stages have completed.