mirror of
https://github.com/dynup/kpatch
synced 2025-03-25 04:16:39 +00:00
kpatch-test: disable replace flag when the kernel doesn't support it
For redhat kernel < 4.18.0-193.el8 or non-redhat kernel version < 5.1, add -R to $KPATCHBUILD_OPTS. Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
parent
8487a0ca0a
commit
4b68be868f
@ -50,6 +50,7 @@ ERROR=0
|
||||
LOG=test.log
|
||||
DYNDEBUG_CONTROL=/sys/kernel/debug/dynamic_debug/control
|
||||
DYNDEBUG_ENABLED=1
|
||||
ARCHVERSION="$(uname -r)"
|
||||
rm -f ./*.log
|
||||
|
||||
PATCHDIR="${PATCHDIR:-$PWD}"
|
||||
@ -308,6 +309,27 @@ new_dmesg() {
|
||||
fi
|
||||
}
|
||||
|
||||
kernel_version_gte() {
|
||||
[ "${ARCHVERSION//-*/}" = "$(echo -e "${ARCHVERSION//-*}\\n$1" | sort -rV | head -n1)" ]
|
||||
}
|
||||
|
||||
support_klp_replace()
|
||||
{
|
||||
if kernel_is_rhel; then
|
||||
rhel_kernel_version_gte 4.18.0-193.el8
|
||||
else
|
||||
kernel_version_gte 5.1.0
|
||||
fi
|
||||
}
|
||||
|
||||
kernel_is_rhel() {
|
||||
[[ "$ARCHVERSION" =~ \.el[789] ]]
|
||||
}
|
||||
|
||||
rhel_kernel_version_gte() {
|
||||
[ "${ARCHVERSION}" = "$(echo -e "${ARCHVERSION}\\n$1" | sort -rV | head -n1)" ]
|
||||
}
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source /etc/os-release
|
||||
if [[ "${ID}" == "rhel" && "${VERSION_ID%%.*}" == "7" && "${VERSION_ID##*.}" -le "6" ]]; then
|
||||
@ -315,6 +337,11 @@ if [[ "${ID}" == "rhel" && "${VERSION_ID%%.*}" == "7" && "${VERSION_ID##*.}" -le
|
||||
echo "Dynamic debug is not supported on '${PRETTY_NAME}', disabling."
|
||||
fi
|
||||
|
||||
if ! support_klp_replace ; then
|
||||
KPATCHBUILD_OPTS="$KPATCHBUILD_OPTS -R"
|
||||
echo "KLP replace is not supported on '${PRETTY_NAME}', disabling."
|
||||
fi
|
||||
|
||||
for file in "${PATCH_LIST[@]}"; do
|
||||
if [[ $QUICK != 1 || "$file" =~ -FAIL ]]; then
|
||||
build_module "$file"
|
||||
|
Loading…
Reference in New Issue
Block a user