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.
This commit is contained in:
Josh Poimboeuf 2014-03-13 12:04:08 -05:00
parent a611185dce
commit 72b5f3b4fb

View File

@ -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