Part IX. System
41_system is the largest phase of the build. It installs every port that needs no graphics and no toolkit: the services the machine boots into, networking, storage and file systems, the command line, cryptography, the audio and image codecs, fonts, and the science, radio and hardware libraries. Read this part to find where a non-graphical package is built, or to decide where a new one belongs.
The phase also builds KDOS’s own artwork and the first of KDOS’s own programs to be built as ports. Two of KDOS’s programs come earlier: kpkg and kinstall are built by hand in Part III, and kinstall is built again here as the kdos-installer package.
This introduction covers:
- the rule that decides which ports the phase installs;
- how the phase’s list is split into one file per shelf, the subject directory a port is filed under;
- the order file, which sorts ahead of every shelf, and what it costs a parallel build;
- which of the phase’s ports have a full page.
The package pages follow, one chapter per shelf, in the order ports/shelves lists the shelves. Within a chapter the ports appear in the order kpkgdepends builds them.
What belongs here
A port’s dependency closure is the port together with everything it depends on, directly or through other ports. A port is installed here when nothing in that closure is graphical:
- no Wayland and no Xlib (
libX11); - no Mesa and no libdrm;
- no cairo and no pango;
- no GStreamer, FFmpeg or PipeWire;
- no toolkit (GTK, Qt, wxWidgets, FLTK or Motif).
What the port is for does not matter. A terminal game, a text-mode browser or the data files of a graphical game is a 41_system port when its closure stays clear of that list, even though its shelf is an application shelf. That shelf’s other ports are then in Parts X to XII. The table of every phase and what puts a port in it is in Which phase lists a port.
The same rule explains a few chapters that look out of place in this part:
- The
x11chapter holds the X protocol headers and the XCB libraries, which draw nothing. Xlib itself,libX11, puts a port into42_graphics. - The
gpuchapter holds the Vulkan and SPIR-V headers, the shader compilers and the OpenCL loader. Mesa is in Part X. - The
gtkchapter holds GLib, GObject introspection and dconf. GTK is in Part XI.
The list, by shelf
The phase’s list of ports is the directory script/phases/41_system/packages.d/. It holds:
- one file per shelf, named after the shelf, such as
network.txt; src-system.txtandsrc-art.txt, for KDOS’s own programs fromsrc/system/andsrc/art/;00-order.txt, the order file described below.
The build reads the files in sorted order as one list. Which shelf file names a port decides the chapter it appears in; naming it in 00-order.txt also fixes when it installs (see Package lists). Almost every shelf of ports/shelves has a file here. Most of the chapters fall into these groups:
- The machine itself
-
base(the D-Bus daemon, the system logger,snooze, the s6 tools, procps),auth(PAM, polkit, elogind, turnstile, sudo, Kerberos, fingerprint readers),boot(Limine,efibootmgr, the firmware and microcode),diskandfilesystem(partitioning, LVM, RAID, LUKS, SMART, and the tools of every file system KDOS can create or read),containers(crun,conmon,netavark,passtand the other pieces podman runs on), andnetwork(NetworkManager,wpa_supplicant, ModemManager, nftables,chrony, the VPN clients). - Libraries the later phases link
-
base-libs,devlibs,formats,database,archiver,crypto,net-libsandi18n: the C and C++ utility libraries, XML, JSON and protobuf, the database engines and stores (SQLite itself is built earlier, in30_foundation), compression, GnuTLS, NSS and the smartcard stack, the networking libraries, and the Unicode, bidirectional-text and line-breaking libraries. - The command line
-
shells,cli,files,sysmon,editors,mail,chat,transfer,serversandnet-diag: terminal programs and daemons, fromtmuxandzshto Neovim, WeeChat, OpenSSH and the network diagnostics. - Codecs and media data
-
audio-io(ALSA and the PulseAudio client library; PipeWire itself is Part X’s),audio-codecs,audio-dsp,music-libs,video-libsandimage-libs, and thefontschapter, which carries FreeType and Fontconfig as well as the font packages. - Science and hardware
-
sci-libs,math,astronomy,bioscience,gis,eda,embedded,sdr-hw,sdr,hamradio,hardware,mobile,opticalandai: numerical libraries, cross toolchains for microcontrollers, radio drivers, and the device tools. - KDOS’s own
-
src-art(the theme generatorkdos-theme, the KDOS icon themes, the wallpapers, the boot splash and thekdos-bbdemo) andsrc-system(kdos-pack,kdos-boxinit, the two books,kdos-docandkdos-kfs, and the installer package,kdos-installer). Their chapters come last in the part, after every shelf.
The other chapters, such as toolchain, security, printing and the game shelves, hold the ports of their subject whose closure reaches no graphics.
The order file
00-order.txt sorts ahead of every shelf’s file, so the ports it names are resolved first, in the order it gives. A group of ports written there in a fixed order is a run. The file’s header says what it is for:
# 41_system: System
# ---------------------------------
# 00-order — runs whose order a comment pins
# ---------------------------------
#
# Everything with no graphics and no toolkit in its dependency closure:
# services, networking, storage, the command line, codecs, and the science and
# hardware libraries.
#
# The files in packages.d are read in sorted order as one list. Together they
# name every port the phase installs and nothing it does not;
# testing/phaseclosure.py fails when a dependency pulls a port in from outside
# them, or when a shelf file names a port an earlier phase installs.
#
# This file sorts first, so its runs install before any shelf file's ports, in
# the order written. A run is here because a comment pins its order; everything
# else is in the file of its shelf.
#
# Under `kdosbuild --port-jobs` this file is also the phase's serial prefix:
# its ports, and every port the resolved order puts among them, build and
# install one at a time, and no other port of the phase starts before the last
# of them is installed. A pair whose order matters only because both install
# the same path is pinned here too; kdosbuild names such a pair when a level's
# commit moves a path the serial order would not have.
#
# It is also the one file that may name a port an earlier phase installs: kpkg
# skips that port while its recipe hash is current and rebuilds it here, in this
# order, when the recipe has changed.
script/phases/41_system/packages.d/00-order.txt
A run belongs here only when a comment beside it can say why its order matters and depends = cannot express it. Two such cases:
- Two ports install the same path, and the build must always install them in the same order. The header names this one.
- One port takes paths from another through
replaces =, so it must install after that port. In the other order the second install is refused as a file conflict. Which phase lists a port describes this case.
This file is also the only place in the phase’s list that may name a port an earlier phase installed.
Finally, the file is the phase’s serial prefix: the part of the phase that a parallel build still runs one port at a time. kdosbuild --port-jobs normally builds the ports of a phase level by level, several at once. The ports this file names, and every port the resolved order places among them, build and install one at a time instead, and no other port of the phase starts until the last of them is installed. Every run written here therefore makes the build slower. A file that names no port, like the one above, leaves the prefix empty, and the whole phase is built level by level.
When a parallel build commits a level and kdosbuild sees a path move from one package to another in an order the one-at-a-time build would have refused, it names the pair and asks for it to be pinned here; see Building a package phase by level.
Which ports have full pages
Each port gets one of three kinds of page, described in The three tiers.
Tier A ports have a full page with a hand-written note beside the recipe. In this phase they are the parts of the system KDOS is built around that need no graphics:
- the D-Bus daemon,
sysklogd,snooze, polkit, elogind and turnstile; - Limine,
efibootmgrandlinux-firmware; - the file-system, disk-image and encryption tools:
e2fsprogs,dosfstools,mtools,erofs-utils,squashfs-tools,cpio,libisoburnandcryptsetup; crun, the OCI container runtime thatcontainers-commonconfigures podman to use;nftablesand NetworkManager;libinput;- every port of
src-artandsrc-system.
Tier B ports also have a full page, because something about them is unusual: a patch, a vendored bundle of dependencies, a build.sh longer than 30 lines, or 20 or more ports that depend on them. In this phase the last reason picks out the libraries much of the tree links, such as GLib, FreeType, Fontconfig, libpng, the audio codecs, libxcb, Boost and NumPy.
Every other port of the phase is shown on a compact card (Tier C).
See also
- The userland:
40_langto44_apps: the five phases in the whole journey - Every phase installs exactly its list: the closure check and re-lists
- The ports catalogue: every shelf and its ports
- Reading a package page: how the pages below are laid out
- Part X: the next phase