All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 1/2] Makefile: Add kernel modules related make targets
@ 2025-08-06 21:14 Petr Vorel
  2025-08-06 21:14 ` [LTP] [PATCH v3 2/2] modules.mk: Add FORCE_MODULES=1 to fail on error Petr Vorel
  2025-08-06 23:22 ` [LTP] [PATCH v3 1/2] Makefile: Add kernel modules related make targets Li Wang via ltp
  0 siblings, 2 replies; 8+ messages in thread
From: Petr Vorel @ 2025-08-06 21:14 UTC (permalink / raw)
  To: ltp; +Cc: Ricardo B . Marlière

LTP contains few kernel modules and tests which are using them.  These
require to be built with the same kernel headers as the running kernel
(SUT). Sometimes the best way to achieve this is to compile them on the
SUT.

Add 'modules', 'modules-clean' and 'modules-install' make targets to
make it easier to build them.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v2->v3:
* Automatic detection (Li), note: without 'sort -u' as there should be
  single Makefile in directory.

Link to v2:
https://patchwork.ozlabs.org/project/ltp/patch/20250801100935.974351-1-pvorel@suse.cz/
https://lore.kernel.org/ltp/20250801100935.974351-1-pvorel@suse.cz/

 INSTALL  | 10 ++++++++++
 Makefile | 21 +++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/INSTALL b/INSTALL
index cbe27f32ea..10c19d4105 100644
--- a/INSTALL
+++ b/INSTALL
@@ -165,6 +165,16 @@ PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./c
 * Arch Linux
 PKG_CONFIG_LIBDIR=/usr/lib32/pkgconfig CFLAGS=-m32 LDFLAGS=-m32 ./configure
 
+Kernel modules
+--------------
+
+LTP contains few kernel modules and tests which are using them.
+These require to be built with the same kernel headers as the running kernel (SUT).
+Sometimes the best way to achieve this is to compile them on the SUT.
+
+'modules', 'modules-clean' and 'modules-install' make targets are shortcuts
+to build just these modules and tests.
+
 Android Users
 -------------
 
diff --git a/Makefile b/Makefile
index eab40da8a6..cdad8b10ce 100644
--- a/Makefile
+++ b/Makefile
@@ -212,6 +212,27 @@ endif
 test-metadata: metadata-all
 	$(MAKE) -C $(abs_srcdir)/metadata test
 
+MODULE_DIRS :=  $(shell \
+	dirname $$(grep -l 'include.*module\.mk' $$(find testcases/ -type f -name 'Makefile')))
+
+
+.PHONY: modules modules-clean modules-install
+modules:
+	@$(foreach dir,$(MODULE_DIRS),\
+		echo "Build $(dir)";\
+		$(MAKE) -C $(abs_srcdir)/$(dir); \
+)
+modules-clean:
+	@$(foreach dir,$(MODULE_DIRS),\
+		echo "Build $(dir)";\
+		$(MAKE) -C $(abs_srcdir)/$(dir) clean; \
+)
+modules-install: modules
+	@$(foreach dir,$(MODULE_DIRS),\
+		echo "Build $(dir)";\
+		$(MAKE) -C $(abs_srcdir)/$(dir) install; \
+)
+
 ## Help
 .PHONY: help
 help:
-- 
2.50.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-08-07  7:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 21:14 [LTP] [PATCH v3 1/2] Makefile: Add kernel modules related make targets Petr Vorel
2025-08-06 21:14 ` [LTP] [PATCH v3 2/2] modules.mk: Add FORCE_MODULES=1 to fail on error Petr Vorel
2025-08-07  3:37   ` Li Wang via ltp
2025-08-07  6:17     ` Petr Vorel
2025-08-06 23:22 ` [LTP] [PATCH v3 1/2] Makefile: Add kernel modules related make targets Li Wang via ltp
2025-08-07  2:15   ` Li Wang via ltp
2025-08-07  5:11     ` Petr Vorel
2025-08-07  7:56       ` Li Wang via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.