Amit Pundir | bd765d6 | 2024-03-08 22:31:43 +0530 | [diff] [blame] | 1 | ifneq ($(filter db845c db845c_mini linaro_swr sm8x50, $(TARGET_DEVICE)),) |
Amit Pundir | c0ad894 | 2021-12-14 19:45:56 +0530 | [diff] [blame] | 2 | |
Amit Pundir | bd765d6 | 2024-03-08 22:31:43 +0530 | [diff] [blame] | 3 | DTC := $(HOST_OUT)/bin/dtc |
| 4 | FDTOVERLAY := $(HOST_OUT)/bin/fdtoverlay |
Elliot Berman | 4203c4a | 2024-09-12 17:36:41 -0700 | [diff] [blame^] | 5 | |
| 6 | SM8X50_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,dtb) |
| 7 | |
| 8 | SM8X50_BOARDS ?= sm8550-hdk sm8550-qrd sm8650-qrd |
| 9 | SM8X50_DTBS := $(foreach board,$(SM8X50_BOARDS),$(wildcard $(TARGET_KERNEL_DIR)/$(board).dtb)) |
| 10 | SM8X50_DTBS := $(addprefix $(SM8X50_STAGING_DIR)/,$(notdir $(SM8X50_DTBS))) |
| 11 | SM8X50_DTBOS := $(patsubst %.dtb,%.dtbo,$(SM8X50_DTBS)) |
| 12 | |
| 13 | # generate the .dtbo which contains the msm-id and board-id |
| 14 | $(SM8X50_DTBOS): $(SM8X50_STAGING_DIR)/%.dtbo: device/linaro/dragonboard/sm8x50/dtb-overlays/%.dts $(DTC) |
| 15 | -$(DTC) -@ -I dts -O dtb -o $@ $< |
| 16 | |
| 17 | # apply the above .dtbo to the prebuilt .dtb |
| 18 | $(SM8X50_DTBS): $(SM8X50_STAGING_DIR)/%.dtb: $(TARGET_KERNEL_DIR)/%.dtb $(SM8X50_STAGING_DIR)/%.dtbo | $(FDTOVERLAY) |
| 19 | -$(FDTOVERLAY) -o $@ -i $^ |
Amit Pundir | bd765d6 | 2024-03-08 22:31:43 +0530 | [diff] [blame] | 20 | |
| 21 | DB845C_DTB := $(TARGET_KERNEL_DIR)/sdm845-db845c.dtb |
| 22 | RB5_DTB := $(wildcard $(TARGET_KERNEL_DIR)/qrb5165-rb5.dtb) |
Amit Pundir | bd765d6 | 2024-03-08 22:31:43 +0530 | [diff] [blame] | 23 | |
Elliot Berman | 4203c4a | 2024-09-12 17:36:41 -0700 | [diff] [blame^] | 24 | $(PRODUCT_OUT)/dtb.img: $(SM8X50_DTBS) $(RB5_DTB) $(DB845C_DTB) |
| 25 | -cat $(SM8X50_DTBS) $(RB5_DTB) $(DB845C_DTB) > $@ |
Amit Pundir | c0ad894 | 2021-12-14 19:45:56 +0530 | [diff] [blame] | 26 | |
| 27 | droidcore: $(PRODUCT_OUT)/dtb.img |
| 28 | |
| 29 | endif |