172.2. kdos-splash-1.2
Boot splash drawn on the framebuffer — a fade from black, or Phosphor mode's CRT power-on
The build-state snapshot was taken from 1.2-1; this recipe is 1.2-2, so the size, time and contents below describe the earlier build.
| Version | 1.2, release 2 |
| Source tree | src/art/kdos-splash/ |
| Phase | 41_system (System), 956 of 1047 in build order |
| Licence | MIT AND OFL-1.1 |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 138.3 KiB in 4 files |
| Recipe | src/art/kdos-splash/kpkgbuild |
About
kdos-splash is the boot animation, drawn straight to /dev/fb0: the KDOS mark fading in from black, or with kdos.splash=phosphor on the kernel command line Phosphor mode’s CRT power-on, then the list of boot stages under a progress bar, until rcS hands the screen to the display manager. One process covers the whole boot. The initramfs starts it, it survives switch_root, and later stages reach it through the FIFO /dev/.kdos-splash. What it draws, the commands it takes and the three facts about the framebuffer that constrain it are in The splash.
The build compiles one C file and installs one font. build.sh compiles kdos-splash.c to a static binary and decompresses Terminus’ 16-pixel console font from terminus-font to /usr/share/kdos/splash.psf, the file the program loads its glyphs from. The image step script/phases/70_image/090_initramfs.sh copies both into the initramfs; when the binary is missing the build warns and the machine boots with no splash.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/src-art.txt:
Boot splash. Lives in src/art rather than ports/core because the source is ours, not an upstream tarball. Draws straight to /dev/fb0 from the initramfs — a fade from black, or Phosphor mode's CRT power-on — and keeps running until rcS hands the screen to the display manager.
Sources
None: the port builds from its own directory, /kdos/src/art/kdos-splash.
Dependencies
Depends on: terminus-font.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install kdos-splash'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/art/kdos-splash.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kdos-splash
SRC=$SRC_ROOT/kdos-splash-1.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
LIBS="$PORT_SRC/../../libs"
gcc $CFLAGS -O2 -Wall -static-pie -I"$LIBS/libkcolor" \
-o kdos-splash "$PORT_SRC/kdos-splash.c" -lm $LDFLAGS
install -Dm755 kdos-splash "$PKG/usr/bin/kdos-splash"
gzip -dc /usr/share/consolefonts/ter-v16n.psf.gz > splash.psf
install -Dm644 splash.psf "$PKG/usr/share/kdos/splash.psf"
install -d "$PKG/usr/share/licenses/$name/terminus-font"
cp -R /usr/share/licenses/terminus-font/. "$PKG/usr/share/licenses/$name/terminus-font/"
chmod -R u=rwX,go=rX "$PKG/usr/share/licenses/$name"
The switches, and why each is set:
-static-pie— Link a static, position-independent executable. The initramfs step copieskdos-splashwith a plaincp, without the shared libraries it gathers for its other programs, so the binary must need none.-I"$LIBS/libkcolor"— Findkcolor.hin the tree’s colour library. The splash takes only the header’s table of accent schemes, compiled in because no/etc/kdos/accentcan be read when the initramfs starts it; it links no code from libkcolor.-lm— The maths library, for thesinandpowthe animation’s curves are computed with.-O2,-Wall— The tree’s optimisation level, named again, and the usual warnings.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kdos-splash, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kdos-splash-1.2-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kdos-splash, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: genbackdrop.py, genbanner.py, genlogo.py, kdos-splash.c, penguin.h.
Contents
Installed programs: kdos-splash.
Installed directories: /usr/share/licenses/kdos-splash.
Notes
Two commands end the splash, and both return only once it has stopped drawing. While it draws, the splash holds the foreground virtual terminal (VT) in KD_GRAPHICS mode, so no console text lands on the picture.
quitputs the VT back in text mode with its cursor shown, for when a text prompt comes next: the initramfs’s rescue shell, or a single-user boot’ssulogin. The VT then redraws the boot messages it buffered. Thequitclient does the same even after the splash has gone, but only on a VT inVT_AUTOmode, so a splash killed before it finished does not leave the rescue shell or getty drawing nothing.handoff, whichrcSsends on every other boot, runs no power-off animation. It draws the settled frame once more and leaves it on the framebuffer, with tty1 in graphics mode, so that frame stays up until the greeter’s compositor sets its first display mode, and KSplash’s bar carries on from it.kdos-gettyputs the VT back into text mode when it has to show a prompt there instead.
After handoff the splash holds the frame until a compositor has drawn over it, then blanks the framebuffer and exits. The blank matters: a compositor that lets go of the display later, at a login or a logout, uncovers whatever fbdev’s buffer holds, and that must be black, not a stale boot picture. It has to land before that hand-back, since the kernel shows fbdev’s buffer again in the instant the compositor drops DRM master. The hold works like this:
- The splash pans the framebuffer every 100 ms. A pan refused with
EBUSYmeans a DRM master holds the device, which after the hand-off can only be a compositor. - On the first
EBUSYit opens the DRM card (dri/card0todri/card3, the first with a lit CRTC), asksDROP_MASTERso that a strayEBUSYleaves no master behind, and records the framebuffer each lit CRTC scans out. - When a CRTC scans out a different framebuffer, the compositor’s first frame is on the display: the splash zeroes the framebuffer unseen and exits.
It does not blank on the first EBUSY: that comes before the compositor’s first mode set, and fbdev’s deferred-I/O flush writes into the buffer still on the display whoever is master, so a blank then would show black for the rest of the compositor’s start. On virtio-gpu the greeter’s KWin draws its first frame about 0.6 to 0.7 s after the first EBUSY (a live session’s about 1.0 to 1.1 s), and the greeter’s picture appears 2.6 to 3.4 s after it.
The other ways the hold ends:
| Reason in the log | When | Blanks? |
|---|---|---|
margin |
5 s past the first EBUSY with no new frame seen — always the way out where no card or lit CRTC could be read; it ends 1.6 to 2.4 s after the greeter appears |
yes |
text |
tty1 returns to text mode — before any EBUSY (kdos-getty’s prompt), or after one (a login typed inside the margin, blanked a frame after fbdev’s buffer is back) |
only after an EBUSY |
fb-gone |
FBIOGET_VSCREENINFO fails: a native GPU driver replaced the firmware framebuffer, and its mode set has replaced the frame |
no |
timeout |
60 s, whatever it has seen | yes |
signal |
the process is told to stop | yes |
tty1 entering VT_PROCESS mode is logged and ends nothing. The greeter’s session start hangs tty1 up, the descriptor opened in the initramfs then answers EIO, and the splash reopens tty1 through a descriptor on the devtmpfs /dev it opened before switch_root.
Every way out writes one line to the kernel log (dmesg | grep kdos-splash), kdos-splash: hold ended by <frame|margin|timeout|signal|fb-gone|text> after …, with the times of VT_PROCESS and the first EBUSY counted from the hand-off. The self-test drives the hold through a preloaded stand-in for /dev (testing/fixtures/splash-hold/shim.c).
A stage closed with skip reads SKIP in the tagline’s colour. The tagline is text, so it holds WCAG AA contrast, 4.5:1, on the ground in every scheme: it is the scheme’s pdark (KT_MID’s slot) where that reaches the floor, and otherwise pdark moved toward primary one percent at a time until it does (Amber and Ice, whose pdark is 3.56:1 and 4.42:1). The walk aims at 4.52 because the splash measures with the WCAG formula in floating point and libkcolor’s kcol_contrast, which the self-test judges with, rounds each channel through a table. The detail lines under a failed stage’s WHY: are in the scheme’s text colour.
A GPU driver loaded after switch_root (vmwgfx, i915, amdgpu and nouveau are modules the initramfs does not carry) replaces the firmware framebuffer under the running splash, and every call on the old fb0 descriptor then fails. The splash checks the descriptor once a frame, and when it has gone it opens fb0 again through its descriptor on the devtmpfs /dev until the driver’s framebuffer registers, lays the picture out for that size and draws on, so the boot is not black from the device manager to the greeter. The self-test replaces fb0 with a larger one under a running splash through the same stand-in for /dev.
The motion comes from the kernel command line because the power-on runs in the initramfs, before any root filesystem with a setting in it is mounted. KDOS_SPLASH_CMDLINE names a file read in its place, and kdos-splash preview takes the motion and then an accent as optional last arguments, so both motions and every scheme can be rendered and compared on a development host.
The line under the wordmark names the release: Kool Desktop Operating System 0.2, with +<BUILD_ID> on any build but a release one. It comes from a root’s /etc/kdos-release (its VERSION), or from /etc/os-release’s VERSION_ID and BUILD_ID when there is no record, so the splash, kdos version, the boot menu, the installer and the greeter give one form. The splash reads the initramfs’s copy when it starts, which script/phases/70_image/090_initramfs.sh takes from the image where script/phases/70_image/045_identity.sh wrote it. That copy is the release of the image that built the initramfs, and an installed machine keeps one initramfs across every update that is not a slot image, so the initramfs’s sp_root_release runs KDOS_SPLASH_ROOT=/newroot kdos-splash release before switch_root: the client reads the mounted root’s record and sends it as R<release>, and the running splash draws that instead. The running splash cannot read it itself, because after switch_root every path it opens is in the emptied initramfs. A root with neither file gives the name alone. A release too wide to share the name’s line within nine tenths of the screen takes its own line under the tagline, in the tagline’s colour, and the self-test holds that line to 4.5:1 too. KDOS_SPLASH_ROOT names a directory whose etc/ is read in place of /etc, and in preview KDOS_SPLASH_NEWROOT names the root whose release arrives at the sample boot’s switch_root.
KSplash’s copy of the picture (kdos-plasma-look) draws the name without the release, and keeps the rule two lines under the tagline. At the login the release leaves the name’s line, and when it had a line of its own the rule and the bar move up by two lines.
The same command line decides whether the splash runs at all: run without quiet exits at once, so the verbose and single-user entries show the boot’s text instead.
The progress bar gives the initramfs a fixed first share and rcS the rest. The splash finds the boundary from its own root: /init is there while the initramfs runs and gone once switch_root has emptied it, so the first total that arrives with /init missing is rcS’s. preview replays a whole boot through the same commands, its failed stage and the stages after it included, so one render shows the bar, the pinned failure and the reason panel together.
splash.psf is decompressed at build time because font_load() reads a bare PSF1 or PSF2 file: the static binary carries no decompressor. It falls back to /usr/share/consolefonts/ter-v16n.psf and then exits without drawing, which is what every failure path in the program does, so a missing font costs the splash and never the boot.
The three Python scripts beside the C file run on a development host, never in the build (genbanner.py needs Pillow, and genbackdrop.py Pillow and NumPy): genlogo.py writes the terminal banner fs/usr/share/kdos/logo.txt from penguin.h, genbanner.py restamps the two caption lines of the boot menu’s banner, fs/usr/share/kdos/boot/kdos-banner.png, and genbackdrop.py draws the menu’s backdrop, fs/usr/share/kdos/boot/kdos-backdrop.png, from that banner. Their output is committed, so changing the mascot or a caption means running the script and committing what it writes.