| # SPDX-License-Identifier: GPL-2.0 | |
| # for the include dt-bindings header files in the kernel_device_modules-X.Y | |
| # common, for include/dt-bindings | |
| DTC_INCLUDE += $(DEVICE_MODULES_PATH)/include | |
| # arm64 | |
| DTC_INCLUDE += $(DEVICE_MODULES_PATH)/arch/$(SRCARCH)/boot/dts $(DEVICE_MODULES_PATH)/arch/$(SRCARCH)/boot/dts/mediatek | |
| # for cust.dtsi | |
| #DTC_INCLUDE += $(DEVICE_MODULES_REL_PATH)/arch/$(SRCARCH)/boot/dts | |
| DTC_INCLUDE += $(dir $(src)) | |
| # for devicetree overlay | |
| DTC_FLAGS += -@ | |
| mt8696_dtb := \ | |
| mt8696.dtb | |
| project_overlays := \ | |
| kirkwood_dongle.dtbo \ | |
| kirkwood_dongle-p0.dtbo \ | |
| kirkwood.dtbo \ | |
| kirkwoodpro.dtbo \ | |
| # Usage: | |
| # $(call DTBS_overlay_template, overlay, base_dtb, suffix) | |
| # | |
| # This is a generic template to create the following construct: | |
| # <overlay>-<suffix>-dtbs := <base_dtb>.dtb <overlay>.dtbo | |
| define DTBS_overlay_template | |
| $(1:%.dtbo=%-$(strip $3)-dtbs) := $2 $1 | |
| endef | |
| # Usage: | |
| # $(call DTB_object_template, CONFIG_, overlay, suffix) | |
| # | |
| # This is a generic template to create the following construct: | |
| # dtb-$(CONFIG_) += <overlay>-<suffix>.dtb | |
| define DTB_object_template | |
| dtb-$(strip $1) += $(2:%.dtbo=%-$(strip $3).dtb) | |
| endef | |
| # Usage: | |
| # $(call multi_dtbs_overlay, list_of_base_dtbs, list_of_overlays, CONFIG_) | |
| # | |
| # For each (base_dtb,overlay) pair, this will create the following constructs: | |
| # <overlay>-<base_dtb>-dtbs := <base_dtb>.dtb <overlay>.dtbo | |
| # dtb-$(CONFIG_) += <overlay>-<base_dtb>.dtb | |
| define multi_dtbs_overlay | |
| $(foreach base, $1, \ | |
| $(foreach overlay, $2, \ | |
| $(eval $(call DTBS_overlay_template, $(overlay), $(base), $(notdir $(base:%.dtb=%)))) \ | |
| $(eval $(call DTB_object_template, $3, $(overlay), $(notdir $(base:%.dtb=%)))))) | |
| endef | |
| # Create the -dtbs and dtb-y constructs. We can do this by looping through the | |
| # base dtbs and apply each overlay to it. Kbuild will use these -dtbs | |
| # constructs to determine which dtbs are the base dtbs and which are the | |
| # overlays. For the base dtbs, kbuild will expose the symbols as needed for the | |
| # overlays. Additionally, kbuild will statically apply the overlay to the base | |
| # dtb which could be used to verify the overlay applies cleanly. | |
| $(call multi_dtbs_overlay, $(mt8696_dtb), $(project_overlays), y) |