@@ -14,19 +14,15 @@ permissions:
1414# CACHING ARCHITECTURE
1515# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1616#
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
23- # โ โ partial cache, never a stale pinned key.
17+ # Layer 1 โ ccache โ ccache-<os>-<ver>-<cfg>-<patches>-<run_id>
18+ # โ โ Always saves a NEW key per run so restore-keys
19+ # โ โ always finds the freshest partial cache.
2420# โ โ SLOPPINESS + DIRECT mode = max hit rate.
2521#
26- # Layer 3 โ Source tarball โ kernel-tarball-<version>
22+ # Layer 2 โ Source tarball โ kernel-tarball-<version>
2723# โ โ Immutable. Downloaded once, cached forever.
2824#
29- # Layer 4 โ Full build tree โ kernel-tree-<ver>-<cfg>-<patches>
25+ # Layer 3 โ Full build tree โ kernel-tree-<ver>-<cfg>-<patches>
3026# โ โ Exact match = zero rebuild (incremental make).
3127# โ โ Partial match via restore-keys still helps.
3228# โ โ Saved unconditionally after every build.
8177 f.write(f"{k}={v}\n")
8278 EOF
8379
84-
8580 build-kernel :
8681 needs : validate-config
8782 runs-on : ubuntu-latest
@@ -100,24 +95,24 @@ jobs:
10095 # KBUILD_BUILD_TIMESTAMP is set dynamically from git history below
10196
10297 # โโ ccache โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
103- CCACHE_DIR : ${{ github.workspace }}/.ccache
104- CCACHE_MAXSIZE : 8G
98+ CCACHE_DIR : ${{ github.workspace }}/.ccache
99+ CCACHE_MAXSIZE : 8G
105100 # Compression: on, level 6 (good balance of speed vs size)
106- CCACHE_COMPRESS : 1
101+ CCACHE_COMPRESS : 1
107102 CCACHE_COMPRESSLEVEL : 6
108103 # Direct mode: skip preprocessing step, cache by hash of source + headers
109- CCACHE_DIRECT : 1
104+ CCACHE_DIRECT : 1
110105 # Basedir strips the workspace prefix from paths in the cache, so the
111106 # cache is portable across different runner checkout paths
112- CCACHE_BASEDIR : ${{ github.workspace }}
113- CCACHE_NOHASHDIR : 1
107+ CCACHE_BASEDIR : ${{ github.workspace }}
108+ CCACHE_NOHASHDIR : 1
114109 # Sloppiness: critical for kernel builds
115110 # time_macros โ ignore __DATE__ / __TIME__ (we fix the timestamp anyway)
116111 # include_file_mtime โ don't invalidate on header mtime, only content
117112 # include_file_ctime โ same for ctime
118113 # file_stat_matches โ use stat() instead of content hash for unchanged files
119114 # pch_defines โ handle precompiled-header define changes gracefully
120- CCACHE_SLOPPINESS : time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines
115+ CCACHE_SLOPPINESS : time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines
121116
122117 steps :
123118
@@ -134,29 +129,22 @@ jobs:
134129 echo "KBUILD_BUILD_TIMESTAMP=$(date -u -d "@$SOURCE_DATE_EPOCH" '+%a %b %e %H:%M:%S UTC %Y')" >> "$GITHUB_ENV"
135130 echo "KBUILD_BUILD_VERSION=${GITHUB_RUN_NUMBER}" >> "$GITHUB_ENV"
136131
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-
132+ # โโ Dependencies โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
133+ # APT caching is intentionally omitted: GitHub runners refresh their
134+ # package index on every boot, making cached .deb archives unreliable.
135+ # The install is fast enough (~20โ30 s) that the complexity isn't worth it.
148136 - name : Install build dependencies
149137 run : |
150138 sudo apt-get update -qq
151139 sudo apt-get install -y --no-install-recommends \
152140 build-essential bc bison flex \
153141 libssl-dev libelf-dev libncurses-dev \
154- dwarves rsync cpio wget \
155- ccache zstd ca-certificates
142+ dwarves rsync cpio \
143+ ccache zstd
156144 # Put ccache shims first so 'gcc' resolves to ccache transparently
157145 echo "/usr/lib/ccache" >> "$GITHUB_PATH"
158146
159- # โโ Layer 2 : ccache (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
147+ # โโ Layer 1 : ccache (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
160148 # Use cache/restore (not cache) so we can save a fresh key after build.
161149 # Primary key includes run_id so we ALWAYS write a new entry, and
162150 # restore-keys fan out from most- to least-specific for the best warmup.
@@ -175,7 +163,7 @@ jobs:
175163 - name : Zero ccache stats (for clean per-run reporting)
176164 run : ccache --zero-stats
177165
178- # โโ Layer 3 : Source tarball โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
166+ # โโ Layer 2 : Source tarball โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
179167 - name : Restore kernel source tarball
180168 id : kernel-tarball
181169 uses : actions/cache@v4
@@ -186,12 +174,12 @@ jobs:
186174 - name : Download kernel tarball
187175 if : steps.kernel-tarball.outputs.cache-hit != 'true'
188176 run : |
189- wget -q --show-progress \
190- "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/linux-${FULL_VERSION}.tar.xz" \
191- "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc"
192- grep "linux-${FULL_VERSION}.tar.xz" sha256sums.asc | sha256sum -c -
177+ curl -fsSL --output "linux-${FULL_VERSION}.tar.xz" \
178+ "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/linux-${FULL_VERSION}.tar.xz"
179+ curl -fsSL "https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION}.x/sha256sums.asc" \
180+ | grep "linux-${FULL_VERSION}.tar.xz" | sha256sum -c -
193181
194- # โโ Layer 4 : Build tree (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
182+ # โโ Layer 3 : Build tree (restore) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
195183 # Exact hit = incremental make (only changed files recompile).
196184 # Partial hit = more ccache warmup, still much faster than cold.
197185 - name : Restore build tree
@@ -231,11 +219,13 @@ jobs:
231219 shopt -s nullglob
232220 for patch in ../patches/*.patch; do
233221 echo " โ applying $(basename "$patch")"
234- patch -p1 --fuzz=5 < "$patch"
222+ patch -p1 < "$patch"
235223 done
236224
237225 # โโ Build โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
238- # -pipe: use pipes instead of temp files between compiler passes
226+ # -pipe: use pipes instead of temp files between compiler passes
227+ # bzImage only: modules are not packaged so skip the modules target to
228+ # avoid spending ~30โ60 % of build time on unused output.
239229 # LOCALVERSION: must match what was passed to olddefconfig above
240230 - name : Build kernel
241231 working-directory : kernel
@@ -244,14 +234,14 @@ jobs:
244234 CC="ccache gcc" \
245235 LOCALVERSION="-Hyperion-${HYPERION_VER}" \
246236 KCFLAGS="-pipe" \
247- bzImage modules
237+ bzImage
248238
249239 # โโ ccache report โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
250240 - name : ccache statistics
251241 if : always()
252242 run : ccache --show-stats --verbose
253243
254- # โโ Layer 4 : Build tree (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
244+ # โโ Layer 3 : Build tree (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
255245 # Always save so the next run gets the freshest incremental state.
256246 # If key already exists GitHub skips the upload silently.
257247 - name : Save build tree
@@ -261,7 +251,7 @@ jobs:
261251 path : kernel
262252 key : kernel-tree-${{ env.FULL_VERSION }}-${{ env.CONFIG_HASH }}-${{ env.PATCHES_HASH }}
263253
264- # โโ Layer 2 : ccache (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
254+ # โโ Layer 1 : ccache (save) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
265255 # Save even on build failure so a partial run still warms future runs.
266256 - name : Save ccache
267257 if : always()
0 commit comments