diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index a57dd77..7b4025b 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -495,12 +495,14 @@ done echo "Building original kernel" ./scripts/setlocalversion --save-scmversion || die make mrproper >> "$LOGFILE" 2>&1 || die +unset KPATCH_GCC_TEMPDIR CROSS_COMPILE="$TOOLSDIR/kpatch-gcc " make "-j$CPUS" $TARGETS "O=$OBJDIR" >> "$LOGFILE" 2>&1 || die echo "Building patched kernel" patch -N -p1 < "$APPLIEDPATCHFILE" >> "$LOGFILE" 2>&1 || die mkdir -p "$TEMPDIR/orig" "$TEMPDIR/patched" -export TEMPDIR +KPATCH_GCC_TEMPDIR=$TEMPDIR +export KPATCH_GCC_TEMPDIR # TODO: remove custom LDFLAGS and ugly "undefined reference" grep when core # module gets moved to the kernel tree CROSS_COMPILE="$TOOLSDIR/kpatch-gcc " \ diff --git a/kpatch-build/kpatch-gcc b/kpatch-build/kpatch-gcc index 9e42275..ab01040 100755 --- a/kpatch-build/kpatch-gcc +++ b/kpatch-build/kpatch-gcc @@ -5,7 +5,7 @@ set -x TOOLCHAINCMD="$1" shift -if [[ -z "$TEMPDIR" ]]; then +if [[ -z "$KPATCH_GCC_TEMPDIR" ]]; then exec "$TOOLCHAINCMD" "$@" fi @@ -36,9 +36,9 @@ if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then break ;; *.o) - mkdir -p "$TEMPDIR/orig/$(dirname $obj)" - [[ -e $obj ]] && cp -f "$obj" "$TEMPDIR/orig/$obj" - echo "$obj" >> "$TEMPDIR/changed_objs" + mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname $obj)" + [[ -e $obj ]] && cp -f "$obj" "$KPATCH_GCC_TEMPDIR/orig/$obj" + echo "$obj" >> "$KPATCH_GCC_TEMPDIR/changed_objs" break ;; *) @@ -54,8 +54,8 @@ elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then obj=$2 case "$obj" in *.ko) - mkdir -p "$TEMPDIR/module/$(dirname $obj)" - cp -f "$obj" "$TEMPDIR/module/$obj" + mkdir -p "$KPATCH_GCC_TEMPDIR/module/$(dirname $obj)" + cp -f "$obj" "$KPATCH_GCC_TEMPDIR/module/$obj" break ;; *)