From: Josh Poimboeuf <[email protected]>

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: 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]>
Signed-off-by: Joe Lawrence <[email protected]> [add -s to make 
kernelrelease]
---
 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 60c7635e65c1..7f4041a0eefb 100755
--- a/scripts/livepatch/klp-build
+++ b/scripts/livepatch/klp-build
@@ -293,15 +293,14 @@ set_module_name() {
 # application from appending it with '+' due to a dirty 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_input_files() {
-- 
2.53.0


Reply via email to