@@ -14,25 +14,23 @@ permissions:
1414# CACHING ARCHITECTURE
1515# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1616#
17- # Layer 1 โ ccache โ ccache-<os>-<ver>-<cfg>-<patches>-<run_id>
18- # โ โ Always saves a NEW key per run so
19- # โ โ restore-keys always finds the freshest
17+ # Layer 1 โ APT packages โ apt-kernel-build-v1
18+ # โ โ Saves ~30s of apt-get install per run
19+ #
20+ # Layer 2 โ ccache โ ccache-<os>-<ver>-<cfg>-<patches>-<run_id>
21+ # โ โ KEY BUG FIX: always save a NEW key per run
22+ # โ โ so restore-keys always finds the freshest
2023# โ โ partial cache, never a stale pinned key.
2124# โ โ SLOPPINESS + DIRECT mode = max hit rate.
2225#
23- # Layer 2 โ Source tarball โ kernel-tarball-<version>
26+ # Layer 3 โ Source tarball โ kernel-tarball-<version>
2427# โ โ Immutable. Downloaded once, cached forever.
2528#
26- # Layer 3 โ Full build tree โ kernel-tree-<ver>-<cfg>-<patches>
29+ # Layer 4 โ Full build tree โ kernel-tree-<ver>-<cfg>-<patches>
2730# โ โ Exact match = zero rebuild (incremental make).
2831# โ โ Partial match via restore-keys still helps.
2932# โ โ Saved unconditionally after every build.
3033#
31- # NOTE: APT package caching is intentionally omitted. actions/cache cannot
32- # reliably handle /var/cache/apt glob paths or /var/lib/apt/lists โ the key
33- # never matches on restore, producing "Cache not found" noise on every run
34- # with zero benefit. apt-get install is fast enough (~30s) on its own.
35- #
3634# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
3735
3836jobs :
@@ -136,10 +134,17 @@ jobs:
136134 echo "KBUILD_BUILD_TIMESTAMP=$(date -u -d "@$SOURCE_DATE_EPOCH" '+%a %b %e %H:%M:%S UTC %Y')" >> "$GITHUB_ENV"
137135 echo "KBUILD_BUILD_VERSION=${GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV"
138136
139- # โโ APT: no caching โ actions/cache cannot reliably handle system paths
140- # (/var/cache/apt glob and /var/lib/apt/lists vary per runner, causing
141- # permanent "Cache not found" noise with zero restore benefit).
142- # apt-get install is fast enough (~30s) without a cache layer.
137+ # โโ Layer 1: APT cache โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
138+ - name : Restore APT cache
139+ id : apt-cache
140+ uses : actions/cache@v4
141+ with :
142+ path : |
143+ /var/cache/apt/archives/*.deb
144+ /var/lib/apt/lists
145+ key : apt-kernel-build-v1
146+ restore-keys : apt-kernel-build-
147+
143148 - name : Install build dependencies
144149 run : |
145150 sudo apt-get update -qq
@@ -151,7 +156,7 @@ jobs:
151156 # Put ccache shims first so 'gcc' resolves to ccache transparently
152157 echo "/usr/lib/ccache" >> "$GITHUB_PATH"
153158
154- # โโ Layer 1 : ccache (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
159+ # โโ Layer 2 : ccache (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
155160 # Use cache/restore (not cache) so we can save a fresh key after build.
156161 # Primary key includes run_id so we ALWAYS write a new entry, and
157162 # restore-keys fan out from most- to least-specific for the best warmup.
@@ -170,7 +175,7 @@ jobs:
170175 - name : Zero ccache stats (for clean per-run reporting)
171176 run : ccache --zero-stats
172177
173- # โโ Layer 2 : Source tarball โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
178+ # โโ Layer 3 : Source tarball โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
174179 - name : Restore kernel source tarball
175180 id : kernel-tarball
176181 uses : actions/cache@v4
@@ -186,7 +191,7 @@ jobs:
186191 "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc"
187192 grep "linux-${FULL_VERSION}.tar.xz" sha256sums.asc | sha256sum -c -
188193
189- # โโ Layer 3 : Build tree (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
194+ # โโ Layer 4 : Build tree (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
190195 # Exact hit = incremental make (only changed files recompile).
191196 # Partial hit = more ccache warmup, still much faster than cold.
192197 - name : Restore build tree
@@ -213,39 +218,21 @@ jobs:
213218 # LOCALVERSION passed to olddefconfig so it's baked into autoconf.h,
214219 # keeping the value consistent across configure + build (ccache needs
215220 # the same preprocessed output both times).
216- # โโ Patches โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
217- # MUST run before Configure: the rtl8192eu patch adds new Kconfig
218- # entries that olddefconfig must see to resolve CONFIG_RTL8192EU.
219- #
220- # Cache-aware: a sentinel file (.patches-applied) records the hash of
221- # the patch set applied to this tree. If a restored build tree already
222- # carries the correct patches we skip re-application โ avoiding
223- # "file already exists" / reverse-patch failures on cache hits.
224- - name : Apply patches
221+ - name : Configure kernel
225222 working-directory : kernel
226223 run : |
227- shopt -s nullglob
228- SENTINEL=".patches-applied"
229- if [ -f "$SENTINEL" ] && [ "$(cat $SENTINEL)" = "${PATCHES_HASH}" ]; then
230- echo " โ patches already applied (hash ${PATCHES_HASH}), skipping"
231- else
232- for patch in ../patches/*.patch; do
233- echo " โ applying $(basename "$patch")"
234- patch -p1 --fuzz=5 < "$patch"
235- done
236- echo "${PATCHES_HASH}" > "$SENTINEL"
237- fi
224+ cp ../hyperion.config .config
225+ make olddefconfig LOCALVERSION="-Hyperion-${HYPERION_VER}"
238226
239- # โโ Configure โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
240- # Runs after patches so new Kconfig symbols (e.g. CONFIG_RTL8192EU)
241- # are visible to olddefconfig and get resolved to their defaults.
242- # LOCALVERSION is baked into autoconf.h here, keeping it consistent
243- # across configure + build so ccache gets maximum hit rate.
244- - name : Configure kernel
227+ # โโ Patches โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
228+ - name : Apply patches
245229 working-directory : kernel
246230 run : |
247- cp ../hyperion.config .config
248- make olddefconfig LOCALVERSION="-Hyperion-${HYPERION_VER}"
231+ shopt -s nullglob
232+ for patch in ../patches/*.patch; do
233+ echo " โ applying $(basename "$patch")"
234+ patch -p1 --fuzz=5 < "$patch"
235+ done
249236
250237 # โโ Build โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
251238 # -pipe: use pipes instead of temp files between compiler passes
@@ -257,15 +244,14 @@ jobs:
257244 CC="ccache gcc" \
258245 LOCALVERSION="-Hyperion-${HYPERION_VER}" \
259246 KCFLAGS="-pipe" \
260- bzImage modules 2>&1 | tee /tmp/build.log; \
261- grep -E "^.*(error:|undefined|fatal).*$" /tmp/build.log | tail -40 || true
247+ bzImage modules
262248
263249 # โโ ccache report โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
264250 - name : ccache statistics
265251 if : always()
266252 run : ccache --show-stats --verbose
267253
268- # โโ Layer 3 : Build tree (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
254+ # โโ Layer 4 : Build tree (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
269255 # Always save so the next run gets the freshest incremental state.
270256 # If key already exists GitHub skips the upload silently.
271257 - name : Save build tree
@@ -275,7 +261,7 @@ jobs:
275261 path : kernel
276262 key : kernel-tree-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
277263
278- # โโ Layer 1 : ccache (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
264+ # โโ Layer 2 : ccache (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
279265 # Save even on build failure so a partial run still warms future runs.
280266 - name : Save ccache
281267 if : always()
0 commit comments