kernel: Rework how DTB/DTBO are built
* Remove the separate dtbo.mk task and merge it in kernel.mk * Merge in-kernel and separated DTBO image generation Change-Id: I2cae84095cbd3d68abbe1899a9cae34c8a1e5fc9
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
ifneq ($(TARGET_NO_KERNEL),true)
|
|
||||||
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DTBO)),true)
|
|
||||||
|
|
||||||
ifneq ($(BOARD_CUSTOM_DTBOIMG_MK),)
|
|
||||||
include $(BOARD_CUSTOM_DTBOIMG_MK)
|
|
||||||
else
|
|
||||||
|
|
||||||
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg$(HOST_EXECUTABLE_SUFFIX)
|
|
||||||
|
|
||||||
# Most specific paths must come first in possible_dtbo_dirs
|
|
||||||
possible_dtbo_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts $(KERNEL_OUT)/arch/arm/boot/dts
|
|
||||||
|
|
||||||
define build-dtboimage-target
|
|
||||||
$(call pretty,"Target dtbo image: $(BOARD_PREBUILT_DTBOIMAGE)")
|
|
||||||
$(hide) for dir in $(possible_dtbo_dirs); do \
|
|
||||||
if [ -d "$$dir" ]; then \
|
|
||||||
dtbo_dir="$$dir"; \
|
|
||||||
break; \
|
|
||||||
fi; \
|
|
||||||
done; \
|
|
||||||
$(MKDTIMG) create $@ --page_size=$(BOARD_KERNEL_PAGESIZE) $$(find "$$dtbo_dir" -type f -name '*.dtbo' | sort)
|
|
||||||
$(hide) chmod a+r $@
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(BOARD_PREBUILT_DTBOIMAGE): $(MKDTIMG) $(INSTALLED_KERNEL_TARGET)
|
|
||||||
$(build-dtboimage-target)
|
|
||||||
|
|
||||||
endif # BOARD_CUSTOM_DTBOIMG_MK
|
|
||||||
endif # BOARD_KERNEL_SEPARATED_DTBO
|
|
||||||
endif # TARGET_NO_KERNEL
|
|
@@ -69,8 +69,9 @@ SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
|
|||||||
|
|
||||||
## Internal variables
|
## Internal variables
|
||||||
DTC := $(HOST_OUT_EXECUTABLES)/dtc
|
DTC := $(HOST_OUT_EXECUTABLES)/dtc
|
||||||
DTBS_OUT := $(PRODUCT_OUT)/dtbs
|
|
||||||
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
|
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
|
||||||
|
DTBO_OUT := $(TARGET_OUT_INTERMEDIATES)/DTBO_OBJ
|
||||||
|
DTB_OUT := $(TARGET_OUT_INTERMEDIATES)/DTB_OBJ
|
||||||
KERNEL_CONFIG := $(KERNEL_OUT)/.config
|
KERNEL_CONFIG := $(KERNEL_OUT)/.config
|
||||||
KERNEL_RELEASE := $(KERNEL_OUT)/include/config/kernel.release
|
KERNEL_RELEASE := $(KERNEL_OUT)/include/config/kernel.release
|
||||||
|
|
||||||
@@ -227,13 +228,13 @@ endef
|
|||||||
# Make a DTBO target
|
# Make a DTBO target
|
||||||
# $(1): The DTBO target to build (eg. dtbo.img, defconfig)
|
# $(1): The DTBO target to build (eg. dtbo.img, defconfig)
|
||||||
define make-dtbo-target
|
define make-dtbo-target
|
||||||
$(call internal-make-kernel-target,$(PRODUCT_OUT)/dtbo,$(1))
|
$(call internal-make-kernel-target,$(DTBO_OUT),$(1))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Make a DTB targets
|
# Make a DTB targets
|
||||||
# $(1): The DTB target to build (eg. dtbs, defconfig)
|
# $(1): The DTB target to build (eg. dtbs, defconfig)
|
||||||
define make-dtb-target
|
define make-dtb-target
|
||||||
$(call internal-make-kernel-target,$(DTBS_OUT),$(1))
|
$(call internal-make-kernel-target,$(DTB_OUT),$(1))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(KERNEL_OUT):
|
$(KERNEL_OUT):
|
||||||
@@ -295,14 +296,33 @@ alldefconfig: $(KERNEL_OUT)
|
|||||||
env KCONFIG_NOTIMESTAMP=true \
|
env KCONFIG_NOTIMESTAMP=true \
|
||||||
$(call make-kernel-target,alldefconfig)
|
$(call make-kernel-target,alldefconfig)
|
||||||
|
|
||||||
ifeq ($(TARGET_NEEDS_DTBOIMAGE),true)
|
ifeq (true,$(filter true, $(TARGET_NEEDS_DTBOIMAGE) $(BOARD_KERNEL_SEPARATED_DTBO)))
|
||||||
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg$(HOST_EXECUTABLE_SUFFIX)
|
MKDTIMG := $(HOST_OUT_EXECUTABLES)/mkdtimg$(HOST_EXECUTABLE_SUFFIX)
|
||||||
MKDTBOIMG := $(HOST_OUT_EXECUTABLES)/mkdtboimg.py$(HOST_EXECUTABLE_SUFFIX)
|
MKDTBOIMG := $(HOST_OUT_EXECUTABLES)/mkdtboimg.py$(HOST_EXECUTABLE_SUFFIX)
|
||||||
$(BOARD_PREBUILT_DTBOIMAGE): $(DTC) $(MKDTIMG) $(MKDTBOIMG)
|
$(BOARD_PREBUILT_DTBOIMAGE): $(DTC) $(MKDTIMG) $(MKDTBOIMG)
|
||||||
echo -e ${CL_GRN}"Building DTBO.img"${CL_RST}
|
ifeq ($(BOARD_KERNEL_SEPARATED_DTBO),true)
|
||||||
|
$(BOARD_PREBUILT_DTBOIMAGE):
|
||||||
|
@echo "Building dtbo.img"
|
||||||
|
$(call make-dtbo-target,$(KERNEL_DEFCONFIG))
|
||||||
|
$(call make-dtbo-target,dtbs)
|
||||||
|
$(MKDTIMG) create $@ --page_size=$(BOARD_KERNEL_PAGESIZE) $(shell find $(DTBO_OUT)/arch/$(KERNEL_ARCH)/boot/dts -type f -name "*.dtbo" | sort)
|
||||||
|
else
|
||||||
|
$(BOARD_PREBUILT_DTBOIMAGE):
|
||||||
|
@echo "Building dtbo.img"
|
||||||
$(call make-dtbo-target,$(KERNEL_DEFCONFIG))
|
$(call make-dtbo-target,$(KERNEL_DEFCONFIG))
|
||||||
$(call make-dtbo-target,dtbo.img)
|
$(call make-dtbo-target,dtbo.img)
|
||||||
endif # TARGET_NEEDS_DTBOIMAGE
|
endif # BOARD_KERNEL_SEPARATED_DTBO
|
||||||
|
endif # TARGET_NEEDS_DTBOIMAGE/BOARD_KERNEL_SEPARATED_DTBO
|
||||||
|
|
||||||
|
ifeq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
|
||||||
|
ifeq ($(BOARD_PREBUILT_DTBIMAGE_DIR),)
|
||||||
|
$(INSTALLED_DTBIMAGE_TARGET): $(DTC)
|
||||||
|
@echo "Building dtb.img"
|
||||||
|
$(call make-dtb-target,$(KERNEL_DEFCONFIG))
|
||||||
|
$(call make-dtb-target,dtbs)
|
||||||
|
cat $(shell find $(DTB_OUT)/arch/$(KERNEL_ARCH)/boot/dts -type f -name "*.dtb" | sort) > $@
|
||||||
|
endif # !BOARD_PREBUILT_DTBIMAGE_DIR
|
||||||
|
endif # BOARD_INCLUDE_DTB_IN_BOOTIMG
|
||||||
|
|
||||||
endif # FULL_KERNEL_BUILD
|
endif # FULL_KERNEL_BUILD
|
||||||
|
|
||||||
@@ -317,25 +337,13 @@ $(file) : $(KERNEL_BIN) | $(ACP)
|
|||||||
ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
|
ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
|
|
||||||
ALL_PREBUILT += $(INSTALLED_DTBOIMAGE_TARGET)
|
|
||||||
|
|
||||||
.PHONY: kernel
|
.PHONY: kernel
|
||||||
kernel: $(INSTALLED_KERNEL_TARGET)
|
kernel: $(INSTALLED_KERNEL_TARGET)
|
||||||
|
|
||||||
.PHONY: dtboimage
|
.PHONY: dtboimage
|
||||||
dtboimage: $(INSTALLED_DTBOIMAGE_TARGET)
|
dtboimage: $(INSTALLED_DTBOIMAGE_TARGET)
|
||||||
|
|
||||||
ifeq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
|
|
||||||
ifeq ($(BOARD_PREBUILT_DTBIMAGE_DIR),)
|
|
||||||
$(INSTALLED_DTBIMAGE_TARGET): $(DTC)
|
|
||||||
echo -e ${CL_GRN}"Building DTBs"${CL_RST}
|
|
||||||
$(call make-dtb-target,$(KERNEL_DEFCONFIG))
|
|
||||||
$(call make-dtb-target,dtbs)
|
|
||||||
cat $(shell find $(DTBS_OUT)/arch/$(KERNEL_ARCH)/boot/dts/** -type f -name "*.dtb" | sort) > $@
|
|
||||||
endif
|
|
||||||
.PHONY: dtbimage
|
.PHONY: dtbimage
|
||||||
dtbimage: $(INSTALLED_DTBIMAGE_TARGET)
|
dtbimage: $(INSTALLED_DTBIMAGE_TARGET)
|
||||||
endif # BOARD_INCLUDE_DTB_IN_BOOTIMG
|
|
||||||
|
|
||||||
endif # TARGET_NO_KERNEL
|
endif # TARGET_NO_KERNEL
|
||||||
|
@@ -131,10 +131,8 @@ TOOLS_PATH_OVERRIDE := \
|
|||||||
PERL5LIB=$(BUILD_TOP)/prebuilts/tools-lineage/common/perl-base
|
PERL5LIB=$(BUILD_TOP)/prebuilts/tools-lineage/common/perl-base
|
||||||
|
|
||||||
# Set DTBO image locations so the build system knows to build them
|
# Set DTBO image locations so the build system knows to build them
|
||||||
ifeq ($(TARGET_NEEDS_DTBOIMAGE),true)
|
ifeq (true,$(filter true, $(TARGET_NEEDS_DTBOIMAGE) $(BOARD_KERNEL_SEPARATED_DTBO)))
|
||||||
BOARD_PREBUILT_DTBOIMAGE ?= $(PRODUCT_OUT)/dtbo/arch/$(KERNEL_ARCH)/boot/dtbo.img
|
BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_OUT_INTERMEDIATES)/DTBO_OBJ/arch/$(KERNEL_ARCH)/boot/dtbo.img
|
||||||
else ifeq ($(BOARD_KERNEL_SEPARATED_DTBO),true)
|
|
||||||
BOARD_PREBUILT_DTBOIMAGE ?= $(PRODUCT_OUT)/dtbo-pre.img
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Set use the full path to the make command
|
# Set use the full path to the make command
|
||||||
|
Reference in New Issue
Block a user