From 72b5f3b4fb5cdbf37d86b2facb5c6f2bd001a00f Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Thu, 13 Mar 2014 12:04:08 -0500 Subject: [PATCH] try source patch before compiling kernel Add a patch testing step before compiling the kernel, so that users don't have to wait for the kernel to compile before seeing if the patch applies cleanly. Also allow the printing of the patch command's stdout/stderr to make it clear what files are being patched and whether there's any fuzz. --- kpatch-build/kpatch-build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index 41a332e..9fd2e16 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -172,16 +172,19 @@ else echo "$LOCALVERSION" > "$SRCDIR/localversion" || die fi -echo "Building original kernel" +echo "Testing patch file" cd "$SRCDIR" || die +cp "$PATCHFILE" "$APPLIEDPATCHFILE" || die +patch -p1 < "$APPLIEDPATCHFILE" || die "source patch file failed to apply" +patch -p1 -R < "$APPLIEDPATCHFILE" &> /dev/null || die "reverse patch apply failed" + +echo "Building original kernel" make mrproper >> "$LOGFILE" 2>&1 || die make "-j$CPUS" vmlinux "O=$OBJDIR" >> "$LOGFILE" 2>&1 || die - cp -LR "$DATADIR/patch" "$TEMPDIR" || die cp "$OBJDIR/vmlinux" "$TEMPDIR" || die echo "Building patched kernel" -cp "$PATCHFILE" "$APPLIEDPATCHFILE" || die patch -p1 < "$APPLIEDPATCHFILE" >> "$LOGFILE" 2>&1 || die make "-j$CPUS" vmlinux "O=$OBJDIR" > "$TEMPDIR/patched_build.log" 2>&1 || die