Thierry Laurion a2a027f661 circleci: implement hierarchical cache model with fork-specific caches
Implements a new cache-based pipeline that dramatically improves build times
through hierarchical caching with fork-specific caches.

Key changes:
- Add executor, commands, and job definitions for cache-based builds
- Add create_hashes job to generate cache digest files
- Add x86_blobs job for blob downloads with cache support
- Add x86_musl_cross_make job for toolchain builds with cache save
- Add x86_coreboot job per fork, each saves both modules and coreboot caches
- Add ppc64_musl_cross_make and ppc64_coreboot jobs (decoupled from single job)
- Add glossary documenting fan-in, workspace chain, cache layers

Fixes for cache invalidation issues:
- Remove .circleci/config.yml from cache key hashes (prevents cache invalidation
  on CI config changes - was causing full rebuilds on every pipeline)
- Fix musl-cross-make module to auto-detect existing crossgcc using wildcard check
- Exclude .circleci/config.yml from all_modules_and_patches.sha256sums and
  coreboot_musl-cross-make.sha256sums

Test results (multiple pipeline runs):

Pipeline 3789 (first run, cold cache):
- x86-musl-cross-make: 30 min
- ppc64-musl-cross-make: 16 min
- Result: Cache saved

Pipeline 3790 (second run, cache hit):
- x86-musl-cross-make: 4.5 min (6.6x faster than first run)
- ppc64-musl-cross-make: 4.5 min (3.5x faster than first run)
- Result: Beats baseline (14.5 min) by 3.2x

Pipeline 3791 (third run, cache hit):
- x86-musl-cross-make: ~6 min (27s Make Board + spin up variance)
- ppc64-musl-cross-make: 4.5 min
- Result: Still beats baseline

The wildcard fix for musl-cross-make module detects existing crossgcc from
cache and skips rebuild entirely (Make Board takes only 27s vs 26 min cold).

Add tests/circle-ci-simulation/ for local cache behavior verification:
- test_cache_hash.sh, test_musl_skip.sh, simulate_cold_cache.sh, etc.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2026-04-20 21:10:10 -04:00
2026-04-20 10:50:42 -04:00
2018-02-05 16:04:23 -05:00
2016-08-02 21:24:15 -04:00
2024-05-02 13:01:05 -04:00
2017-02-26 10:53:11 -05:00
2026-04-20 10:49:25 -04:00
2026-04-20 10:49:25 -04:00

Heads: the other side of TAILS

Heads booting on an x230

Heads is a configuration for laptops and servers that tries to bring more security to commodity hardware. Among its goals are:

  • Use free software on the boot path
  • Move the root of trust into hardware (or at least the ROM bootblock)
  • Measure and attest to the state of the firmware
  • Measure and verify all filesystems

Flashing Heads into the boot ROM

NOTE: It is a work in progress and not yet ready for non-technical users. If you're interested in contributing, please get in touch. Installation requires disassembly of your laptop or server, external SPI flash programmers, possible risk of destruction and significant frustration.

More information is available in the 33C3 presentation of building "Slightly more secure systems".

Documentation

The doc/ directory contains technical reference documentation for the Heads codebase. Start here:

Document What it covers
doc/architecture.md Component overview: coreboot, Linux payload, initrd, build system, configuration layers
doc/security-model.md Trust hierarchy, measured boot, TOTP/HOTP attestation, GPG boot signing, LUKS DUK, fail-closed design
doc/boot-process.md Step-by-step boot flow: /init → gui-init → kexec-select-boot → OS handoff
doc/tpm.md PCR assignments, sealing policies, SRTM chain, board-specific TPM variations, developer config reference
doc/ux-patterns.md GUI/UX conventions: whiptail wrappers, integrity report, error flows
doc/config.md Board and user configuration system
doc/docker.md Reproducible build workflow using Docker
doc/circleci.md CircleCI pipeline layout, workspace flow, and cache behavior
doc/qemu.md QEMU board targets for development and testing
doc/wp-notes.md Flash write-protection status per board
doc/BOARDS_AND_TESTERS.md Supported boards and their maintainers/testers
doc/prerequisites.md USB security dongles (HOTP/TPMTOTP), OS requirements, flashing methods
doc/faq.md Common questions: UEFI vs coreboot, TPM, LUKS, threat models
doc/keys.md All keys and secrets: TPM owner, GPG PINs, Disk Recovery Key, LUKS DUK
doc/development.md Commit conventions, coding standards, testing checklist
doc/build-freshness.md Debugging stale builds: initrd.cpio.xz composition, verification

For user-facing documentation and guides, see Heads-wiki.

Contributing

