mirror of
https://github.com/dynup/kpatch
synced 2024-12-22 05:10:01 +00:00
b98fafcfb2
Right now, we do three build passes: one to build the original tree (full) build, one to build the patch tree (diff build), then one to rebuild original objects that where changed by the patch (diff build). This is going to be a problem when we try to support (near) full tree rebuilds due to changes in commonly included header files. This commit changes the build process to intercept calls to gcc by make using the CROSS_COMPILE environment variable and, during the patched build phase, copies the original object for any object that is about to rebuilt due to a change. This reduces the number of build passes to the minimum possible (two). Signed-off-by: Seth Jennings <sjenning@redhat.com>
34 lines
693 B
Bash
Executable File
34 lines
693 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
TOOLCHAINCMD="$1"
|
|
shift
|
|
|
|
if [[ "$TOOLCHAINCMD" != "gcc" ]] || [[ -z "$TEMPDIR" ]]; then
|
|
exec "$TOOLCHAINCMD" "$@"
|
|
fi
|
|
|
|
declare -a args=($@)
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
if [ "$1" = "-o" ]; then
|
|
case "$2" in
|
|
*.mod.o|*built-in.o|vmlinux.o|.tmp_kallsyms1.o|.tmp_kallsyms2.o|init/version.o|arch/x86/boot/version.o|arch/x86/boot/compressed/eboot.o|arch/x86/boot/header.o|arch/x86/boot/compressed/efi_stub_64.o|arch/x86/boot/compressed/piggy.o|.*.o)
|
|
break;
|
|
;;
|
|
*.o)
|
|
mkdir -p "$TEMPDIR/orig/$(dirname $2)"
|
|
cp -f "$2" "$TEMPDIR/orig/$2"
|
|
echo "$2" >> "$TEMPDIR/changed_objs"
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
fi
|
|
shift
|
|
done
|
|
|
|
exec "$TOOLCHAINCMD" "${args[@]}"
|