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/sm8x50/BoardConfig.mk b/sm8x50/BoardConfig.mk
new file mode 100644
index 0000000..9015b1c
--- /dev/null
+++ b/sm8x50/BoardConfig.mk
@@ -0,0 +1,52 @@
+include device/linaro/dragonboard/BoardConfigCommon.mk
+
+# Primary Arch
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv9-a
+TARGET_CPU_VARIANT := kryo385
+TARGET_CPU_ABI := arm64-v8a
+
+# Board Information
+TARGET_BOOTLOADER_BOARD_NAME := sm8x50
+TARGET_BOARD_PLATFORM := sm8x50
+
+TARGET_NO_KERNEL := false
+BOARD_INCLUDE_DTB_IN_BOOTIMG := true
+BOARD_BOOT_HEADER_VERSION := 2 # XXX v4 is WIP
+BOARD_MKBOOTIMG_ARGS := --header_version $(BOARD_BOOT_HEADER_VERSION)
+
+BOARD_KERNEL_BASE := 0x80000000
+BOARD_KERNEL_PAGESIZE := 4096
+BOARD_KERNEL_CMDLINE += earlycon firmware_class.path=/vendor/firmware/
+BOARD_KERNEL_CMDLINE += init=/init printk.devkmsg=on
+BOARD_KERNEL_CMDLINE += deferred_probe_timeout=30
+BOARD_KERNEL_CMDLINE += qcom_geni_serial.con_enabled=1
+BOARD_KERNEL_CMDLINE += console=ttyMSM0,115200n8
+BOARD_KERNEL_CMDLINE += allow_mismatched_32bit_el0 clk_ignore_unused pd_ignore_unused
+BOARD_KERNEL_CMDLINE += androidboot.boot_devices=soc@0/1d84000.ufs
+BOARD_KERNEL_CMDLINE += androidboot.hardware=sm8x50
+BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
+
+# Image Configuration
+BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864 #64M
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 223226966016 #200+G
+BOARD_FLASH_BLOCK_SIZE := 131072
+# Super partition
+BOARD_SUPER_PARTITION_SIZE := 6442450944 #6GB
+BOARD_DB_DYNAMIC_PARTITIONS_SIZE := 6438256640 # Reserve 4M for DAP metadata
+BOARD_SUPER_PARTITION_METADATA_DEVICE := super
+BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE := true
+BOARD_DB_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor system_ext product
+
+# Platform specific sepolicies
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/sm8x50/sepolicy/
+
+# dlkm partitions
+include device/linaro/dragonboard/shared/utils/dlkm_loader/BoardConfig.mk
+BOARD_DB_DYNAMIC_PARTITIONS_PARTITION_LIST += system_dlkm vendor_dlkm
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/utils/dlkm_loader/sepolicy/
+
+# Graphics
+include device/linaro/dragonboard/shared/graphics/drm_hwcomposer/BoardConfig.mk
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/graphics/swangle/sepolicy
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/graphics/minigbm_msm/sepolicy