[PATCH 13/13] kbuild: fix single target build for external module

Ilias Apalodimas ilias.apalodimas at linaro.org
Sat May 31 10:44:41 CEST 2025


Backported from kernel
commit e07db28eea38 ("kbuild: fix single target build for external module")

It's worth noting that crmodverdir is empty for U-Boot.
Just backport it to make diffing easier

Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index dbf1edc39ac4..9b4b686d9467 100644
--- a/Makefile
+++ b/Makefile
@@ -230,6 +230,9 @@ ifeq ($(KBUILD_EXTMOD),)
 _all: all
 else
 _all: modules
+PHONY += prepare
+prepare:
+	$(cmd_crmodverdir)
 endif
 
 ifeq ($(KBUILD_SRC),)
@@ -2503,15 +2506,12 @@ endif
 
 # Modules
 /: prepare FORCE
-	$(cmd_crmodverdir)
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
 	$(build)=$(build-dir)
 %/: prepare FORCE
-	$(cmd_crmodverdir)
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
 	$(build)=$(build-dir)
 %.ko: prepare FORCE
-	$(cmd_crmodverdir)
 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
 	$(build)=$(build-dir) $(@:.ko=.o)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-- 
2.49.0



More information about the U-Boot mailing list