Speed up kernel CI: ccache depend mode, drop pahole deps, no module compression

- ccache: enable depend mode (skip the preprocessor on ~75k compiler
  calls) and add BASEDIR/NOHASHDIR/SLOPPINESS as insurance against false
  misses from build-path or build-macro churn. ccache -s already shows
  99.99% direct hits, so this trims per-call overhead, not a broken
  cache. MAXSIZE stays 8G (only ~1G used).
- deps: drop dwarves + libdw-dev. pahole only runs with
  CONFIG_DEBUG_INFO_BTF, but the build forces DEBUG_INFO_NONE, so they
  were never used.
- config: disable MODULE_COMPRESS/MODULE_DECOMPRESS for both arches.
  arm64 alone shipped zstd module compression, running a zstd pass over
  ~8000 .ko every build for no gain (the .deb is already compressed by
  KDEB_COMPRESS); x86_64 never did. Keeps the two arches in sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-06-18 10:29:47 +08:00
parent 84107222b9
commit cedc6b914e
2 changed files with 28 additions and 2 deletions
+18 -2
View File
@@ -129,12 +129,15 @@ jobs:
if: env.BUILD_NEEDED == 'true' if: env.BUILD_NEEDED == 'true'
run: | run: |
sudo apt-get update sudo apt-get update
# dwarves/libdw-dev (pahole) are intentionally absent: the build sets
# CONFIG_DEBUG_INFO_NONE=y and DEBUG_INFO_BTF=n (see prepare-kernel-config.sh),
# so pahole never runs. Re-add them if BTF is ever enabled.
sudo apt-get install -y \ sudo apt-get install -y \
git build-essential \ git build-essential \
libncurses-dev libssl-dev libelf-dev \ libncurses-dev libssl-dev libelf-dev \
bison bc flex rsync debhelper \ bison bc flex rsync debhelper \
dpkg-dev fakeroot kmod cpio dwarves \ dpkg-dev fakeroot kmod cpio \
libdw-dev lz4 zstd xz-utils curl jq lz4 zstd xz-utils curl jq
- name: 安装 ARM64 交叉编译工具链 - name: 安装 ARM64 交叉编译工具链
if: env.BUILD_NEEDED == 'true' && matrix.arch == 'arm64' if: env.BUILD_NEEDED == 'true' && matrix.arch == 'arm64'
@@ -159,6 +162,19 @@ jobs:
echo "CCACHE_DIR=$HOME/.ccache" echo "CCACHE_DIR=$HOME/.ccache"
echo "CCACHE_MAXSIZE=8G" echo "CCACHE_MAXSIZE=8G"
echo "CCACHE_COMPRESS=1" echo "CCACHE_COMPRESS=1"
# depend mode: hash the source + its -MD/-MMD header list instead of
# running the preprocessor on every one of ~75k compiler calls. The
# kernel always emits dependency files, so this is safe and trims the
# per-call overhead on both hits and misses.
echo "CCACHE_DEPEND=1"
# Insurance against false misses if the build path or build-time macros
# ever vary between runs (the source is re-cloned fresh each time).
# BASEDIR must be an ancestor of the build CWD (./kernel/linux).
# With the path already stable these are near no-ops, but they cost
# nothing and guard against a path/macro change silently going cold.
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE/kernel"
echo "CCACHE_NOHASHDIR=1"
echo "CCACHE_SLOPPINESS=time_macros,file_macros,locale,pch_defines"
} >> "$GITHUB_ENV" } >> "$GITHUB_ENV"
- name: 恢复 ccache 缓存 - name: 恢复 ccache 缓存
+10
View File
@@ -68,6 +68,16 @@ apply_policy_config() {
scripts/config --disable INET6_ESP scripts/config --disable INET6_ESP
scripts/config --disable AF_RXRPC scripts/config --disable AF_RXRPC
scripts/config --disable RXKAD scripts/config --disable RXKAD
# Don't compress modules at build time. arm64.config historically shipped
# CONFIG_MODULE_COMPRESS=y (zstd) while x86-64.config did not, so every arm64
# build ran a zstd pass over ~8000 .ko for no benefit: the published .deb is
# already compressed by KDEB_COMPRESS, and x86_64 proves the kernel ships fine
# with uncompressed on-disk modules. Disabling here keeps both arches in sync;
# olddefconfig drops the now-invisible MODULE_COMPRESS_* / MODULE_DECOMPRESS
# children. (Trade-off: installed /lib/modules .ko are uncompressed on disk.)
scripts/config --disable MODULE_COMPRESS
scripts/config --disable MODULE_DECOMPRESS
} }
require_config_line() { require_config_line() {