[LTP] [PATCH v5 1/2] Makefile: Add kernel modules related make targets
Petr Vorel
pvorel@suse.cz
Fri Aug 15 10:19:41 CEST 2025
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.
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <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..b2cc77463c 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) || exit $$?; \
+)
+modules-clean:
+ @$(foreach dir,$(MODULE_DIRS),\
+ echo "Build $(dir)";\
+ $(MAKE) -C $(abs_srcdir)/$(dir) clean || exit $$?; \
+)
+modules-install: modules
+ @$(foreach dir,$(MODULE_DIRS),\
+ echo "Build $(dir)";\
+ $(MAKE) -C $(abs_srcdir)/$(dir) install || exit $$?; \
+)
+
## Help
.PHONY: help
help:
--
2.50.1
More information about the ltp
mailing list