diff --git a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
index bc4e09cb..7511a17d 100755
--- a/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
+++ b/meta/recipes-kernel/linux-module/files/debian/rules.tmpl
@@ -49,7 +49,7 @@ override_dh_auto_clean:
 	$(MAKE) -C $(KDIR) M=${MODULE_DIR} clean
 
 override_dh_auto_build:
-	$(MAKE) -C $(KDIR) M=${MODULE_DIR} $(PARALLEL_MAKE) modules
+	$(MAKE) -C $(KDIR) M=${MODULE_DIR} $(PARALLEL_MAKE) KCFLAGS="${KCFLAGS}" KAFLAGS="${KAFLAGS}" modules
 ifneq ($(filter pkg.sign,$(DEB_BUILD_PROFILES)),)
 	find . -name "*.ko" -print -exec $(KDIR)/scripts/sign-file ${SIGNATURE_HASHFN} ${SIGNATURE_KEYFILE} ${SIGNATURE_CERTFILE} {} \;
 endif
diff --git a/meta/recipes-kernel/linux-module/module.inc b/meta/recipes-kernel/linux-module/module.inc
index 229e6a5c..344dc50f 100644
--- a/meta/recipes-kernel/linux-module/module.inc
+++ b/meta/recipes-kernel/linux-module/module.inc
@@ -48,6 +48,8 @@ TEMPLATE_VARS += " \
     KERNEL_TYPE \
     KERNEL_IMAGE_PKG \
     KERNEL_HEADERS_PKG \
+    KCFLAGS \
+    KAFLAGS \
     MODULE_DIR \
     DEBIAN_BUILD_DEPENDS \
     SIGNATURE_KEYFILE \
@@ -55,6 +57,10 @@ TEMPLATE_VARS += " \
     SIGNATURE_HASHFN \
     PN"
 
+# Add custom cflags to the kernel build
+KCFLAGS ?= "-fdebug-prefix-map=${CURDIR}=. -fmacro-prefix-map=${CURDIR}=."
+KAFLAGS ?= "-fdebug-prefix-map=${CURDIR}=."
+
 do_prepare_build() {
     rm -rf ${S}/debian
     cp -r ${WORKDIR}/debian ${S}/
