]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
klp-build: Fix hang on out-of-date .config
authorJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 3 Apr 2026 02:47:10 +0000 (19:47 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:16:02 +0000 (21:16 -0700)
If .config is out of date with the kernel source, 'make syncconfig'
hangs while waiting for user input on new config options.  Detect the
mismatch and return an error.

Fixes: 6f93f7b06810 ("livepatch/klp-build: Fix inconsistent kernel version")
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
scripts/livepatch/klp-build

index 0ad7e6631314205163db6ad84f89a404372ee078..e19d93b78fcba047aa1c59ce65a906d860a965c4 100755 (executable)
@@ -306,7 +306,12 @@ set_kernelversion() {
 
        stash_file "$file"
 
-       kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"
+       if [[ -n "$(make -s listnewconfig 2>/dev/null)" ]]; then
+               die ".config mismatch, check your .config or run 'make olddefconfig'"
+       fi
+       make syncconfig &>/dev/null || die "make syncconfig failed"
+
+       kernelrelease="$(make -s kernelrelease)"
        [[ -z "$kernelrelease" ]] && die "failed to get kernel version"
 
        sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion