From 1e6dbb9e552559957ed3b51064909a98aa3fdaf0 Mon Sep 17 00:00:00 2001 From: Kajetan Puchalski Date: Wed, 16 Aug 2023 11:53:06 +0100 Subject: [PATCH] lisa/_assets/kmodules/lisa: Fix MODULE_SRC definition The $(src) variable contains either the path to the module on its own in out-of-tree builds or the path relative to $(srctree) in in-tree builds. Fix the definition of MODULE_SRC to account for that discrepancy. Signed-off-by: Kajetan Puchalski --- lisa/_assets/kmodules/lisa/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisa/_assets/kmodules/lisa/Makefile b/lisa/_assets/kmodules/lisa/Makefile index cc59b6af8..b10f50bd7 100644 --- a/lisa/_assets/kmodules/lisa/Makefile +++ b/lisa/_assets/kmodules/lisa/Makefile @@ -15,10 +15,18 @@ # limitations under the License. # +# Kbuild ifneq ($(KERNELRELEASE),) - MODULE_SRC ?= $(src) MODULE_OBJ := $(obj) KERNEL_SRC ?= $(srctree) +# Kbuild in-tree build +ifneq ($(srctree),.) + MODULE_SRC ?= $(srctree)/$(src) +# Kbuild out-of-tree build +else + MODULE_SRC ?= $(src) +endif +# non-Kbuild else MODULE_SRC ?= $(PWD) MODULE_OBJ := $(PWD) @@ -124,7 +132,7 @@ $(SYMBOL_NAMESPACES_H): $(MODULE_VERSION_H): echo -n '#ifndef _MODULE_VERSION_H\n#define _MODULE_VERSION_H\n#define LISA_MODULE_VERSION "' > $@ - cat $$(find $(KERNEL_SRC)/$(MODULE_SRC)/ -name '*.*' | sort) | sha1sum | awk '{printf "%s\"\n", $$1}' >> $@ + cat $$(find $(MODULE_SRC)/ -name '*.*' | sort) | sha1sum | awk '{printf "%s\"\n", $$1}' >> $@ echo '#endif' >> $@ # Make all object files depend on the generated sources -- GitLab