Commit 6f93f7b0 authored by Josh Poimboeuf's avatar Josh Poimboeuf
Browse files

livepatch/klp-build: Fix inconsistent kernel version

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 -s kernelrelease"
to get the version instead of having to construct it manually.

Fixes: 24ebfcd6 ("livepatch/klp-build: Introduce klp-build script for generating livepatch modules")
Closes: https://lore.kernel.org/20260217160645.3434685-10-joe.lawrence@redhat.com


Reported-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarJoe Lawrence <joe.lawrence@redhat.com>
Acked-by: default avatarSong Liu <song@kernel.org>
Link: https://patch.msgid.link/20260310203751.1479229-10-joe.lawrence@redhat.com


Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
parent 28e367a9
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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 -s kernelrelease)"
	[[ -z "$kernelrelease" ]] && die "failed to get kernel version"

	sed -i "2i echo $localversion; exit 0" scripts/setlocalversion
	sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion
}

get_patch_files() {