On Thu, Mar 05, 2026 at 02:52:46PM -0800, Josh Poimboeuf wrote:
> If .config hasn't been synced with auto.conf, any recent changes to
> CONFIG_LOCALVERSION* may not get reflected in the kernel version name.
>
> Use "make syncconfig" to force them to sync, and "make kernelrelease" to
> get the version instead of having to construct it manually.
>
> Fixes: 24ebfcd65a87 ("livepatch/klp-build: Introduce klp-build script for
> generating livepatch modules")
> Closes:
> https://lore.kernel.org/[email protected]
> Reported-by: Joe Lawrence <[email protected]>
> Signed-off-by: Josh Poimboeuf <[email protected]>
> ---
> scripts/livepatch/klp-build | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build
> index 809e198a561d..72f05c40b9f8 100755
> --- a/scripts/livepatch/klp-build
> +++ b/scripts/livepatch/klp-build
> @@ -285,15 +285,14 @@ set_module_name() {
> # application from appending it with '+' due to a dirty git working tree.
> set_kernelversion() {
> local file="$SRC/scripts/setlocalversion"
> - local localversion
> + local kernelrelease
>
> stash_file "$file"
>
> - localversion="$(cd "$SRC" && make --no-print-directory kernelversion)"
> - localversion="$(cd "$SRC" && KERNELVERSION="$localversion"
> ./scripts/setlocalversion)"
> - [[ -z "$localversion" ]] && die "setlocalversion failed"
> + kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make
> kernelrelease)"
Almost, I needed to add '-s' to the kernelversion target to silence the
make "entering / leaving directory" msgs and then this worked for me.
There's some makefile voodoo going on here where when I manually run
`make kernelrelease` I don't see the verbose msgs, but I printed
"$kernelrelease" here in klp-build and on my machine (make v4.4.1), that
extra output derailed the script.
Anyway, `make help` says:
kernelrelease - Output the release version string (use with make -s)
so we should probably use '-s' regardless.
With that, shall I drop my ("livepatch/klp-build: fix version mismatch
when short-circuiting") and carry yours in its place?
--
Joe