Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

Typographical conventions

This chapter sets out how the book writes commands and their output, where each command is meant to run, how paths and placeholders are spelled, how listings taken from the tree are marked, and what a build time given in SBU means.

Commands and output

A command is set in a box of its own, with no prompt in front of it, so that it can be copied as it stands. This one, like every kpkg command outside System administration, runs in the chroot described below:

kpkg info pv

What a command prints, when the book shows it, is in a separate box directly after the command, so that output is never mistaken for something to type:

Package: pv
Version: 1.12.0-2
License: GPL-3.0-or-later
Files: 19

File names, commands, variables and switches in running text are set in a fixed-width face, as in build.sh, kpkg install or --disable-static. A term is set in bold where it is defined.

Where a command runs

Every command in this book runs in one of four places, and the sentence before the box always says which:

On your machine, the host, from the top of your clone of the repository. Nothing in this book asks you to run a command there as root. make fetch, make build and make book are typed here.

In the container, os-dev, which make build starts and which is described in the os-dev container. The repository is at /workspace inside it, and the container runs as its own root. The first two phases, 00_cross and 10_bootstrap, run here.

In the chroot: the root filesystem the build is assembling, build/fs, entered as / with script/chroot/exec.sh from inside the container. Every phase from 20_selfhost on runs here, and every kpkg command outside System administration means a kpkg running inside the chroot, as root, from the directory /kdos. Entering the chroot shows how to get there by hand.

On a KDOS machine, a system installed or booted from the finished image. Every command in System administration is typed there, and the page says which of them need root, usually by setting sudo in front.

The same file has a different path in each of the first three. The book writes a path the way the place running the command sees it, and this table translates between them:

On your machine In the container In the chroot
the top of the clone /workspace /kdos
ports/ /workspace/ports /ports, and again at /kdos/ports
build/ /workspace/build /kdos/build
build/fs /workspace/build/fs /
build/fs/var/lib/kpkg/db /workspace/build/fs/var/lib/kpkg/db /var/lib/kpkg/db

An absolute path such as /var/lib/kpkg/db or /usr/share/licenses always means a path inside the root being built, which is build/fs/... on your machine. A path with no leading slash, such as script/phases/41_system/phase.env, is relative to the top of the repository, and means the same file in all three places because each runs its commands from there.

Placeholders

A word in angle brackets is a placeholder for something you choose, and the brackets are not typed: <port> is the bare name of a port, such as pv; <phase> is a phase directory, such as 41_system; <shelf> is the shelf a port is filed on, such as cli. In

make build BUILD_ARGS="--phases <phase>,70_image --rebuild <port>"

you would type --phases 41_system,70_image --rebuild pv.

Listings read from the tree

Most of the commands in this book are not copied into it. They are read from the script or recipe that runs them each time the book is rendered, and set as a listing with a caption under it naming the file, and the line range when the listing is part of a file. The caption links to the file. A listing of a whole file leaves out its #! line and its banner, the comment block that draws the KDOS logo in box characters at the top of the tree’s scripts and recipes, and nothing else. A listing is always the text the build runs; the prose around it is what explains it.

A port is always named by its bare name, the name in its recipe’s name = line, never with its shelf: pv, not cli/pv. KDOS finds a port by that name wherever it is filed. A port named in running text links to its package page, as in pv or zlib.

A link into the KDOS book leads to the chapter that explains a mechanism. This book follows such a link with no more than a sentence of its own about the same subject. Where such a link lands depends on the copy you are reading:

Copy A link into the KDOS book opens A link to any other file of the tree opens
Rendered with a plain make book the page on GitHub the file on GitHub
Published on kdos.dev the KDOS book’s page on kdos.dev the file on GitHub
Installed on a KDOS machine, under /usr/share/doc/kfs the installed page under /usr/share/doc/kdos, so it works offline the file on GitHub, because the image carries no copy of the recipes, the phase lists or the sources

In each case a link to a heading of the KDOS book lands at that heading.

Notes

Three kinds of note are set in a box on a package page. One says that the build-state snapshot was taken from a different version of the port from the recipe shown, so that the size, the time and the contents on that page describe the earlier build. Another appears on the page of a package that is also built before kpkg exists, by a script of 00_cross or 10_bootstrap, and compares the switches the two builds use; see Reading a package page. The third appears on a full page whose port has no hand-written note to explain what makes it unusual; see The three tiers.

Sizes

A size is in binary units: 1 KiB is 1,024 bytes and 1 MiB is 1,024 KiB. A package’s installed size is the total of the regular files its database entry lists, as they are on disk in the built tree. A source’s download size is the size of the file in the source cache.

Build times and the SBU

Build times are given in SBUs, standard build units, the way the Linux From Scratch book gives them, because a time in seconds is only true of the machine that measured it. One SBU is the time the first step of the whole build took: the cross binutils, 00_cross/binutils. Every other figure is a step’s own time divided by that one, so a port shown as 2.5 SBU took two and a half times as long as the cross binutils did on the same machine.

The figures come from build/snapshots/timings.json, where kdosbuild records the seconds each step took when it did work, keyed by phase and step: 00_cross/binutils, 10_bootstrap/gcc, 41_system/pv; see Step timings. make book-data divides each by the SBU and writes the result into the snapshot. The snapshot’s stamp, docs/kfs/data/stamp, records how the figures were taken, one key per line:

Key What it records
commit, date The commit the checkout stood at when the snapshot was taken, and the date of the newest package in the built tree
packages How many packages that tree had installed
sbu-seconds How long one SBU was, in seconds
sbu-machine The machine that measured the SBU, as kdosbuild recorded it beside the figure; - when that figure names no machine
machine-<n> One machine a figure names: its processor, the CPUs the build could run on, its memory and the KDOS_JOBS it was given
machine-<n>-ports How many port figures that machine measured
unrecorded-ports How many figures name no machine at all
measured-phases, unmeasured-phases The package phases with at least one measured port, and those with none

The stamp of the snapshot this copy was rendered with, which Build times also shows:

# The built tree docs/kfs/data was taken from: written by make_data.py
commit 047d4b997
date 2026-11-23
packages 2446
sbu-seconds 43.41
sbu-machine 1
machine-1 AMD Ryzen 7 5700G with Radeon Graphics, 16 CPUs, 61.2 GiB, KDOS_JOBS unset
machine-1-ports 2446
unrecorded-ports 0
measured-phases 20_selfhost 30_foundation 31_compilers 40_lang 41_system 42_graphics 43_toolkits 44_apps 50_desktop 60_kernel
unmeasured-phases -

docs/kfs/data/stamp

Read an SBU figure as a proportion, not a promise. Four things move it:

A figure below 0.1 SBU is shown as 0.1. A package page with no build time on it has no measurement in the snapshot. Build times, in the appendices, lists every figure the snapshot holds, phase by phase.

See also