Skip to content

Commit d2c72f2

Browse files
Zhou Chengmingjoe-lawrence
authored andcommitted
compile original module for create-diff-object
Normally, the symbols in the freshly built object file that create-diff-object used are the same with our original module. But the name of the symbols may change if use --skip-gcc-check or the influence of KCFLAGS. This patch compile original module for create-diff-object, like original vmlinux, to detect this problem earlier, before we need to insmod klp.ko. Signed-off-by: Zhou Chengming <zhouchengming1@_huawei.xyz_>
1 parent aac3690 commit d2c72f2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kpatch-build/kpatch-build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ do
532532
cp -f "$OBJDIR/$i" "$TEMPDIR/patched/$i" || die
533533
done
534534

535+
unset KCFLAGS
535536
echo "Extracting new and modified ELF sections"
536537
FILES="$(cat "$TEMPDIR/changed_objs")"
537538
cd "$TEMPDIR"
@@ -552,6 +553,13 @@ for i in $FILES; do
552553
if [[ $KOBJFILE = vmlinux ]]; then
553554
KOBJFILE=$VMLINUX
554555
else
556+
cd "$SRCDIR"
557+
patch -p1 -R -d "$SRCDIR" < "$SRCDIR/$APPLIEDPATCHFILE" &> /dev/null
558+
make "-j$CPUS" $KOBJFILE "O=$OBJDIR" >> "$LOGFILE" 2>&1 || die
559+
cd "$OBJDIR"
560+
561+
# pass original module to create-diff-object
562+
cp -f "$KOBJFILE" "$TEMPDIR/module/$KOBJFILE" || die
555563
KOBJFILE="$TEMPDIR/module/$KOBJFILE"
556564
fi
557565
cd $TEMPDIR

0 commit comments

Comments
 (0)