# Amlogic S905X3 quad core 2-4GB RAM SoC eMMC GBE USB3 SPI
BOARD_NAME="Banana Pi M5"
BOARDFAMILY="meson-sm1"
BOARD_MAINTAINER="bretmlw"
BOOTCONFIG="bananapi-m5_defconfig"
BOOT_FDT_FILE="amlogic/meson-sm1-bananapi-m5.dtb"
KERNEL_TARGET="current,edge"
MODULES_BLACKLIST="simpledrm" # SimpleDRM conflicts with Panfrost
FULL_DESKTOP="yes"
SERIALCON="ttyAML0"
BOOT_LOGO="desktop"
BOOTBRANCH_BOARD="tag:v2023.07.02"
BOOTPATCHDIR="v2023.07.02"

function fetch_sources_tools__libreelec_amlogic_fip_pre_m5_blob_update() {
	fetch_from_repo "https://github.com/Dangku/amlogic-boot-fip" "amlogic-boot-fip" "branch:master"
}

function post_uboot_custom_postprocess__bpi-m5() {
	uboot_g12_postprocess "$SRC"/cache/sources/amlogic-boot-fip/bananapi-m5 g12a
}

function post_family_tweaks_bsp__bananapi_rtl_bt() {
	if [[ -d "$SRC/packages/bsp/bananapi/rtl_bt" ]]; then
		mkdir -p "${destination}"/lib/firmware/updates/rtl_bt
		display_alert "$BOARD" "Installing upstream firmware" "info"
		cp -fr $SRC/packages/bsp/bananapi/rtl_bt/* "${destination}"/lib/firmware/updates/rtl_bt/
	fi
}
