Michael Bestas | 3952f6c | 2016-08-26 01:12:08 +0300 | [diff] [blame] | 1 | #---------------------------------------------------------------------- |
| 2 | # Generate device tree image (dt.img) |
| 3 | #---------------------------------------------------------------------- |
| 4 | ifeq ($(strip $(BOARD_CUSTOM_BOOTIMG_MK)),) |
| 5 | ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) |
| 6 | ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true) |
| 7 | ifeq ($(strip $(BUILD_TINY_ANDROID)),true) |
| 8 | include device/qcom/common/dtbtool/Android.mk |
| 9 | endif |
| 10 | |
| 11 | ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) |
| 12 | DTBTOOL_NAME := dtbToolCM |
| 13 | else |
| 14 | DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) |
| 15 | endif |
| 16 | |
| 17 | DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) |
| 18 | |
| 19 | INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img |
| 20 | |
| 21 | ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) |
| 22 | # dtbToolCM will search subdirectories |
| 23 | possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ |
| 24 | else |
| 25 | # Most specific paths must come first in possible_dtb_dirs |
| 26 | possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ |
| 27 | endif |
| 28 | |
| 29 | define build-dtimage-target |
| 30 | $(call pretty,"Target dt image: $@") |
| 31 | $(hide) for dir in $(possible_dtb_dirs); do \ |
| 32 | if [ -d "$$dir" ]; then \ |
| 33 | dtb_dir="$$dir"; \ |
| 34 | break; \ |
| 35 | fi; \ |
| 36 | done; \ |
| 37 | $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir"; |
| 38 | $(hide) chmod a+r $@ |
| 39 | endef |
| 40 | |
| 41 | $(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) |
| 42 | $(build-dtimage-target) |
| 43 | @echo "Made DT image: $@" |
| 44 | |
| 45 | ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DTIMAGE_TARGET) |
| 46 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET) |
| 47 | |
| 48 | .PHONY: dtimage |
| 49 | dtimage: $(INSTALLED_DTIMAGE_TARGET) |
| 50 | |
| 51 | endif |
| 52 | endif |
| 53 | endif |