[LTP] [PATCH v2 1/1] Makefile: Add kernel modules related make targets

Li Wang liwang@redhat.com
Sat Aug 2 05:25:57 CEST 2025


On Fri, Aug 1, 2025 at 6:09 PM Petr Vorel <pvorel@suse.cz> wrote:

> 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>
> ---
> Hi,
>
> I'm sorry for the noise.
>
> Most of the people will need just modules-install, but let's be
> consistent with other LTP make targets.
>
> Kind regards,
> Petr
>
> 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.
>
> v1:
> https://lore.kernel.org/ltp/20250801094205.965645-1-pvorel@suse.cz/
>
> https://patchwork.ozlabs.org/project/ltp/patch/20250801094205.965645-1-pvorel@suse.cz/
>
>  INSTALL  | 10 ++++++++++
>  Makefile | 24 ++++++++++++++++++++++++
>  2 files changed, 34 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..933e33ca75 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -212,6 +212,30 @@ endif
>  test-metadata: metadata-all
>         $(MAKE) -C $(abs_srcdir)/metadata test
>
> +MODULE_DIRS := commands/insmod \
>

Here should be:

-MODULE_DIRS := commands/insmod \
+MODULE_DIRS := testcases/commands/insmod \



> +       testcases/kernel/firmware \
> +       testcases/kernel/device-drivers \
> +       testcases/kernel/syscalls/delete_module \
> +       testcases/kernel/syscalls/finit_module \
> +       testcases/kernel/syscalls/init_module
> +
> +.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
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list