mirror of
https://github.com/dynup/kpatch
synced 2025-02-26 23:10:54 +00:00
kpatch-gcc: for module patches, copy module to temp dir
For patches involving modules, copy the original module(s) to TEMPDIR so that create-diff-object can create the correct lookup tables
This commit is contained in:
parent
6175658196
commit
09c39932b1
@ -475,7 +475,7 @@ for i in $FILES; do
|
|||||||
if [[ $KOBJFILE = vmlinux ]]; then
|
if [[ $KOBJFILE = vmlinux ]]; then
|
||||||
KOBJFILE=$VMLINUX
|
KOBJFILE=$VMLINUX
|
||||||
else
|
else
|
||||||
KOBJFILE="$(readlink -f $KOBJFILE)"
|
KOBJFILE="$TEMPDIR/module/$KOBJFILE"
|
||||||
fi
|
fi
|
||||||
cd $TEMPDIR
|
cd $TEMPDIR
|
||||||
debugopt=
|
debugopt=
|
||||||
|
@ -5,13 +5,14 @@ set -x
|
|||||||
TOOLCHAINCMD="$1"
|
TOOLCHAINCMD="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [[ "$TOOLCHAINCMD" != "gcc" ]] || [[ -z "$TEMPDIR" ]]; then
|
if [[ -z "$TEMPDIR" ]]; then
|
||||||
exec "$TOOLCHAINCMD" "$@"
|
exec "$TOOLCHAINCMD" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -a args=("$@")
|
declare -a args=("$@")
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]; do
|
if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
if [ "$1" = "-o" ]; then
|
if [ "$1" = "-o" ]; then
|
||||||
obj=$2
|
obj=$2
|
||||||
[[ $2 = */.tmp_*.o ]] && obj=${2/.tmp_/}
|
[[ $2 = */.tmp_*.o ]] && obj=${2/.tmp_/}
|
||||||
@ -44,6 +45,24 @@ while [ "$#" -gt 0 ]; do
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
elif [[ "$TOOLCHAINCMD" = "ld" ]] ; then
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
if [ "$1" = "-o" ]; then
|
||||||
|
obj=$2
|
||||||
|
case "$obj" in
|
||||||
|
*.ko)
|
||||||
|
mkdir -p "$TEMPDIR/module/$(dirname $obj)"
|
||||||
|
cp -f "$obj" "$TEMPDIR/module/$obj"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$TOOLCHAINCMD" "${args[@]}"
|
exec "$TOOLCHAINCMD" "${args[@]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user