[LTP] [PATCH v2 1/1] Makefile: Add kernel modules related make targets
Petr Vorel
pvorel@suse.cz
Fri Aug 1 12:20:47 CEST 2025
Hi,
> Changes v1->v2:
> * Add also modules-clean and modules-install
> This is needed as 'make modules clean' or 'make modules install'
> would be running 2 separate targets.
Also, I wondered about fail when kernel modules aren't build:
include/mk/module.mk contains:
ifeq ($(WITH_MODULES),no)
SKIP := 1
else
ifeq ($(LINUX_VERSION_MAJOR)$(LINUX_VERSION_PATCH),)
SKIP := 1
else
SKIP ?= $(shell \
[ "$(LINUX_VERSION_MAJOR)" -gt "$(REQ_VERSION_MAJOR)" ] || \
[ "$(LINUX_VERSION_MAJOR)" -eq "$(REQ_VERSION_MAJOR)" -a \
"$(LINUX_VERSION_PATCH)" -ge "$(REQ_VERSION_PATCH)" ]; echo $$?)
endif
endif
ifneq ($(SKIP),0)
MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS))
endif
# Ignoring the exit status of commands is done to be forward compatible with
# kernel internal API changes. The user-space test will return TCONF, if it
# doesn't find the module (i.e. it wasn't built either due to kernel-devel
# missing or module build failure).
%.ko: %.c .dep_modules ;
-----
We could allow to fail build with:
$ make modules FORCE=1
with these changes to include/mk/module.mk:
ifneq ($(SKIP),0)
MAKE_TARGETS := $(filter-out %.ko, $(MAKE_TARGETS))
ifeq ($(FORCE),1)
$(error Modules not built)
endif
endif
ifneq ($(FORCE),1)
%.ko: %.c .dep_modules ;
endif
Kind regards,
Petr
More information about the ltp
mailing list