Skip to content

Commit 6f93f7b

Browse files
committed
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: 24ebfcd ("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]> Signed-off-by: Joe Lawrence <[email protected]> Acked-by: Song Liu <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Josh Poimboeuf <[email protected]>
1 parent 28e367a commit 6f93f7b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

scripts/livepatch/klp-build

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,15 +285,14 @@ set_module_name() {
285285
# application from appending it with '+' due to a dirty git working tree.
286286
set_kernelversion() {
287287
local file="$SRC/scripts/setlocalversion"
288-
local localversion
288+
local kernelrelease
289289

290290
stash_file "$file"
291291

292-
localversion="$(cd "$SRC" && make --no-print-directory kernelversion)"
293-
localversion="$(cd "$SRC" && KERNELVERSION="$localversion" ./scripts/setlocalversion)"
294-
[[ -z "$localversion" ]] && die "setlocalversion failed"
292+
kernelrelease="$(cd "$SRC" && make syncconfig &>/dev/null && make -s kernelrelease)"
293+
[[ -z "$kernelrelease" ]] && die "failed to get kernel version"
295294

296-
sed -i "2i echo $localversion; exit 0" scripts/setlocalversion
295+
sed -i "2i echo $kernelrelease; exit 0" scripts/setlocalversion
297296
}
298297

299298
get_patch_files() {

0 commit comments

Comments
 (0)