home / docs / build pipeline

Build pipeline

From make.conf to a bootable filesystem.

The build pipeline is the machinery between your profile and a running system. It's intentionally thin — a few shell scripts that orchestrate Kama, not a build system monolith.

The stages

Stage 0 — bootstrap the toolchain

build-root.sh boots a toolchain from nothing: binutils, gcc, your chosen libc, then the toolchain package. This is the "fully from scratch" step — the stage that separates a source distro from one that seeds binaries.

Stage 1 — base system

The BASE_PACKAGES set from your profile is built and installed into $ROOT. Every package compiles against the stage-0 toolchain.

Stage 2 — the swappables

Exactly what you chose: the kernel ($KERNEL), the init system ($INIT), your privilege-elevation tool ($SUDO), and your network tools ($NET). Nothing preselected — the picks in your make.conf are the picks that get built.

Stage 3 — finalize the root

mkfs-root.sh formats and assembles the target as your chosen filesystem, producing the rootfs that will boot.

$ sh scripts/build-root.sh
[ keru ] building Keru rootfs into /tmp/keru/root
[ keru ] profile: init=runit libc=glibc fs=ext4 kernel=linux sudo=doas
[ keru ] stage 0: bootstrap toolchain (gcc binutils glibc)
[ keru ] stage 1: base system
[ keru ] stage 2: kernel + init + sudo + net
[ keru ] stage 3: finalize ext4 root
[ keru ] rootfs ready: /tmp/keru/root

The scripts

ScriptJob
scripts/common.shShared helpers; knows the sibling-repo layout (KAMA_DIR, PKGS_DIR).
scripts/build-root.shThe orchestrator — runs the four stages above.
scripts/mkfs-root.shFormats the target root as the chosen filesystem.

Convenience entrypoints

make rootfs # sh scripts/build-root.sh make install # sh installer/install.sh make live-init # syntax-check live/init make recipe-check # sh -n every recipe in kama-packages
The pipeline is the honest core of "from scratch": no binary base image, no opaque build tool — a shell script reading a profile and driving a shell package manager.

mkfs-root reference · How the repos fit · ← Docs