[Android Software Development] DeadSquirrel01:
If I set USE_NEW_ION_HEAP := true I stuck in bootloop (in recovery). Can I remove that line or it's needed?

EDIT 1: problem solved after build on aicp sources :D

EDIT 2: all done but I still get that problem.

I added this

# Recovery
RECOVERY_VARIANT := carliv

ifeq ($(RECOVERY_VARIANT),carliv)
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_RECOVERY_DENSITY := xhdpi
VIBRATOR_TIMEOUT_FILE := /sys/devices/virtual/timed_output/vibrator/enable
BOARD_USE_CUSTOM_RECOVERY_FONT := \"font_23x49.h\"
DEVICE_RESOLUTION := 720x1280
BOARD_CUSTOM_RECOVERY_UI := default_recovery_ui.c
# Qcom
RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true
TARGET_USES_QCOM_BSP := true
USE_NEW_ION_HEAP := true
TOUCH_INPUT_BLACKLIST := "accelerometer"
endif

. Should I compile it on cm13 (it's my last hope to get it to work) or should I remove/add some lines regarding UI?

Here is my new complete boardconfig.mk

# inherit from qcom-common
-include device/samsung/qcom-common/BoardConfigCommon.mk

LOCAL_PATH := device/samsung/a5ultexx
ANDROID_COMMON_BUILD_MK = true
TARGET_ARCH := arm

# Platform
TARGET_BOARD_PLATFORM := msm8916
TARGET_BOARD_PLATFORM_GPU := qcom-adreno306
TARGET_BOOTLOADER_BOARD_NAME := MSM8916

# Arch
TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp
TARGET_CPU_VARIANT := cortex-a53
TARGET_CPU_CORTEX_A53 := true

TARGET_SPECIFIC_HEADER_PATH := device/samsung/a5ultexx/include

# Kernel
BOARD_KERNEL_CMDLINE := console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci androidboot.selinux=permissive
BOARD_KERNEL_BASE := 0x80000000
BOARD_RAMDISK_OFFSET := 0x02000000
BOARD_KERNEL_TAGS_OFFSET := 0x01e00000
BOARD_KERNEL_SEPARATED_DT := true
BOARD_KERNEL_PAGESIZE := 2048
TARGET_PREBUILT_KERNEL := device/samsung/a5ultexx/kernel

# Assert
TARGET_OTA_ASSERT_DEVICE := a5ulte,a5ultexx,SM-A500FU

# Partition sizes
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_BOOTIMAGE_PARTITION_SIZE := 13631488
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 15728640
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2411724800
BOARD_PERSISTIMAGE_PARTITION_SIZE := 8388608
BOARD_USERDATAIMAGE_PARTITION_SIZE := 12767444992
BOARD_FLASH_BLOCK_SIZE := 131072

# Bluetooth
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/a5ultexx/bluetooth
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_QCOM := true
BLUETOOTH_HCI_USE_MCT := true

# Custom RIL class
BOARD_RIL_CLASS := ../../../device/samsung/a5ultexx/ril/

# NFC
BOARD_HAVE_NFC := true

# Fonts
EXTENDED_FONT_FOOTPRINT := true

# malloc implementation
MALLOC_IMPL := dlmalloc

# Audio
BOARD_USES_ALSA_AUDIO := true
AUDIO_FEATURE_LOW_LATENCY_PRIMARY := true

# Charger
BOARD_CHARGER_SHOW_PERCENTAGE := true
BOARD_CHARGER_ENABLE_SUSPEND := true

# Enable QCOM FM feature
TARGET_QCOM_NO_FM_FIRMWARE := true
AUDIO_FEATURE_ENABLED_FM := true

# Enable HW based full disk encryption
TARGET_HW_DISK_ENCRYPTION := true

# Build our own PowerHAL
TARGET_POWERHAL_SET_INTERACTIVE_EXT := $(LOCAL_PATH)/power/power_ext.c
TARGET_POWERHAL_VARIANT := qcom

# Wifi
BOARD_HAS_QCOM_WLAN	:= true
BOARD_HAS_QCOM_WLAN_SDK	:= true
BOARD_HOSTAPD_DRIVER	:= NL80211
BOARD_HOSTAPD_PRIVATE_LIB	:= lib_driver_cmd_qcwcn
BOARD_WLAN_DEVICE	:= qcwcn
BOARD_WPA_SUPPLICANT_DRIVER	:= NL80211
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_qcwcn
TARGET_PROVIDES_WCNSS_QMI := true
TARGET_USES_QCOM_WCNSS_QMI	:= true
TARGET_USES_WCNSS_CTRL	:= true
WIFI_DRIVER_FW_PATH_AP	:= "ap"
WIFI_DRIVER_FW_PATH_STA	:= "sta"
WPA_SUPPLICANT_VERSION	:= VER_0_8_X

# Bluetooth
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_QCOM := true
BLUETOOTH_HCI_USE_MCT := true

# Vold
TARGET_USE_CUSTOM_LUN_FILE_PATH := /sys/devices/platform/msm_hsusb/gadget/lun%d/file
BOARD_VOLD_DISC_HAS_MULTIPLE_MAJORS := true
BOARD_VOLD_MAX_PARTITIONS := 65

# Camera
TARGET_PROVIDES_CAMERA_HAL := true
USE_DEVICE_SPECIFIC_CAMERA := true

# CMHW
BOARD_HARDWARE_CLASS += device/samsung/a5ultexx/cmhw

# Workaround to avoid issues with legacy liblights on QCOM platforms
TARGET_PROVIDES_LIBLIGHT := true

# Qcom
BOARD_USES_QC_TIME_SERVICES := true
TARGET_PLATFORM_DEVICE_BASE := /devices/soc.0/
PROTOBUF_SUPPORTED := true
HAVE_SYNAPTICS_I2C_RMI4_FW_UPGRADE := true
COMMON_GLOBAL_CFLAGS += -DQCOM_BSP
BOARD_USES_QCOM_HARDWARE := true

# Display
TARGET_CONTINUOUS_SPLASH_ENABLED := true
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
MAX_EGL_CACHE_KEY_SIZE := 12*1024
MAX_EGL_CACHE_SIZE := 2048*1024
OVERRIDE_RS_DRIVER := libRSDriver_adreno.so

# ANT+
BOARD_ANT_WIRELESS_DEVICE := "vfs-prerelease"

# SELinux
include device/qcom/sepolicy/sepolicy.mk

BOARD_SEPOLICY_DIRS += \
device/samsung/a5ultexx/sepolicy

BOARD_SEPOLICY_UNION += \
vold.te \
file.te \
wcnss_service.te \
file_contexts

# CM Hardware
BOARD_USES_CYANOGEN_HARDWARE := true

# Misc.
TARGET_SYSTEM_PROP := device/samsung/a5ultexx/system.prop

# Display
TW_BRIGHTNESS_PATH := "/sys/devices/soc.0/1a00000.qcom\x2cmdss_mdp/qcom\x2cmdss_fb_primary.138/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 255
TW_NEW_ION_HEAP := true
TW_TARGET_USES_QCOM_BSP := true

# Storage
TARGET_RECOVERY_FSTAB := device/samsung/a5ultexx/rootdir/fstab.qcom
TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/external_sd"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "external_sd"
TW_NO_USB_STORAGE := true
TW_MTP_DEVICE := /dev/usb_mtp_gadget
RECOVERY_SDCARD_ON_DATA := true

# Time Zone data
PRODUCT_COPY_FILES += \
bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata

# Recovery
RECOVERY_VARIANT := carliv

ifeq ($(RECOVERY_VARIANT),carliv)
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_RECOVERY_DENSITY := xhdpi
VIBRATOR_TIMEOUT_FILE := /sys/devices/virtual/timed_output/vibrator/enable
BOARD_USE_CUSTOM_RECOVERY_FONT := \"font_23x49.h\"
DEVICE_RESOLUTION := 720x1280
BOARD_CUSTOM_RECOVERY_UI := default_recovery_ui.c
# Qcom
RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true
TARGET_USES_QCOM_BSP := true
USE_NEW_ION_HEAP := true
TOUCH_INPUT_BLACKLIST := "accelerometer"
endif

# Misc.
BOARD_RECOVERY_SWIPE := true
TW_HAS_DOWNLOAD_MODE := true
TW_NO_REBOOT_BOOTLOADER := true
TARGET_RECOVERY_QCOM_RTC_FIX := true

# Dex
ifeq ($(HOST_OS),linux)
ifeq ($(TARGET_BUILD_VARIANT),user)
ifeq ($(WITH_DEXPREOPT),)
WITH_DEXPREOPT := true
endif
endif
endif
[/HIDE]