diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 9d1fa540..bea12871 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -560,3 +560,9 @@ Default value is '-I' which sets filter to:
 Use `IMAGER_INSTALL:wic` instead of `WIC_IMAGER_INSTALL`. The latter is still
 supported, but a warning is issued when it is used. Future versions will drop
 `WIC_IMAGER_INSTALL` completely.
+
+### Add MODULE_DIR to decouple sources dir from modules dir in custom-module
+
+When building a custom kernel module, the `KBuild` file might be located in
+a subdirectory. To support this use-case, set `MODULE_DIR=$(PWD)/subdir` in
+the module build recipe.
diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
index 7d950e38..bc4e09cb 100755
--- a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -46,16 +46,16 @@ KDIR := $(shell dpkg -L $(KERNEL_DEP) | grep "/lib/modules/.*/build")
 endif
 
 override_dh_auto_clean:
-	$(MAKE) -C $(KDIR) M=$(PWD) clean
+	$(MAKE) -C $(KDIR) M=${MODULE_DIR} clean
 
 override_dh_auto_build:
-	$(MAKE) -C $(KDIR) M=$(PWD) $(PARALLEL_MAKE) modules
+	$(MAKE) -C $(KDIR) M=${MODULE_DIR} $(PARALLEL_MAKE) modules
 ifneq ($(filter pkg.sign,$(DEB_BUILD_PROFILES)),)
 	find . -name "*.ko" -print -exec $(KDIR)/scripts/sign-file ${SIGNATURE_HASHFN} ${SIGNATURE_KEYFILE} ${SIGNATURE_CERTFILE} {} \;
 endif
 
 override_dh_auto_install:
-	$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
+	$(MAKE) -C $(KDIR) M=${MODULE_DIR} INSTALL_MOD_PATH=$(PWD)/debian/${PN} modules_install
 
 %:
 	CFLAGS= LDFLAGS= dh $@
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 333c66bc..269da6ae 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -10,6 +10,8 @@ FILESPATH:append := ":${FILE_DIRNAME}/files"
 DESCRIPTION ?= "Custom kernel module ${PN}"
 
 KERNEL_NAME ?= ""
+# directory with KBuild file (M=${MODULE_DIR})
+MODULE_DIR ?= "$(PWD)"
 
 PN .= "-${KERNEL_NAME}"
 
@@ -36,6 +38,7 @@ TEMPLATE_VARS += " \
     KERNEL_TYPE \
     KERNEL_IMAGE_PKG \
     KERNEL_HEADERS_PKG \
+    MODULE_DIR \
     DEBIAN_BUILD_DEPENDS \
     SIGNATURE_KEYFILE \
     SIGNATURE_CERTFILE \