We welcome contributions to the Heads project! Before contributing, please read our Contributing Guidelines for information on how to get started, submit issues, and propose changes.

Building Heads

Heads builds inside a versioned Docker image. The supported and tested workflow uses the provided Docker wrappers — no host-side QEMU or swtpm installation is needed.

Quick start (requires Docker CE):

./docker_repro.sh make BOARD=x230-hotp-maximized
./docker_repro.sh make BOARD=qemu-coreboot-fbwhiptail-tpm2 run

No hardware required for testing — Docker provides the full build stack and QEMU runtime with software TPM (swtpm) and the bundled canokey-qemu virtual OpenPGP smartcard. Build and test entirely in software before flashing real hardware.

Build targets are the directory names under boards/. For the current set of tested and maintained targets, see doc/BOARDS_AND_TESTERS.md.

For full details — wrapper scripts, Nix local dev, reproducibility verification, and maintainer workflow — see doc/docker.md.

For CI cache/workspace behavior and the CircleCI job graph, see doc/circleci.md.

For QEMU board testing see doc/qemu.md.

For troubleshooting build issues see doc/faq.md and doc/build-freshness.md.

General notes on reproducible builds

In order to build reproducible firmware images, Heads builds a specific version of gcc and uses it to compile the Linux kernel and various tools that go into the initrd. Unfortunately this means the first step is a little slow since it will clone the musl-cross-make tree and build gcc...

Once that is done, the top level Makefile will handle most of the remaining details -- it downloads the various packages, verifies the hashes, applies Heads specific patches, configures and builds them with the cross compiler, and then copies the necessary parts into the initrd directory.

There are still dependencies on the build system's coreutils in /bin and /usr/bin/, but any problems should be detectable if you end up with a different hash than the official builds.

Key components

Heads builds a curated set of packages (from modules/). Key components enabled by most board configs include:

  • musl-cross-make — cross-compiler toolchain
  • coreboot — minimal firmware replacing vendor BIOS/UEFI
  • Linux — minimal kernel payload (no built-in initrd; boots with external initrd such as initrd.cpio.xz)
  • busybox — core utilities
  • kexec — Linux kernel executor (loads kernels from boot partition, USB, network)
  • tpmtotp — TPM-based TOTP/HOTP one-time password generator
  • cryptsetup — LUKS disk encryption

The full build also includes: lvm2, tpm2-tools, flashrom/flashprog, dropbear (SSH), fbwhiptail (GUI), qrencode, and many others. See individual modules/* files and board configs for the complete picture.

We also recommend installing Qubes OS, although there Heads can kexec into any Linux or multiboot kernel.

Notes

  • Building coreboot's cross compilers can take a while. Luckily this is only done once.
  • Builds are finally reproducible! The reproduciblebuilds tag tracks any regressions.
  • Current tested and maintained boards are tracked in doc/BOARDS_AND_TESTERS.md. Board targets themselves live under boards/.
  • Xen does not work in QEMU. Signing, HOTP, and TOTP do work; see below.
  • Blob requirements are board- or board-family-specific. Check the relevant documentation under blobs/ for the target you are building.
  • Purism boards use Purism-managed coreboot blob paths from the Purism fork (for example 3rdparty/purism-blobs/... via CONFIG_IFD_BIN_PATH and CONFIG_ME_BIN_PATH in config/coreboot-librem_*.config). Heads should not maintain those vendor blob payloads. Runtime firmware notes for Librem blob jail are in blobs/librem_jail/README.
  • Lenovo xx20 boards such as X220 and X230 use the shared xx20 blob flow documented in blobs/xx20/readme.md. X220-specific notes are in blobs/x220/readme.md.
  • Other boards can source blobs from board-family directories under blobs/ (for example xx20/xx30/xx80, t420, t440p, w541) or from fork-specific paths configured in coreboot configs (for example Dasharo boards using 3rdparty/dasharo-blobs/...). Vendor blob payloads remain maintained by their upstream vendors/forks.
  • T480 and T480s blob requirements are documented in blobs/xx80/README.md. Other families have their own docs under blobs/, for example t420/, t440p/, and w541/.

QEMU

OS booting can be tested in QEMU using a software TPM. HOTP can be tested by forwarding a USB token from the host to the guest.

For more information and setup instructions, refer to the qemu documentation.

coreboot console messages

The coreboot console messages are stored in the CBMEM region and can be read by the Linux payload with the cbmem --console | less command. There is lots of interesting data about the state of the system.

S
Description
No description provided
Readme 13 MiB
Languages
Makefile 84.5%
Shell 13.2%
Python 2.1%
Perl 0.2%