@@ -3,11 +3,12 @@ DESCRIPTION = "kpatch is a Linux dynamic kernel patching infrastructure which al
LICENSE = "GPL-2.0-only AND LGPL-2.0-only"
DEPENDS = "elfutils bash"
-SRC_URI = "git://github.com/dynup/kpatch.git;protocol=https;branch=master \
- file://0001-kpatch-build-add-cross-compilation-support.patch \
+SRC_URI = "git://github.com/dynup/kpatch.git;protocol=https;branch=master;tag=v${PV} \
file://0002-kpatch-build-allow-overriding-of-distro-name.patch \
"
+UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>\d+(\.\d+)+)$"
+
EXTRA_OEMAKE = " \
PREFIX=${prefix} \
BINDIR=${D}${bindir} \
deleted file mode 100644
@@ -1,105 +0,0 @@
-From 21909e3f9096fa8e4825df8c65114ee92ab3d532 Mon Sep 17 00:00:00 2001
-From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com>
-Date: Wed, 7 Aug 2019 02:57:35 +0900
-Subject: [PATCH] kpatch-build: add cross-compilation support
-
-This patch introduces new option for kpatch-build
-script "--cross-compile" which can be used for
-specifying cross-complier prefix.
-It allows to build live patches not only on
-target system, but also on hosts for a target other
-than the one on which the compiler is running
-
-Also removed quotes in exec lines, so it is
-possible to pass multy-component strings like
-"ccache x86_64-xelinux-linux-" as cross-compiler
-
-Upstream-Status: Pending
-
-Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
----
- kpatch-build/kpatch-build | 13 +++++++++++--
- kpatch-build/kpatch-gcc | 4 ++--
- 2 files changed, 13 insertions(+), 4 deletions(-)
-
-diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
-index 9ef3809..463dab1 100755
---- a/kpatch-build/kpatch-build
-+++ b/kpatch-build/kpatch-build
-@@ -198,7 +198,7 @@ gcc_version_check() {
- # gcc --version varies between distributions therefore extract version
- # by compiling a test file and compare it to vmlinux's version.
- echo 'void main(void) {}' > "$c"
-- out="$(gcc -c -pg -ffunction-sections -o "$o" "$c" 2>&1)"
-+ out="$(${KPATCH_CROSS_COMPILE}gcc -c -pg -ffunction-sections -o "$o" "$c" 2>&1)"
- gccver="$(gcc_version_from_file "$o")"
- if [[ -n "$OOT_MODULE" ]]; then
- kgccver="$(gcc_version_from_file "$OOT_MODULE")"
-@@ -411,6 +411,8 @@ usage() {
- echo " (can be specified multiple times)" >&2
- echo " -e, --oot-module Enable patching out-of-tree module," >&2
- echo " specify current version of module" >&2
-+ echo " --cross-compile Specify the prefix used for all executables" >&2
-+ echo " used during compilation" >&2
- echo " --skip-cleanup Skip post-build cleanup" >&2
- echo " --skip-gcc-check Skip gcc version matching check" >&2
- echo " (not recommended)" >&2
-@@ -416,7 +418,7 @@ usage() {
- echo " (not recommended)" >&2
- }
-
--options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
-+options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
-
- eval set -- "$options"
-
-@@ -479,6 +481,10 @@ while [[ $# -gt 0 ]]; do
- OOT_MODULE="$(readlink -f "$2")"
- shift
- ;;
-+ --cross-compile)
-+ KPATCH_CROSS_COMPILE="$2"
-+ shift
-+ ;;
- --skip-cleanup)
- echo "Skipping cleanup"
- SKIPCLEANUP=1
-@@ -757,6 +763,8 @@ if [[ $DEBUG -ge 4 ]]; then
- export KPATCH_GCC_DEBUG=1
- fi
-
-+export KPATCH_CROSS_COMPILE
-+
- echo "Building original source"
- [[ -n "$OOT_MODULE" ]] || ./scripts/setlocalversion --save-scmversion || die
- unset KPATCH_GCC_TEMPDIR
-@@ -940,6 +948,7 @@ fi
- KPATCH_BUILD="$KPATCH_BUILD" KPATCH_NAME="$MODNAME" \
- KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS" \
- KPATCH_LDFLAGS="$KPATCH_LDFLAGS" \
-+CROSS_COMPILE="$KPATCH_CROSS_COMPILE" \
- make 2>&1 | logger || die
-
- if ! "$KPATCH_MODULE"; then
-diff --git a/kpatch-build/kpatch-gcc b/kpatch-build/kpatch-gcc
-index 9663290..56e6c8f 100755
---- a/kpatch-build/kpatch-gcc
-+++ b/kpatch-build/kpatch-gcc
-@@ -8,7 +8,7 @@ TOOLCHAINCMD="$1"
- shift
-
- if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then
-- exec "$TOOLCHAINCMD" "$@"
-+ exec ${KPATCH_CROSS_COMPILE}${TOOLCHAINCMD} "$@"
- fi
-
- declare -a args=("$@")
-@@ -84,4 +84,4 @@ elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then
- done
- fi
-
--exec "$TOOLCHAINCMD" "${args[@]}"
-+exec ${KPATCH_CROSS_COMPILE}${TOOLCHAINCMD} "${args[@]}"
-2.7.4
-
@@ -19,27 +19,28 @@ Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
-index 39933fc..c0258a2 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
-@@ -413,12 +413,13 @@ usage() {
- echo " specify current version of module" >&2
- echo " --cross-compile Specify the prefix used for all executables" >&2
- echo " used during compilation" >&2
-+ echo " --distro Override distro name" >&2
- echo " --skip-cleanup Skip post-build cleanup" >&2
- echo " --skip-gcc-check Skip gcc version matching check" >&2
- echo " (not recommended)" >&2
- }
+@@ -753,6 +753,7 @@ usage() {
+ echo " specify current version of module" >&2
+ echo " --oot-module-src Specify out-of-tree module source directory" >&2
+ echo " -R, --non-replace Disable replace patch (replace is on by default)" >&2
++ echo " --distro Override distro name" >&2
+ echo " --skip-cleanup Skip post-build cleanup" >&2
+ echo " --skip-compiler-check Skip compiler version matching check" >&2
+ echo " (not recommended)" >&2
+@@ -763,7 +764,7 @@ if ! command -v gawk &> /dev/null; then
+ die "gawk not installed"
+ fi
--options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,skip-gcc-check,skip-cleanup" -- "$@")" || die "getopt failed"
-+options="$(getopt -o ha:r:s:c:v:j:t:n:o:de: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,debug,cross-compile:,distro:,skip-gcc-check,skip-cleanup" -- "$@")" || 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,version" -- "$@")" || 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,distro:,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,version" -- "$@")" || die "getopt failed"
eval set -- "$options"
-@@ -485,6 +486,10 @@ while [[ $# -gt 0 ]]; do
- KPATCH_CROSS_COMPILE="$2"
- shift
+@@ -834,6 +835,10 @@ while [[ $# -gt 0 ]]; do
+ -R|--non-replace)
+ KLP_REPLACE=0
;;
+ --distro)
+ DISTRO="$2"
@@ -48,15 +49,14 @@ index 39933fc..c0258a2 100755
--skip-cleanup)
echo "Skipping cleanup"
SKIPCLEANUP=1
-@@ -613,7 +613,7 @@ fi
- # Don't check external file.
+@@ -869,7 +874,7 @@ trace_on
# shellcheck disable=SC1090
- [[ -f "$RELEASE_FILE" ]] && source "$RELEASE_FILE"
--DISTRO="$ID"
-+DISTRO="${DISTRO:-${ID}}"
- if [[ "$DISTRO" = fedora ]] || [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = ol ]] || [[ "$DISTRO" = centos ]]; then
- [[ -z "$VMLINUX" ]] && VMLINUX="/usr/lib/debug/lib/modules/$ARCHVERSION/vmlinux"
- [[ -e "$VMLINUX" ]] || die "kernel-debuginfo-$ARCHVERSION not installed"
+ if [[ -z "$USERSRCDIR" ]] && [[ -f "$RELEASE_FILE" ]]; then
+ source "$RELEASE_FILE"
+- DISTRO="$ID"
++ DISTRO="${DISTRO:-${ID}}"
+ fi
+
+
--
2.7.4
-
similarity index 65%
rename from meta-oe/recipes-kernel/kpatch/kpatch_git.bb
rename to meta-oe/recipes-kernel/kpatch/kpatch_0.9.11.bb
@@ -2,9 +2,6 @@ require kpatch.inc
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
-SRCREV = "0c3c21930895f6582a5c9d9d797f7e11ff41ffb2"
-
-PV = "0.9.1"
-
+SRCREV = "bea635fbbeb11c5f0f5c0d4ffce34c2e9d2e8a6a"
BBCLASSEXTEND = "native nativesdk"
Notable changes since 0.9.1: - Add ARM64 support to kpatch-build (and DYNAMIC_FTRACE_WITH_CALL_OPS handling); cross compiling is enabled through the CROSS_COMPILE and TARGET_ARCH environment variables. - Add -R/--non-replace and --version options; set C standard to gnu11; reject CONFIG_X86_KERNEL_IBT kernels as unsupported. - Support kernel namespaces (.modinfo), the new livepatch stack_order sysfs attribute and gcc 14 sympos handling. - Fix paravirt handling for Linux v6.8+, ppc64le trampolines, s390 PIE flags and out-of-tree module builds. - New distro support (Photon, Anolis, OpenCloudOS, Amazon Linux). Switch from a pinned commit to tag=v${PV} and rename kpatch_git.bb to kpatch_0.9.11.bb. Drop 0001-kpatch-build-add-cross-compilation-support since upstream has native cross compile support now, and refresh 0002-kpatch-build-allow-overriding-of-distro-name for the new option parsing. Add UPSTREAM_CHECK_GITTAGREGEX. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com> --- meta-oe/recipes-kernel/kpatch/kpatch.inc | 5 +- ...-build-add-cross-compilation-support.patch | 105 ------------------ ...uild-allow-overriding-of-distro-name.patch | 48 ++++---- .../{kpatch_git.bb => kpatch_0.9.11.bb} | 5 +- 4 files changed, 28 insertions(+), 135 deletions(-) delete mode 100644 meta-oe/recipes-kernel/kpatch/kpatch/0001-kpatch-build-add-cross-compilation-support.patch rename meta-oe/recipes-kernel/kpatch/{kpatch_git.bb => kpatch_0.9.11.bb} (65%)