From b1fb59cc46c481ef4e042692a08377170ec1a3ea Mon Sep 17 00:00:00 2001 From: Xenolphthalein <21215869+Xenolphthalein@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:48:24 +0100 Subject: [PATCH] feat: build-tree.sh compiles through ccache when CCACHE_DIR is set, as overpressure/linux's check builds do; kernel.md describes the layers' checks --- docs/kernel.md | 8 +++++--- kernel/build-tree.sh | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/kernel.md b/docs/kernel.md index 7430cc3e..71fb31be 100644 --- a/docs/kernel.md +++ b/docs/kernel.md @@ -31,7 +31,7 @@ As shipped: | --- | --- | | [release.json](../kernel/release.json) | the pin: overpressure/linux's tag (`phoenix/7.2-1`), its commit, the build image it was built with, and the SHA-256 of `Image.gz`, the device tree, `config` and `version` | | [tooling/kernel.py](../tooling/kernel.py) | `kernel fetch` (the installer's step: the release's files into `out/kernel`), `kernel build` (the pinned commit built here in the release's build image, [below](#building-it-yourself)), `kernel check DIR`, `kernel contracts` ([below](#contracts)) | -| [build-tree.sh](../kernel/build-tree.sh) | a checkout of overpressure/linux's `phoenix/7.2` to `Image.gz`, the device tree, `config`, `version` and `build.json` (release, commit, banner, camera table, the tooling's commit, the build image, hashes); `uname -v` names the commit. That repository's CI builds each branch with it once, each tag twice on two machines, and releases a tag whose builds agree | +| [build-tree.sh](../kernel/build-tree.sh) | a checkout of overpressure/linux's `phoenix/7.2` to `Image.gz`, the device tree, `config`, `version` and `build.json` (release, commit, banner, camera table, the tooling's commit, the build image, hashes); `uname -v` names the commit. That repository's CI builds each change with it once, through ccache when `CCACHE_DIR` is set (its check builds), and each tag twice on two machines without it, and releases a tag whose builds agree | | [imx471_mode.py](../kernel/imx471_mode.py) | the RGB camera's register table, from the camera module in the stock vendor image: the file the driver loads | | [recovery_image.py](../kernel/recovery_image.py) | boot images with Valve's kernel ([A one-shot test boot](#a-one-shot-test-boot)) | @@ -237,8 +237,10 @@ Every change moves up the layers by pull request, merged with a merge commit; no `sm8650-7.2` branch through the [evlaV mirror](https://github.com/evlaV/deckard-linux-no-oopsies). Whenever a branch moves, the Layers workflow opens a pull request from it into the layer built on it (`valve/7.2` into `common/7.2`, then `common/7.2` into `sm8250/7.2`, then `sm8250/7.2` into `phoenix/7.2`); a pull request into a headset's branch is built -with its merge, and a conflict is resolved in the pull request. Rulesets let the layers change only by such pull -requests, with a passing build, and `valve/7.2` only move forward. A release is a tag `phoenix/7.2-N` that never moves; +with its merge, a pull request into a layer without a headset (`common/7.2`, `sm8250/7.2`) is built merged into +`phoenix/7.2`, and a conflict is resolved in the pull request. The Layers workflow starts its own pull requests' +builds. Rulesets let the layers change only by such pull requests whose `ci` check passed, and `valve/7.2` only move +forward ([the repository's README](https://github.com/overpressure/linux/tree/phoenix/7.2/.github)). A release is a tag `phoenix/7.2-N` that never moves; this repository pins one. ## Valve's Mesa diff --git a/kernel/build-tree.sh b/kernel/build-tree.sh index 16600b4b..a42817c3 100755 --- a/kernel/build-tree.sh +++ b/kernel/build-tree.sh @@ -20,7 +20,10 @@ # build's: the same commit and camera table give the same kernel on any host. # # Runs in the build container (python -m overpressure container run), cross compiling with -# aarch64-linux-gnu-gcc. Incremental: a second run rebuilds only what changed. +# aarch64-linux-gnu-gcc. Incremental: a second run rebuilds only what changed. With CCACHE_DIR set, the +# compiler runs through ccache (the build image's), which keeps compiled objects in that folder for the next +# build, also from another checkout: CI's check builds use it, a release builds without (its two builds are +# the test that the kernel is reproducible). ccache gives the objects the compiler would: the same kernel. set -euo pipefail DTB=sm8250-pico4-phoenix @@ -60,6 +63,18 @@ make=(make -C "$tree" O="$work/build" ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu # it: without the prefixes the same commit in another folder gives another kernel. KCFLAGS="-ffile-prefix-map=$tree/= -ffile-prefix-map=$work/=" KAFLAGS="-ffile-prefix-map=$tree/= -ffile-prefix-map=$work/=") +if [ -n "${CCACHE_DIR:-}" ]; then + if command -v ccache >/dev/null; then + make+=(CC="ccache aarch64-linux-gnu-gcc") + # A compiler of the same name but other contents is another compiler; 3 GB hold a kernel's objects. + export CCACHE_COMPILERCHECK=content CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-3G} + mkdir -p "$CCACHE_DIR" + ccache --zero-stats >/dev/null + else + echo "CCACHE_DIR is set, but this build image has no ccache: building without it" >&2 + unset CCACHE_DIR + fi +fi config=$work/build/.config mkdir -p "$work/build" # The configuration starts from Valve's each time, so a changed fragment never stacks. @@ -88,6 +103,7 @@ install -m 644 "$work/build/arch/arm64/boot/Image.gz" "$out/Image.gz" install -m 644 "$work/build/arch/arm64/boot/dts/qcom/$DTB.dtb" "$out/$DTB.dtb" install -m 644 "$config" "$out/config" "${make[@]}" -s kernelrelease > "$out/version" +[ -z "${CCACHE_DIR:-}" ] || ccache --show-stats | grep -iE 'hits|misses|cache size' >&2 || true sum() { sha256sum "$out/$1" | cut -d' ' -f1; } # The tooling's own commit; a worktree's repository is at OVERPRESSURE_GIT_DIR in the build