#@TYPE: Machine
#@NAME: SA2150P-NAND
#@DESCRIPTION: Machine configuration for QTI SA2150P NAND

require conf/machine/include/qcs40x.inc
require conf/machine/include/sa2150p-eap.inc

MACHINEOVERRIDES =. "sa2150p:"

# Mount points
MACHINE_MNT_POINTS = "/firmware /persist /cache /dsp"

# Kernel Configurations
DEFAULTTUNE = "aarch64"
PAGE_SIZE = '4096'
KERNEL_CONFIG = "${@['vendor/sa2150p-nand-perf_defconfig', 'vendor/sa2150p-nand_defconfig'][d.getVar('VARIANT', True) == ('' or 'debug')]}"
KERNEL_IMAGETYPE = "Image.gz-dtb"
SERIAL_CONSOLES = "115200;ttyMSM0"

# Image names
DEPLOY_DIR_IMAGE_NAND = "${DEPLOY_DIR_IMAGE}"
BOOTIMAGE_TARGET = "${MACHINE}-boot.img"
UBIFS_UBI_IMAGE      = "${MACHINE}-system-ubifs.ubi"
USR_IMAGE_BASENAME  = "${MACHINE}-userdata"
OUTPUT_FILE_PERSIST_UBI   = "${DEPLOY_DIR_IMAGE_NAND}/${MACHINE}-persist.ubi"
OUTPUT_FILE_PERSIST_UBIFS = "${DEPLOY_DIR_IMAGE_NAND}/${MACHINE}-persist.ubifs"
RECOVERYFS_SQUASHFS_UBI_IMAGE = "${DEPLOY_DIR_IMAGE_NAND}/recoveryfs.ubi"
RECOVERYFS_SQUASHFS_IMAGE = "${DEPLOY_DIR_IMAGE_NAND}/recoveryfs.squash"
OUTPUT_FILE_FINAL_SQUASHFS_UBI = "${DEPLOY_DIR_IMAGE_NAND}/system.ubi"
SQUASHFS_SYS_VOLUME = "system.squash"
UBIFS_SYS_VOLUME = "system.ubifs"

# Max supported inodes
EXTRA_IMAGECMD = "-N 2048"
UBINIZE_ARGS = "-m 4096 -p 256KiB -s 4096"
MKUBIFS_ARGS = "-m 4096 -e 253952 -c 2146 -F"
MKUBIFS_PERSIST_ARGS = "-m 4096 -e 253952 -c 2146 -F"

# Volume sizes
SYSTEM_VOLUME_SIZE      = "150MiB"
CACHE_VOLUME_SIZE       = "81MiB"
SYSTEMRW_VOLUME_SIZE    = "6MiB"
PERSIST_VOLUME_SIZE     = "6MiB"
AB_CACHE_VOLUME_SIZE    = "6MiB"
AB_SYSTEM_VOLUME_SIZE   = "100MiB"
AB_PERSIST_VOLUME_SIZE  = "6MiB"
AB_SYSTEMRW_VOLUME_SIZE = "6MiB"
AB_SYSTEM_SQUASHFS_VOLUME_SIZE = "50MiB"

# Format of root filesystem images
IMAGE_FSTYPES += "ubi"

# Enable recovery ubi image generation
RECOVERY_IMAGE_UBI = "1"

PREFERRED_PROVIDER_virtual/libgles1 = "adreno"
PREFERRED_PROVIDER_virtual/libgles2 = "adreno"
PREFERRED_PROVIDER_virtual/egl = "adreno"
PREFERRED_VERSION_iproute2 = "4.4.0"

QPERM_FILE_pn-system-core = "${sysconfdir}/build.prop:5002:5002"
QPERM_FILE_pn-system-prop = "/build.prop:5002:5002"

# Set openssl (1.1.1) as openssl provider
PREFERRED_PROVIDER_openssl          = "openssl"
PREFERRED_VERSION_openssl           = "1.1.1a"
PREFERRED_PROVIDER_openssl-native   = "openssl-native"

# Masked Layers
BBMASK += "meta-qti-audio/recipes-products/images/machine-image.bbappend"
BBMASK += "meta-qti-audio-cal/"
BBMASK += "meta-qti-audio-external/"

BBMASK += "meta-qti-wlan/recipes-products/"
BBMASK += "meta-qti-wlan-prop/recipes-products/"

# Enable coredump
SYSTEMD_ENABLE_COREDUMP = "1"
SYSTEMD_COREDUMP_PATH = "${userfsdatadir}/coredump"

# qti-adsp ensures adsp subsystem is supported
MACHINE_FEATURES:append = " qti-adsp "
# qti-cdsp ensures cdsp subsystem is supported
MACHINE_FEATURES:append = " qti-cdsp "
# can ensures libcanwrapper is supported should be generic
MACHINE_FEATURES:append = " can"

