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 \
17	$(LOCAL_DTB)/meson-sm1-sei610.dtb \
18	$(LOCAL_DTB)/meson-sm1-khadas-vim3l.dtb \
19	$(LOCAL_DTB)/meson-g12b-a311d-khadas-vim3.dtb
20
21# Please keep this list fixed: add new files in the end of the list
22DTBO_FILES := \
23	$(LOCAL_DTB)/meson-g12a-sei510-android.dtb \
24	$(LOCAL_DTB)/meson-sm1-sei610-android.dtb \
25	$(LOCAL_DTB)/meson-sm1-khadas-vim3l-android.dtb \
26	$(LOCAL_DTB)/meson-g12b-a311d-khadas-vim3-android.dtb \
27
28$(DTBIMAGE): $(DTB_FILES)
29	cat $^ > $@
30
31$(DTBOIMAGE): PRIVATE_MKDTIMG := $(MKDTIMG)
32$(DTBOIMAGE): PRIVATE_DTBO_FILES := $(DTBO_FILES)
33$(DTBOIMAGE): $(DTBO_FILES) $(MKDTIMG)
34	$(PRIVATE_MKDTIMG) create $@ $(PRIVATE_DTBO_FILES)
35
36include $(CLEAR_VARS)
37LOCAL_MODULE := dtbimage
38LOCAL_LICENSE_KINDS := legacy_restricted
39LOCAL_LICENSE_CONDITIONS := restricted
40LOCAL_ADDITIONAL_DEPENDENCIES := $(DTBIMAGE)
41include $(BUILD_PHONY_PACKAGE)
42
43include $(CLEAR_VARS)
44LOCAL_MODULE := dtboimage
45LOCAL_LICENSE_KINDS := legacy_restricted
46LOCAL_LICENSE_CONDITIONS := restricted
47LOCAL_ADDITIONAL_DEPENDENCIES := $(DTBOIMAGE)
48include $(BUILD_PHONY_PACKAGE)
49
50droidcore: dtbimage dtboimage
51
52$(call dist-for-goals, dist_files, $(DTBOIMAGE))
53
54endif
55