extra-y target doesn't build for 'make M=...' since commit 6212804f2d78 ("kbuild: do not create built-in objects for external module builds"). This especially breaks kpatch, which is using 'extra-y := kpatch.lds' and 'make M=...' to build livepatch patch module. Add extra-y to targets-for-modules so that such kind of build works properly. Signed-off-by: WANG Chao <chao.wang@xxxxxxxxx> --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ae647379b579..0113a042d643 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -86,7 +86,7 @@ ifdef need-builtin targets-for-builtin += $(obj)/built-in.a endif -targets-for-modules := $(patsubst %.o, %.mod, $(filter %.o, $(obj-m))) +targets-for-modules := $(extra-y) $(patsubst %.o, %.mod, $(filter %.o, $(obj-m))) ifdef need-modorder targets-for-modules += $(obj)/modules.order -- 2.29.1