diff --git a/patches/0014-fix-use-support-for-using-kpatch-ko.patch b/patches/0014-fix-use-support-for-using-kpatch-ko.patch new file mode 100644 index 0000000000000000000000000000000000000000..3243e54d3bf44ad6c3d4ed3da10e8644b9bf8b50 --- /dev/null +++ b/patches/0014-fix-use-support-for-using-kpatch-ko.patch @@ -0,0 +1,66 @@ +From 6fa2cbbd638cb4b886be346aae2ed75f4d1dccfb Mon Sep 17 00:00:00 2001 +From: Yongde Zhang +Date: Tue, 30 Apr 2024 15:45:14 +0800 +Subject: [PATCH] fix support for using kpatch ko + +fix support for using kpatch core module even +under kernel supporting livepatch. + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 0d77611..b515e4d 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -57,6 +57,7 @@ declare -a PATCH_LIST + APPLIED_PATCHES=0 + OOT_MODULE= + KLP_REPLACE=0 ++USE_KLP=1 + + GCC="${CROSS_COMPILE:-}gcc" + CLANG="${CROSS_COMPILE:-}clang" +@@ -757,7 +758,7 @@ usage() { + echo " (not recommended)" >&2 + } + +-options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace" -- "$@")" || die "getopt failed" ++options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,use-kpatch-module" -- "$@")" || die "getopt failed" + + eval set -- "$options" + +@@ -839,6 +840,10 @@ while [[ $# -gt 0 ]]; do + echo "WARNING: Skipping compiler version matching check (not recommended)" + SKIPCOMPILERCHECK=1 + ;; ++ --use-kpatch-module) ++ echo "use kpatch core module" ++ USE_KLP=0 ++ ;; + *) + [[ "$1" = "--" ]] && shift && continue + [[ ! -f "$1" ]] && die "patch file '$1' not found" +@@ -1180,12 +1185,9 @@ trace_on + # Build variables - Set some defaults, then adjust features + # according to .config and kernel version + KPATCH_LDFLAGS="" +-USE_KLP=0 + USE_KLP_ARCH=0 + +-if [[ -n "$CONFIG_LIVEPATCH" ]] && (kernel_is_rhel || kernel_version_gte 4.9.0); then +- +- USE_KLP=1 ++if [[ -n "$CONFIG_LIVEPATCH" ]] && [[ $USE_KLP -eq 1 ]] && (kernel_is_rhel || kernel_version_gte 4.9.0); then + + if [[ "$KLP_REPLACE" -eq 1 ]] ; then + support_klp_replace || die "The kernel doesn't support klp replace" +@@ -1288,7 +1290,7 @@ fi + # shellcheck disable=SC2086 + make "${MAKEVARS[@]}" "-j$CPUS" $TARGETS 2>&1 | logger || die "Building Original source failed" 10 + +-if [[ -n "$CONFIG_LIVEPATCH" ]]; then ++if [[ -n "$CONFIG_LIVEPATCH" ]] && [[ $USE_KLP -eq 1 ]]; then + if new_use_klp_arch; then + USE_KLP_ARCH=1 + KPATCH_LDFLAGS="--unique=.parainstructions --unique=.altinstructions" +-- +1.8.3.1 +