mirror of https://github.com/dynup/kpatch
kpatch-build: fix setlocalversion for pre-v6.3 kernels
Commit629b5acf3d
("kpatch-build: Fix setlocalversion issue with 6.3 kernel") fixed VERMAGIC_STRING between kpatch original/patched kernel builds by creating a temporary scripts/setlocalversion script. This was accomplished by saving the output from `make kernelversion` into a KERNELVERSION environment variable and running the (original) scripts/setlocalversion to gather a "vX.Y" + "<src version>" pair of strings. Unfortunately pre-v6.3 scripts/setlocalversion does not use the KERNELVERSION environment variable, so the same efforts results in an unusable "<NULL>" + "<src version>" version string pair. Restore the original `scripts/setlocalversion --save-scmversion` invocation for source trees that (still) support the --save-scmversion option. Fixes:629b5acf3d
("kpatch-build: Fix setlocalversion issue with 6.3 kernel") Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
parent
711ee6d322
commit
77d9346383
|
@ -210,6 +210,8 @@ restore_kernel_files() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
|
rm -f "$BUILDDIR/.scmversion"
|
||||||
|
|
||||||
remove_patches
|
remove_patches
|
||||||
restore_kernel_files
|
restore_kernel_files
|
||||||
|
|
||||||
|
@ -1118,18 +1120,23 @@ fi
|
||||||
# appended to the kernel version string (VERMAGIC_STRING), even if the original
|
# appended to the kernel version string (VERMAGIC_STRING), even if the original
|
||||||
# kernel was not dirty. That can complicate both the build (create-diff-object
|
# kernel was not dirty. That can complicate both the build (create-diff-object
|
||||||
# false positive changes) and the patch module link (module version mismatch
|
# false positive changes) and the patch module link (module version mismatch
|
||||||
# load failures).
|
# load failures). Before making any changes to the source:
|
||||||
#
|
#
|
||||||
# Prevent that by replacing the original setlocalversion with a friendlier one
|
# For pre-v6.3 kernels:
|
||||||
# which just echo's the original version. This should be done before any
|
# Run `./scripts/setlocalversion --save-scmversion`.
|
||||||
# changes to the source.
|
#
|
||||||
|
# For v6.3+ kernels:
|
||||||
|
# Replace the original setlocalversion with a friendlier one which just echo's
|
||||||
|
# the original version.
|
||||||
if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then
|
if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then
|
||||||
cd "$KERNEL_SRCDIR" || die
|
cd "$KERNEL_SRCDIR" || die
|
||||||
backup_kernel_file "scripts/setlocalversion"
|
if ! ./scripts/setlocalversion --save-scmversion &>/dev/null; then
|
||||||
LOCALVERSION="$(make kernelversion)"
|
backup_kernel_file "scripts/setlocalversion"
|
||||||
LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)"
|
LOCALVERSION="$(make kernelversion)"
|
||||||
[[ -n "$LOCALVERSION" ]] || die "setlocalversion failed"
|
LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)"
|
||||||
echo "echo $LOCALVERSION" > scripts/setlocalversion
|
[[ -n "$LOCALVERSION" ]] || die "setlocalversion failed"
|
||||||
|
echo "echo $LOCALVERSION" > scripts/setlocalversion
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# kernel option checking
|
# kernel option checking
|
||||||
|
|
Loading…
Reference in New Issue