kernel: Add support for custom dtbimage generation rules

Change-Id: I79d67f9f40ef3f0970d0e29393d00600b57e337b
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 1cd4dce..8b82b97 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -48,6 +48,8 @@
 #
 #   BOARD_DTBO_CFG                     = Path to a mkdtboimg.py config file
 #
+#   BOARD_CUSTOM_DTBIMG_MK             = Path to a custom dtbimage makefile
+#
 #   BOARD_CUSTOM_DTBOIMG_MK            = Path to a custom dtboimage makefile
 #
 #   KERNEL_CC                          = The C Compiler used. This is automatically set based
@@ -499,6 +501,9 @@
 endif # TARGET_NEEDS_DTBOIMAGE/BOARD_KERNEL_SEPARATED_DTBO
 
 ifeq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
+ifneq ($(BOARD_CUSTOM_DTBIMG_MK),)
+include $(BOARD_CUSTOM_DTBIMG_MK)
+else
 ifeq ($(BOARD_PREBUILT_DTBIMAGE_DIR),)
 $(DTB_OUT):
 	mkdir -p $(DTB_OUT)
@@ -525,6 +530,7 @@
 endif # !TARGET_WANTS_EMPTY_DTB
 
 endif # !BOARD_PREBUILT_DTBIMAGE_DIR
+endif # BOARD_CUSTOM_DTBIMG_MK
 endif # BOARD_INCLUDE_DTB_IN_BOOTIMG
 
 endif # FULL_KERNEL_BUILD