From b1939418f4555a81129fc2a79268ea72fb8bd136 Mon Sep 17 00:00:00 2001 From: Zhixiong Chi Date: Tue, 9 Aug 2022 01:58:52 -0700 Subject: [PATCH] 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 Change-Id: Ia907db30a2398003c52a4f54d5f63060d7db237f --- ...uild-failure-when-the-cache-src-dire.patch | 38 +++++++++++++++++++ livepatch/kpatch/debian/patches/series | 1 + 2 files changed, 39 insertions(+) create mode 100644 livepatch/kpatch/debian/patches/0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch diff --git a/livepatch/kpatch/debian/patches/0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch b/livepatch/kpatch/debian/patches/0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch new file mode 100644 index 000000000..08943e1b3 --- /dev/null +++ b/livepatch/kpatch/debian/patches/0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch @@ -0,0 +1,38 @@ +From 3454f6871ee7a7dd1c04249edf2598f144339440 Mon Sep 17 00:00:00 2001 +From: Zhixiong Chi +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 +--- + 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 + diff --git a/livepatch/kpatch/debian/patches/series b/livepatch/kpatch/debian/patches/series index b3833eb72..67b6a42e0 100644 --- a/livepatch/kpatch/debian/patches/series +++ b/livepatch/kpatch/debian/patches/series @@ -1,3 +1,4 @@ 0001-kpatch-Support-for-WRCP.patch 0002-kpatch-Add-the-signature-for-livepatch-kernel-module.patch 0003-kpatch-Adjust-the-kpatch-build-to-support-the-multik.patch +0004-kpatch-Fix-the-build-failure-when-the-cache-src-dire.patch