sm8x50-userdebug: Add a generic build target for Qcom ARMv9 devboards
Adding a 64-bit only generic build target for Qcom armv9
(Snapdragon 8 gen) devboards and enable it in LKFT. It is
supported only on v6.8+ kernel versions.
SM8550-HDK, https://www.lantronix.com/products/snapdragon-8-gen-2-mobile-hardware-development-kit/
is the primary device supported by this build configuration.
Other Snapdragon 8 gen devboards are supported on the best
efforts basis.
Smoke tested sm8x50-userdebug build target on SM8550-HDK.
Boots to UI with upstream kernel using software rendering
and linux-firmware binaries for now, which is good enough to
kickstart testing in LKFT lab.
`lunch` target is not added yet and will be added as soon
the firmware binaries land in linaro-vendor / linux-firmware
repo to make sure that the device has more features enabled
and is in a more usable state. Boot image header v2 is used
for now, while we are working on releasing ABL with header
v4 support.
And since qcom,board-id and qcom,msm-id DT properties are no
longer accepted upstream, we are using fdtoverlay to apply
them at build time. So make sure that the base DT is built
with `DTC_FLAGS=-@` build flag to allow overlays, otherwise
fdtoverlay command will run into "FDT_ERR_NOTFOUND" error at
the build time.
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I2c6a0331173ef11a542b07ee3a270ece36d96786
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index ed747b7..1478753 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -1,7 +1,26 @@
-ifneq ($(filter db845c db845c_mini linaro_swr, $(TARGET_DEVICE)),)
+ifneq ($(filter db845c db845c_mini linaro_swr sm8x50, $(TARGET_DEVICE)),)
-$(PRODUCT_OUT)/dtb.img: $(TARGET_KERNEL_DIR)/sdm845-db845c.dtb $(wildcard $(TARGET_KERNEL_DIR)/qrb5165-rb5.dtb)
- cat $^ > $@
+DTC := $(HOST_OUT)/bin/dtc
+FDTOVERLAY := $(HOST_OUT)/bin/fdtoverlay
+SM8550HDK_DTS_OVERLAY := device/linaro/dragonboard/sm8x50/dtb-overlays/sm8550-hdk.dts
+SM8550QRD_DTS_OVERLAY := device/linaro/dragonboard/sm8x50/dtb-overlays/sm8550-qrd.dts
+SM8650QRD_DTS_OVERLAY := device/linaro/dragonboard/sm8x50/dtb-overlays/sm8650-qrd.dts
+
+DB845C_DTB := $(TARGET_KERNEL_DIR)/sdm845-db845c.dtb
+RB5_DTB := $(wildcard $(TARGET_KERNEL_DIR)/qrb5165-rb5.dtb)
+SM8550HDK_DTB := $(wildcard $(TARGET_KERNEL_DIR)/sm8550-hdk.dtb)
+SM8550QRD_DTB := $(wildcard $(TARGET_KERNEL_DIR)/sm8550-qrd.dtb)
+SM8650QRD_DTB := $(wildcard $(TARGET_KERNEL_DIR)/sm8650-qrd.dtb)
+
+$(PRODUCT_OUT)/dtb.img: $(DTC) $(FDTOVERLAY)
+ -$(DTC) -@ -I dts -O dtb -o $(PRODUCT_OUT)/sm8550-hdk.dtbo $(SM8550HDK_DTS_OVERLAY)
+ -$(FDTOVERLAY) -i $(SM8550HDK_DTB) -o $(PRODUCT_OUT)/sm8550-hdk.dtb $(PRODUCT_OUT)/sm8550-hdk.dtbo
+ -$(DTC) -@ -I dts -O dtb -o $(PRODUCT_OUT)/sm8550-qrd.dtbo $(SM8550QRD_DTS_OVERLAY)
+ -$(FDTOVERLAY) -i $(SM8550QRD_DTB) -o $(PRODUCT_OUT)/sm8550-qrd.dtb $(PRODUCT_OUT)/sm8550-qrd.dtbo
+ -$(DTC) -@ -I dts -O dtb -o $(PRODUCT_OUT)/sm8650-qrd.dtbo $(SM8650QRD_DTS_OVERLAY)
+ -$(FDTOVERLAY) -i $(SM8650QRD_DTB) -o $(PRODUCT_OUT)/sm8650-qrd.dtb $(PRODUCT_OUT)/sm8650-qrd.dtbo
+ -cat $(DB845C_DTB) $(RB5_DTB) $(PRODUCT_OUT)/sm8550-hdk.dtb $(PRODUCT_OUT)/sm8550-qrd.dtb $(PRODUCT_OUT)/sm8650-qrd.dtbo > $@
+ -rm $(PRODUCT_OUT)/sm8*dtb*
droidcore: $(PRODUCT_OUT)/dtb.img