#@TYPE: Machine
#@NAME: SOM2-QCS403
#@DESCRIPTION: Machine configuration for QTI SOM2-QCS403
require conf/machine/include/qcs40x.inc
# NAND TARGET TO SUPPORT 32-bit kernel
DISTRO = "qsap"
DISTRO_FEATURES += "nand-boot"
DISTRO_FEATURES_NATIVE:append = " nand-boot "

PAGE_SIZE ?= '4096'
USR_IMAGE_BASENAME       = "${BASEMACHINE}-usrfs"
OUTPUT_FILE_FINAL_UBI    = "${DEPLOY_DIR_IMAGE}/${BASEMACHINE}-sysfs.ubi"
# Max supported inodes
EXTRA_IMAGECMD ?= "-N 2048"
#UBINIZE Args
UBINIZE_ARGS ?= "-m 4096 -p 256KiB -s 4096"
#MKUBIFS Args
MKUBIFS_ARGS ?= "-m 4096 -e 253952 -c 2146 -F"

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

#defconfig to be used for qcs403-som2
KERNEL_CONFIG = "${@['vendor/qcs403-perf_defconfig', 'vendor/qcs403_defconfig'][d.getVar('VARIANT', True) == ('' or 'debug')]}"

#Volume sizes
SYSTEM_VOLUME_SIZE ?= "150MiB"
CACHE_VOLUME_SIZE ?= "81MiB"
SYSTEMRW_VOLUME_SIZE ?= "6MiB"
PERSIST_VOLUME_SIZE ?= "12MiB"
# Formats of root filesystem images.
IMAGE_FSTYPES += "ubi"

#Disable ssd listener
DISTRO_FEATURES:append = " no-ssd-listener-support"

#Disable rpmb listener
DISTRO_FEATURES:append = " no-rpmb-listener-support"

# enable audio as a loadable kernel module
DISTRO_FEATURES:append = " audio-dlkm"
DISTRO_FEATURES:append = " persist-volume"
DISTRO_FEATURES:append = " nand-squashfs"
DEFAULTTUNE = "armv7ahf-neon"
MKUBIFS_PERSIST_ARGS = "-m 4096 -e 253952 -c 2146 -F"
RECOVERY_IMAGE = "0"

KERNEL_IMAGETYPE = "zImage-dtb"

#Need for compiling UEFI for aarch64
require conf/multilib.conf
MULTILIBS = "multilib:lib64"
DEFAULTTUNE_virtclass-multilib-lib64 = "aarch64"

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

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"
QPERM_FILE_pn-alm         = "/persist/data:1000:1000"

#no-test-bundle ensures reduced size package installation.
#qti-audiopd ensures audiopd is supported by adsp"
DISTRO_FEATURES:append = " no-test-bundle qti-audiopd "

#qti-cdsp ensures cdsp subsystem is supported.
#wlan ensures wlan functionality is supported.
#wlan-1x1 ensures wlan chip is 1x1, enable it only if wlan is enabled
MACHINE_FEATURES:append = " qti-cdsp wlan wlan-1x1 "

#wlan-perf build wlan driver with perf config
DISTRO_FEATURES:append  = " ${@bb.utils.contains("MACHINE_FEATURES", "wlan", "wlan-perf", "", d)} "

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

DISTRO_FEATURES += "factory-storage"