kernel: make KCONFIG_SHA256 independent of the host python (bfe-core1106-sdk#19)

DRM_MSM_VALIDATE_XML depended on `$(PYTHON3) -c "import lxml"`, so the expanded .config gained a
line on hosts where python3 could import lxml and the whole-file digest differed (the flashed image
ec276f77 against e8e9ef1c from a config-only run on the same tree). Drop the unused Qualcomm symbol
with a one-block Kconfig patch; the digest is now ec276f77 everywhere and equals the flashed one.

Regression test: tests/required-symbols/run-config-determinism-tests.sh runs the config-only
expansion with a python3 whose import lxml works and one where it fails and requires the same
digest; it is proven red on a copy of the tree without the patch. The kernel-symbols CI job runs it.

Fixes #19.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cxh2piVufTWbzKTmUafTkk
This commit is contained in:
Noah
2026-10-09 19:17:57 -06:00
co-authored by Claude Sonnet 5.5
parent 0589829619
commit cf72a6dcbc
4 changed files with 94 additions and 0 deletions
+6
View File
@@ -255,6 +255,12 @@ jobs:
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash build/build-kernel.sh
cmp "${{ runner.temp }}/final.config" "$CONFIG_OUT"
- name: the digest does not depend on the host python (issue #19)
env:
CROSS_COMPILE: arm-linux-gnueabihf-
run: |
export KERNEL_TARBALL="$HOME/linux-6.18.46.tar.xz"
bash tests/required-symbols/run-config-determinism-tests.sh
patches-apply:
# The RV1106 series must apply cleanly onto pristine linux-6.18.46.
+25
View File
@@ -0,0 +1,25 @@
Remove the DRM_MSM_VALIDATE_XML Kconfig symbol (rebuild M0, bfe-core1106-sdk#19).
Its dependency $(success,$(PYTHON3) -c "import lxml") makes the expanded .config differ by host: with
python3-lxml importable the file gains '# CONFIG_DRM_MSM_VALIDATE_XML is not set', without it the line is
absent, so KCONFIG_SHA256 was not reproducible across hosts. The symbol only validates Qualcomm GPU register
XML for DRM MSM developers; the panel has no Qualcomm GPU. No binary changes.
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -50,14 +50,6 @@
Only use this if you are a driver developer. This should *not*
be enabled for production kernels. If unsure, say N.
-config DRM_MSM_VALIDATE_XML
- bool "Validate XML register files against schema"
- depends on DRM_MSM && EXPERT
- depends on $(success,$(PYTHON3) -c "import lxml")
- help
- Validate XML files with register definitions against rules-fd schema.
- This option is mostly targeting DRM MSM developers. If unsure, say N.
-
config DRM_MSM_KMS
def_bool n
depends on DRM_MSM
+1
View File
@@ -28,6 +28,7 @@ with `../build/warden_defconfig` -> `zImage` + `rv1106-warden.dtb`).
| `60-wifi-aic8800.patch` | out-of-tree AIC8800 wifi/BT (the 88.5K-line vendor blob) |
| `70-audio-codec.patch` | `rv1106_codec` + I2S wiring |
| `80-misc-thermal-rtc-adc.patch` | tsadc, rtc-rockchip, saradc, trng, otp, gmac, goodix touch |
| `90-kconfig-no-python-symbol.patch` | drops `DRM_MSM_VALIDATE_XML` so the expanded `.config` (and `KCONFIG_SHA256`) does not depend on the host python (#19) |
## License
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# The final kernel .config, and so KCONFIG_SHA256, must not depend on the host's python (issue #19):
# DRM_MSM_VALIDATE_XML used to be visible only where python3 could import lxml, adding one line to the
# file. Runs the config-only expansion twice, once with a python3 whose `import lxml` works and once with
# one where it fails, and requires the same digest. Proven red on a copy of the tree without
# patches/90-kconfig-no-python-symbol.patch (when this host's python3 has lxml; otherwise the red case
# is skipped with a notice). Needs the pinned kernel tarball: KERNEL_TARBALL=<path>, or skipped.
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXIT
FAIL=0
ok() { printf '[PASS] %s\n' "$1"; }
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
if [ -z "${KERNEL_TARBALL:-}" ] || [ ! -f "$KERNEL_TARBALL" ]; then
echo "[SKIP] set KERNEL_TARBALL to the pinned linux-6.18.46.tar.xz"; exit 0
fi
command -v python >/dev/null || { echo "[SKIP] needs 'python' on PATH (SDK quirk)"; exit 0; }
REAL_PY="$(command -v python3)"
# a python3 on which `import lxml` fails, everything else passes through
mkdir -p "$TMP/nolxml"
cat > "$TMP/nolxml/python3" <<PYEOF
#!/bin/sh
case "\$*" in *"import lxml"*) exit 1 ;; esac
exec "$REAL_PY" "\$@"
PYEOF
chmod +x "$TMP/nolxml/python3"
# and one where it succeeds even if lxml is not installed
mkdir -p "$TMP/lxml"
cat > "$TMP/lxml/python3" <<PYEOF
#!/bin/sh
case "\$*" in *"import lxml"*) exit 0 ;; esac
exec "$REAL_PY" "\$@"
PYEOF
chmod +x "$TMP/lxml/python3"
digest() { # digest <tree root> <path prefix dir>
local root="$1" pfx="$2" work
work="$(mktemp -d "$TMP/w.XXXXXX")"
PATH="$pfx:$PATH" KERNEL_TARBALL="$KERNEL_TARBALL" WORK="$work" WARDEN_CONFIG_ONLY=1 \
CONFIG_OUT="$work/final.config" CROSS_COMPILE="${CROSS_COMPILE:-arm-linux-gnueabihf-}" \
bash "$root/build/build-kernel.sh" > "$work/log" 2>&1 || { tail -5 "$work/log" >&2; echo FAILED; return; }
cat "$work/final.config.sha256"
}
a="$(digest "$REPO" "$TMP/lxml")"; b="$(digest "$REPO" "$TMP/nolxml")"
if [ "$a" != FAILED ] && [ "$a" = "$b" ]; then ok "the config digest is the same with and without a working import lxml ($a)"
else bad "the config digest depends on the host python: with lxml $a, without $b"; fi
# red case: a tree without the patch
mkdir -p "$TMP/old/patches"
cp -r "$REPO/build" "$TMP/old/build"
for p in "$REPO"/patches/*.patch; do [ "$(basename "$p")" = 90-kconfig-no-python-symbol.patch ] || cp "$p" "$TMP/old/patches/"; done
oa="$(digest "$TMP/old" "$TMP/lxml")"; ob="$(digest "$TMP/old" "$TMP/nolxml")"
if [ "$oa" = FAILED ] || [ "$ob" = FAILED ]; then bad "the doctored tree did not expand"
elif [ "$oa" != "$ob" ]; then ok "doctored: without the patch the digests differ ($oa vs $ob), so this test can fail"
else bad "doctored: the digests are equal even without the patch; the test proves nothing on this tarball"; fi
if [ "$FAIL" -eq 0 ]; then echo "ALL CONFIG-DETERMINISM TESTS PASSED"; else echo "CONFIG-DETERMINISM TESTS FAILED"; fi
exit $FAIL