From 739af47623d3e61ab65262497eb18484280430e1 Mon Sep 17 00:00:00 2001 From: Luca Stefani Date: Sat, 31 Oct 2015 04:50:20 -0700 Subject: [PATCH] build: create dt.img task * Remove dt.img creation from generate_extra_images Change-Id: I676b588cd9acb671771acda638abefee036f0519 build: Don't load dt.img task if custom mkbootimg is used Change-Id: I7617554a8dc6f44ea0c6a713d834da4fe558caec core: Account for prebuilt DT images Change-Id: I52b49fd3e9fc0cb196372e3249c7e3d8b888cdd1 dt_image: Fix build error build/core/tasks/dt_image.mk:38: *** missing `endif'. Stop. Change-Id: If333d378e091ff9d333729dc8a75323966954194 build: only specify least specific directory to dtbtool New kernels (3.18) place dtb files into the qcom subdirectory, but older kernels simply create a qcom subdirectory and place the dtb files at the same level in the heirarchy. Rather than looking for the first directory that exists, dtbtool has been modified to search all subdirectories for dtb files, and therefore we have to remove the specific subdirectories. Change-Id: I82e948c0a20605f051a60fdfaae9679e1fa6555e core: tasks: Use KERNEL_ARCH in dt_image task * KERNEL_ARCH equals to TARGET_ARCH or TARGET_KERNEL_ARCH if specified Change-Id: I906e04fd646467ce70da92cb047f0fa0a6ebdb94 build: Use compatibility DTB directory path for custom DTB tool builds * dtbToolCM is able to search subdirectories, but we are not guaranteed that other dtbTool binaries have the same capability. Re-specify multiple paths for non-dtbToolCM builds just in case. Change-Id: Id69e000af5eba60a07662b178cb95950451efd17 build: Add dt.img and kernel target Change-Id: I4a266d8bd2b01ec4ec696f10f0cc7e912f25a38a dt_image: Rename target Change-Id: I2fbe952b55296b6e1a533d071c769788ab3f14ae Signed-off-by: Brandon McAnsh --- core/generate_extra_images.mk | 36 -------------------------------- core/tasks/dt_image.mk | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 core/tasks/dt_image.mk diff --git a/core/generate_extra_images.mk b/core/generate_extra_images.mk index e46481646..f7fb0c504 100644 --- a/core/generate_extra_images.mk +++ b/core/generate_extra_images.mk @@ -77,42 +77,6 @@ $(INSTALLED_PERSISTIMAGE_TARGET): $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(INTERNAL_PERS ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PERSISTIMAGE_TARGET) ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_PERSISTIMAGE_TARGET) - -#---------------------------------------------------------------------- -# Generate device tree image (dt.img) -#---------------------------------------------------------------------- -ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) -ifeq ($(strip $(BUILD_TINY_ANDROID)),true) -include device/qcom/common/dtbtool/Android.mk -endif - -ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) -DTBTOOL_NAME := dtbToolCM -else -DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) -endif - -DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) - -INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img - -possible_dtb_dirs = $(KERNEL_OUT)/arch/$(TARGET_KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/arm/boot/ -dtb_dir = $(firstword $(wildcard $(possible_dtb_dirs))) - -define build-dtimage-target - $(call pretty,"Target dt image: $(INSTALLED_DTIMAGE_TARGET)") - $(hide) $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ $(dtb_dir) - $(hide) chmod a+r $@ -endef - -$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) - $(build-dtimage-target) - @echo -e ${CL_CYN}"Made DT image: $@"${CL_RST} - -ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DTIMAGE_TARGET) -ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET) -endif - #---------------------------------------------------------------------- # Generate extra userdata images (for variants with multiple mmc sizes) #---------------------------------------------------------------------- diff --git a/core/tasks/dt_image.mk b/core/tasks/dt_image.mk new file mode 100644 index 000000000..60d45cc91 --- /dev/null +++ b/core/tasks/dt_image.mk @@ -0,0 +1,48 @@ +#---------------------------------------------------------------------- +# Generate device tree image (dt.img) +#---------------------------------------------------------------------- +ifeq ($(strip $(BOARD_CUSTOM_BOOTIMG_MK)),) +ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) +ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true) +ifeq ($(strip $(BUILD_TINY_ANDROID)),true) +include device/qcom/common/dtbtool/Android.mk +endif + +ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) +DTBTOOL_NAME := dtbToolCM +else +DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) +endif + +DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) + +INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img + +ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) +# dtbToolCM will search subdirectories +possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ +else +# Most specific paths must come first in possible_dtb_dirs +possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ +endif +dtb_dir = $(firstword $(wildcard $(possible_dtb_dirs))) + +define build-dtimage-target + $(call pretty,"Target dt image: $@") + $(hide) $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ $(dtb_dir) + $(hide) chmod a+r $@ +endef + +$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) + $(build-dtimage-target) + @echo -e ${CL_CYN}"Made DT image: $@"${CL_RST} + +ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DTIMAGE_TARGET) +ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET) + +.PHONY: dtimage +dtimage: $(INSTALLED_DTIMAGE_TARGET) + +endif +endif +endif -- 2.11.0