diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index 55311d58c..0d7e75604 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -1135,7 +1135,10 @@ for i in $FILES; do find_kobj "$i" cd "$TEMPDIR" || die if [[ -e "orig/$i" ]]; then - if [[ "$(basename "$KOBJFILE")" = vmlinux ]]; then + if cmp -s "orig/$i" "patched/$i"; then + : $i unchanged + continue + elif [[ "$(basename "$KOBJFILE")" = vmlinux ]]; then KOBJFILE_NAME=vmlinux KOBJFILE_PATH="$VMLINUX" SYMTAB="${TEMPDIR}/${KOBJFILE_NAME}.symtab" @@ -1149,14 +1152,17 @@ for i in $FILES; do else KOBJFILE_NAME=$(basename "${KOBJFILE%.ko}") KOBJFILE_NAME="${KOBJFILE_NAME//-/_}" - KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" - SYMTAB="${KOBJFILE_PATH}.symtab" + KOBJFILE_PATH="${BUILDDIR}/$KOBJFILE" + SYMTAB="${TEMPDIR}/module/$KOBJFILE".symtab SYMVERS_FILE="$BUILDDIR/Module.symvers" fi - "$READELF" -s --wide "$KOBJFILE_PATH" > "$SYMTAB" - if [[ "$ARCH" = "ppc64le" ]]; then - sed -ri 's/\s+\[: 8\]//' "$SYMTAB" + if ! [[ "$SYMTAB" -nt "$KOBJFILE_PATH" ]]; then + mkdir -p "${SYMTAB%/*}" + "$READELF" -s --wide "$KOBJFILE_PATH" > "$SYMTAB" + if [[ "$ARCH" = "ppc64le" ]]; then + sed -ri 's/\s+\[: 8\]//' "$SYMTAB" + fi fi # create-diff-object orig.o patched.o parent-name parent-symtab