From d1baefc1d1fa8dfdc02b6bc943c90cd1c3c7b31c Mon Sep 17 00:00:00 2001 From: Yongde Zhang Date: Fri, 2 Aug 2024 10:51:19 +0800 Subject: [PATCH] kpatch-build: add kpatch-build version print If kpatch-build is install into system, we may have difficulty in finding its version. Introduce an option of showing the version of kpatch-build. Anolis kpatch-build have its own version and base version from the upstream. Signed-off-by: Yongde Zhang --- .../0016-Add-kpatch-build-kernel-show.patch | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 patches/0016-Add-kpatch-build-kernel-show.patch diff --git a/patches/0016-Add-kpatch-build-kernel-show.patch b/patches/0016-Add-kpatch-build-kernel-show.patch new file mode 100644 index 0000000..2dfcd07 --- /dev/null +++ b/patches/0016-Add-kpatch-build-kernel-show.patch @@ -0,0 +1,54 @@ +From 9c71f3915e406c262783c12f492bc2d77ab77a2d Mon Sep 17 00:00:00 2001 +From: Yongde Zhang +Date: Thu, 1 Aug 2024 23:16:45 +0800 +Subject: [PATCH] Add kpatch-build kernel show + + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index b515e4d..2c55156 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -33,6 +33,8 @@ + # - Builds the patched kernel/module and monitors changed objects + # - Builds the patched objects with gcc flags -f[function|data]-sections + # - Runs kpatch tools to create and link the patch kernel module ++VERSION=1.0.0-1 ++BASE_VERSION=0.9.9 + + set -o pipefail + +@@ -59,6 +61,7 @@ OOT_MODULE= + KLP_REPLACE=0 + USE_KLP=1 + ++ + GCC="${CROSS_COMPILE:-}gcc" + CLANG="${CROSS_COMPILE:-}clang" + LD="${CROSS_COMPILE:-}ld" +@@ -756,9 +759,10 @@ usage() { + echo " --skip-cleanup Skip post-build cleanup" >&2 + echo " --skip-compiler-check Skip compiler version matching check" >&2 + echo " (not recommended)" >&2 ++ echo " --version Version of Anolis kpatch-build" >&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,use-kpatch-module" -- "$@")" || 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,version" -- "$@")" || die "getopt failed" + + eval set -- "$options" + +@@ -844,6 +848,11 @@ while [[ $# -gt 0 ]]; do + echo "use kpatch core module" + USE_KLP=0 + ;; ++ --version) ++ echo "Version of Anolis kpatch-build : $VERSION" ++ echo "Base Version : $BASE_VERSION" ++ exit 0 ++ ;; + *) + [[ "$1" = "--" ]] && shift && continue + [[ ! -f "$1" ]] && die "patch file '$1' not found" +-- +2.18.2 + -- Gitee