Debian: kpatch: Correct CONFIGFILE when cache src dir is used

Make sure the CONFIGFILE variable is correct for the build when the
cache src directory is used.
Fix the build failure of kpatch-prebuilt once the actual livepatch
is added.

TestPlan:
Add the actual livepatch example patch, then build kpatch-prebuilt.
PASS: build-pkgs -c -p kpatch
PASS: build-pkgs -c -p kpatch-prebuilt -b rt,std

Story: 2009221
Task: 44580

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
Change-Id: Ia907db30a2398003c52a4f54d5f63060d7db237f
This commit is contained in:
Zhixiong Chi 2022-08-09 01:58:52 -07:00
parent 5136501e29
commit b1939418f4
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 3454f6871ee7a7dd1c04249edf2598f144339440 Mon Sep 17 00:00:00 2001
From: Zhixiong Chi <zhixiong.chi@windriver.com>
Date: Tue, 9 Aug 2022 01:45:28 -0700
Subject: [PATCH] kpatch: Fix build failure when cache src directory is used
When the -c option is used (eg: kpatch-prebuilt) for building more
than one livepatch issue, the download linux source step will be
skipped and cache src directory will be used.
We correct the CONFIGFILE variable after the file is copied.
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
---
kpatch-build/kpatch-build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build
index eb8a1e0..9da45d1 100755
--- a/kpatch-build/kpatch-build
+++ b/kpatch-build/kpatch-build
@@ -851,10 +851,11 @@ else
fi
fi
-[[ -z "$CONFIGFILE" ]] && CONFIGFILE="$SRCDIR"/.config
-[[ ! -e "$CONFIGFILE" ]] && die "can't find config file"
-if [[ ! "$CONFIGFILE" -ef "$SRCDIR"/.config ]] ; then
- cp -f "$CONFIGFILE" "$SRCDIR/.config" || die
+[[ -z "${CONFIGFILE}" ]] && CONFIGFILE="${SRCDIR}"/.config
+[[ ! -e "${CONFIGFILE}" ]] && die "Can't find config file ${CONFIGFILE}"
+if [[ ! "${CONFIGFILE}" -ef "${SRCDIR}"/.config ]] ; then
+ cp -f "${CONFIGFILE}" "${SRCDIR}/.config" || die "Copy ${CONFIGFILE} failed"
+ CONFIGFILE="${SRCDIR}/.config"
fi
# kernel option checking
--
2.34.1

View File

@ -1,3 +1,4 @@
0001-kpatch-Support-for-WRCP.patch 0001-kpatch-Support-for-WRCP.patch
0002-kpatch-Add-the-signature-for-livepatch-kernel-module.patch 0002-kpatch-Add-the-signature-for-livepatch-kernel-module.patch
0003-kpatch-Adjust-the-kpatch-build-to-support-the-multik.patch 0003-kpatch-Adjust-the-kpatch-build-to-support-the-multik.patch
0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch