1# Use this file to generate dtb.img and dtbo.img instead of using
2# BOARD_PREBUILT_DTBIMAGE_DIR. We need to keep dtb and dtbo files at the fixed
3# positions in images, so that bootloader can rely on their indexes in the
4# image. As dtbo.img must be signed with AVB tool, we generate intermediate
5# dtbo.img, and the resulting $(PRODUCT_OUT)/dtbo.img will be created with
6# Android build system, by exploiting BOARD_PREBUILT_DTBOIMAGE variable.
7
8ifneq ($(filter yukawa%, $(TARGET_DEVICE)),)
9
10MKDTIMG := system/libufdt/utils/src/mkdtboimg.py
11DTBIMAGE := $(PRODUCT_OUT)/dtb.img
12DTBOIMAGE := $(PRODUCT_OUT)/$(DTBO_UNSIGNED)
13
14# Please keep this list fixed: add new files in the end of the list
15DTB_FILES := \
16	$(LOCAL_DTB)/meson-g12a-sei510.dtb-$(TARGET_KERNEL_USE) \
17	$(LOCAL_DTB)/meson-sm1-sei610.dtb-$(TARGET_KERNEL_USE) \
18	$(LOCAL_DTB)/meson-sm1-khadas-vim3l.dtb-$(TARGET_KERNEL_USE)
19
20# Please keep this list fixed: add new files in the end of the list
21DTBO_FILES := \
22	$(LOCAL_DTB)/meson-g12a-sei510-android.dtb-$(TARGET_KERNEL_USE) \
23	$(LOCAL_DTB)/meson-sm1-sei610-android.dtb-$(TARGET_KERNEL_USE) \
24	$(LOCAL_DTB)/meson-sm1-khadas-vim3l-android.dtb-$(TARGET_KERNEL_USE)
25
26$(DTBIMAGE): $(DTB_FILES)
27	cat $^ > $@
28
29$(DTBOIMAGE): PRIVATE_MKDTIMG := $(MKDTIMG)
30$(DTBOIMAGE): PRIVATE_DTBO_FILES := $(DTBO_FILES)
31$(DTBOIMAGE): $(DTBO_FILES) $(MKDTIMG)
32	$(PRIVATE_MKDTIMG) create $@ $(PRIVATE_DTBO_FILES)
33
34include $(CLEAR_VARS)
35LOCAL_MODULE := dtbimage
36LOCAL_ADDITIONAL_DEPENDENCIES := $(DTBIMAGE)
37include $(BUILD_PHONY_PACKAGE)
38
39include $(CLEAR_VARS)
40LOCAL_MODULE := dtboimage
41LOCAL_ADDITIONAL_DEPENDENCIES := $(DTBOIMAGE)
42include $(BUILD_PHONY_PACKAGE)
43
44droidcore: dtbimage dtboimage
45
46endif
47