Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From 4143fa0092fe4cafee10b24a97d3ad0b41ab7a30 Mon Sep 17 00:00:00 2001 |
| 2 | From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> |
| 3 | Date: Wed, 7 Aug 2019 03:24:39 +0900 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 4 | Subject: [PATCH] kpatch-build: allow overriding of distro name |
| 5 | |
| 6 | It is sometimes useful to have ability to override |
| 7 | distro name, for example during cross-compilation |
| 8 | build when livepatch modules will be ran on the |
| 9 | target which differs from host. |
| 10 | |
| 11 | This patch adds a new --distro option which |
| 12 | implements all needed functionality |
| 13 | |
| 14 | Upstream-Status: Pending |
| 15 | |
| 16 | Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com> |
| 17 | --- |
| 18 | kpatch-build/kpatch-build | 9 +++++++-- |
| 19 | 1 file changed, 7 insertions(+), 2 deletions(-) |
| 20 | |
| 21 | diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 22 | index 39933fc..c0258a2 100755 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | --- a/kpatch-build/kpatch-build |
| 24 | +++ b/kpatch-build/kpatch-build |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 25 | @@ -413,12 +413,13 @@ usage() { |
| 26 | echo " specify current version of module" >&2 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | echo " --cross-compile Specify the prefix used for all executables" >&2 |
| 28 | echo " used during compilation" >&2 |
| 29 | + echo " --distro Override distro name" >&2 |
| 30 | echo " --skip-cleanup Skip post-build cleanup" >&2 |
| 31 | echo " --skip-gcc-check Skip gcc version matching check" >&2 |
| 32 | echo " (not recommended)" >&2 |
| 33 | } |
| 34 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 35 | -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" |
| 36 | +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" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 37 | |
| 38 | eval set -- "$options" |
| 39 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 40 | @@ -485,6 +486,10 @@ while [[ $# -gt 0 ]]; do |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 41 | KPATCH_CROSS_COMPILE="$2" |
| 42 | shift |
| 43 | ;; |
| 44 | + --distro) |
| 45 | + DISTRO="$2" |
| 46 | + shift |
| 47 | + ;; |
| 48 | --skip-cleanup) |
| 49 | echo "Skipping cleanup" |
| 50 | SKIPCLEANUP=1 |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 51 | @@ -571,7 +576,7 @@ fi |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 52 | # Don't check external file. |
| 53 | # shellcheck disable=SC1091 |
| 54 | source /etc/os-release |
| 55 | -DISTRO="$ID" |
| 56 | +DISTRO="${DISTRO:-${ID}}" |
| 57 | if [[ "$DISTRO" = fedora ]] || [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = ol ]] || [[ "$DISTRO" = centos ]]; then |
| 58 | [[ -z "$VMLINUX" ]] && VMLINUX="/usr/lib/debug/lib/modules/$ARCHVERSION/vmlinux" |
| 59 | [[ -e "$VMLINUX" ]] || die "kernel-debuginfo-$ARCHVERSION not installed" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 60 | -- |
| 61 | 2.7.4 |
| 62 | |