#@TYPE: Machine
#@NAME: VT-64
#@DESCRIPTION: Machine configuration for QTI SOM1-QCS405
require conf/machine/include/qcs40x.inc
# EMMC TARGET TO SUPPORT 64-bit kernel
DISTRO = "qsap"
DEFAULTTUNE = "aarch64"

#boot image
BOOTIMAGE_TARGET = "boot.img"

#EXT4 FILES NAME
CACHEIMAGE_TARGET    = "cache.img"
PERSISTIMAGE_TARGET  = "persist.img"
RECOVERYIMAGE_TARGET = "recoveryfs.img"
SYSTEMIMAGE_TARGET   = "system.img"
SYSTEMRWIMAGE_TARGET = "systemrw.img"
USERDATAIMAGE_TARGET = "usrdata.img"

MACHINE_MNT_POINTS = "/firmware /persist /cache /dsp /bt_firmware"

# Sizes for EXT4 (in bytes)
SYSTEM_SIZE_EXT4 ?= "681574400"
SYSTEMRW_SIZE_EXT4 ?= "8388608"
USERDATA_SIZE_EXT4 ?= "1000000000"
CACHE_SIZE_EXT4 ?= "80000000"

# enable audio as a loadable kernel module
DISTRO_FEATURES:append = " audio-dlkm"
#defconfig to be used for vt-64
KERNEL_CONFIG = "${@['vendor/qcs405-perf_defconfig', 'vendor/qcs405_defconfig'][d.getVar('VARIANT', True) == ('' or 'debug')]}"

#enable selinux
# DISTRO_FEATURES:append = " selinux"
# DEFAULT_ENFORCING = "enforcing"

#Enable dm-verity feature for non debug builds
DISTRO_FEATURES += "${@bb.utils.contains('DEBUG_BUILD', '1', '', 'dm-verity', d)}"

# Formats of root filesystem images.
IMAGE_FSTYPES += "ext4"
RECOVERY_IMAGE = "0"

KERNEL_IMAGETYPE = "Image.gz-dtb"
IMAGE_EXT4_EXTRA_OPTIONS = "${@bb.utils.contains('DISTRO_FEATURES','ro-rootfs',' -J -b 4096 ','',d)}"
DISTRO_FEATURES += "persist-image"
require conf/multilib.conf
MULTILIBS = "multilib:lib32"
DEFAULTTUNE_virtclass-multilib-lib32 = "armv7ahf-neon"
TARGET_VENDOR_virtclass-multilib-lib32="-oe"

PREFERRED_PROVIDER_virtual/libgles1 = "adreno"
PREFERRED_PROVIDER_virtual/libgles2 = "adreno"
PREFERRED_PROVIDER_virtual/egl      = "adreno"
PREFERRED_VERSION_libdrm = "2.4.83"

# Set ab-boot-support feature for native tools as well,
# as some native tools have workflow chnages for AB builds.
DISTRO_FEATURES += "ab-boot-support"
DISTRO_FEATURES_NATIVE:append = " ab-boot-support "

#enable stderror debug for vt devices
PACKAGECONFIG:append_pn-adk-utils = " stderr debug"

QPERM_FILE_pn-start-script-ab-slot-util = "${bindir}/getslotsuffix:0:1000"
QPERM_FILE_pn-system-core = "${sysconfdir}/build.prop:5002:5002"
QPERM_FILE_pn-system-prop = "/build.prop:5002:5002"

PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-rdk"

# Enable coedump
SYSTEMD_ENABLE_COREDUMP = "1"
SYSTEMD_COREDUMP_PATH = "/var/tmp"

#qti-gpu ensures gpu is supported.
#qti-display ensures display is supported.
#qti-sensors ensures sensors is supported.
#qti-cdsp ensures cdsp subsystem is supported.
#wlan ensures wlan functionality is supported.
#wlan-sdio ensures the second radio with sdio interface exists.
MACHINE_FEATURES:append = " qti-gpu qti-display qti-sensors qti-cdsp wlan wlan-sdio "

#qti-mmparser ensures multimedia parsers are supported.
#qti-audiopd ensures audiopd is supported by adsp.
#wlan-perf build wlan driver with perf config
DISTRO_FEATURES:append  = " qti-mmparser qti-audiopd "

DISTRO_FEATURES:append  = " ${@bb.utils.contains("MACHINE_FEATURES", "qti-gpu", "qti-gfx", "", d)} "
DISTRO_FEATURES:append  = " ${@bb.utils.contains("MACHINE_FEATURES", "wlan", "wlan-perf", "", d)} "

PERSISTFS_CONFIG = "-C ${WORKDIR}/persist_fsconfig.conf"
MAKEEXT4_MOUNT_OPT = "-a /"

#Enable TFlite compilation
DISTRO_FEATURES += "tflite-enable"

#Enable factory storage
DISTRO_FEATURES:append = "factory-storage"

