#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
#
source "${BASH_SOURCE%/*}/include/sunxi64_common.inc"

[[ -z $CPUMIN ]] && CPUMIN=480000
[[ -z $CPUMAX ]] && CPUMAX=1512000
GOVERNOR=ondemand

case $BRANCH in
	current | edge)
		BOOTSOURCE='https://source.denx.de/u-boot/u-boot.git'
		BOOTBRANCH='branch:v2024.01'
		ATFSOURCE='https://github.com/ARM-software/arm-trusted-firmware'
		ATFBRANCH='tag:lts-v2.10.2'
		ATF_PLAT="sun50i_h616"
		ATF_TARGET_MAP='PLAT=sun50i_h616 DEBUG=1 bl31;;build/sun50i_h616/debug/bl31.bin'
		BOOTSCRIPT='boot-sun50i-next.cmd:boot.cmd'
		;;
esac

# This build requires busybox (and dos2unix)
function add_host_dependencies__sun50iw9_add_busybox_hostdep() {
	display_alert "Adding busybox dep" "for ${BOARD} bootloader compile" "debug"
	declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} busybox"
}

function family_tweaks_s() {
	if [[ -f $SDCARD/lib/systemd/system/hdmi-audio.service ]]; then
		chroot $SDCARD /bin/bash -c "systemctl --no-reload enable hdmi-audio.service >/dev/null 2>&1"
	fi
}
