From a907d450a71acb4d2c543c70b9a706bbc894b14c Mon Sep 17 00:00:00 2001 From: Joe Lawrence Date: Thu, 16 Jan 2025 16:09:48 -0500 Subject: [PATCH] kmod: fix OOT kpatch kmod build Starting from linux commit 13b25489b6f8 ("kbuild: change working directory to external module directory with M="), the kpatch-build fails: make -C /root/linux M=/root/.kpatch/tmp/patch CFLAGS_MODULE='' make[1]: Entering directory '/root/linux' make[2]: Entering directory '/root/.kpatch/tmp/patch' LDS kpatch.lds make -C /root/linux M=/root/.kpatch/tmp/patch CFLAGS_MODULE='' patch-hook.o *** *** The external module source tree is not clean. *** Please run 'make -C /root/linux M=/root/linux clean' *** The easiest and quickest way to fix the build is to remove the $(KPATCH_MAKE) patch-hook.o in Makefile. Unfortunately this would mean make `patch-hook.o` cannot be performed directly. However the Makefile still lists patch-hook.o's source dependencies, so if any are updated, the kpatch module would be rebuilt anyway. Thanks for Sumanth Korikkar for reporting, debugging, and suggesting this workaround. Closes: #1430 ("kpatch-build fails: unable to locate patch-hook.o since linux commit 13b25489b6f8") Reported-by: Sumanth Korikkar Signed-off-by: Joe Lawrence --- kmod/patch/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/kmod/patch/Makefile b/kmod/patch/Makefile index bb4d49c01..5397da726 100644 --- a/kmod/patch/Makefile +++ b/kmod/patch/Makefile @@ -19,7 +19,6 @@ $(KPATCH_NAME).ko: $(obj)/$(KPATCH_NAME).o: $(src)/kpatch.lds patch-hook.o: patch-hook.c kpatch-patch-hook.c livepatch-patch-hook.c - $(KPATCH_MAKE) patch-hook.o clean: $(RM) -Rf .*.o.cmd .*.ko.cmd .tmp_versions $(BUILDABLE_OBJS) *.ko *.mod.c \