#!/bin/bash
#
# Builds ARM Trusted Firmware, and generates FIPs with UEFI and optionally
# Trusted OS for the supported platforms.
# Not intended to be called directly, invoked from uefi-build.sh.
#
# Board configuration is extracted from
# parse-platforms.py and platforms.config.
#

. "$TOOLS_DIR"/common-functions
OUTPUT_DIR="$PWD"/uefi-build

ATF_BUILDVER=1

function usage
{
	echo "usage:"
	echo "atf-build.sh -e <EDK2 source directory> -t <UEFI build profile/toolchain> <platform>"
	echo
}

function check_atf_buildver
{
	MAJOR=`grep "^VERSION_MAJOR" Makefile | sed 's/.*:= *\([0-9]*\).*/\1/'`
	[ $? -ne 0 ] && return 1
	MINOR=`grep "^VERSION_MINOR" Makefile | sed 's/.*:= *\([0-9]*\).*/\1/'`
	[ $? -ne 0 ] && return 1

	if [ "$MAJOR" -eq 1 -a "$MINOR" -ge 2 ]; then
		ATF_BUILDVER=2
	fi
}

function build_platform
{
	if [ X"$EDK2_DIR" = X"" ];then
		echo "EDK2_DIR not set!" >&2
		return 1
	fi

	check_atf_buildver || return 1

	BUILD_ATF="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o build_atf`"
	if [ X"$BUILD_ATF" = X"" ]; then
		echo "Platform '$1' is not configured to build ARM Trusted Firmware."
		return 0
	fi

	ATF_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_platform`"
	if [ X"$ATF_PLATFORM" = X"" ]; then
		ATF_PLATFORM=$1
	fi

	#
	# Read platform configuration
	#
	PLATFORM_NAME="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o longname`"
	PLATFORM_ARCH="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o arch`"
	PLATFORM_IMAGE_DIR="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o uefi_image_dir`"
	PLATFORM_BUILDFLAGS="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_buildflags`"

	if [ $VERBOSE -eq 1 ]; then
		echo "PLATFORM_NAME=$PLATFORM_NAME"
		echo "PLATFORM_ARCH=$PLATFORM_ARCH"
		echo "PLATFORM_IMAGE_DIR=$PLATFORM_IMAGE_DIR"
		echo "PLATFORM_BUILDFLAGS=$PLATFORM_BUILDFLAGS"
	fi

	unset BL30 BL31 BL32 BL33
	BL30="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o scp_bin`"
	if [ $ATF_BUILDVER -gt 1 ]; then
		unset SCP_BL2
		SCP_BL2=`search_packages_path "$BL30"`
	fi
	BL31="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o el3_bin`"
	BL33="$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o uefi_bin`"

	#
	# Set up cross compilation variables (if applicable)
	#
	set_cross_compile
	CROSS_COMPILE="$TEMP_CROSS_COMPILE"
	echo "Building ARM Trusted Firmware for $PLATFORM_NAME - $BUILD_PROFILE"
	echo "CROSS_COMPILE=\"$TEMP_CROSS_COMPILE\""

	if [ X"$BL30" != X"" ]; then
		BL30=`search_packages_path "$BL30"`
	fi
	if [ X"$BL31" != X"" ]; then
		BL31=`search_packages_path "$BL31"`
	fi

	#
	# BL32 requires more attention
	# If TOS_DIR is not set, we assume user does not want a Trusted OS,
	# even if the source directory and/or binary for it exists
	#
	if [ X"$TOS_DIR" != X"" ]; then
		SPD="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_spd`"

		TOS_BIN="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin`"
		if [ X"$TOS_BIN" != X"" ]; then
			BL32=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN
		fi

		if [ X"$SPD" != X"" ] && [ X"$BL32" != X"" ]; then
			#
			# Since SPD cannot be exported or undefined,
			# we parametrise it here
			#
			SPD_OPTION="SPD=$SPD"
		else
			echo "WARNING:	Proceeding without Trusted OS!"
			echo "		Please specify both ATF_SPD and TOS_BIN"
			echo "		if you wish to use a Trusted OS!"
		fi
	else
	#
	# Since TOS_DIR is not set, user does not want a Trusted OS
	# even if the source directory and/or binary for it exists.
	# Next, Check whether user wants secure partition image.
	# If SPM_BIN is set then include pre-built secure partition image as a
	# BL32 Image and implicitly set SPM=1.
	#
		SPM_BIN="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o spm_bin`"

		if [ X"$SPM_BIN" != X"" ]; then
			BL32=$WORKSPACE/Build/StandaloneSmmPkg/$BUILD_PROFILE/FV/$SPM_BIN
			PLATFORM_BUILDFLAGS="$PLATFORM_BUILDFLAGS SPM=1"
		fi
	# We assume that user does not want secure partition either.
	# Todo: Revisit if either one of Trusted OS or Secure Partition Image is Mandatory.
	fi



	#
	# Debug extraction handling
	#
	case "$BUILD_ATF" in
	debug*)
		DEBUG=1
		BUILD_TYPE="debug"
		;;
	*)
		DEBUG=0
		BUILD_TYPE="release"
		;;
	esac

	export BL30 BL31 BL32 BL33

	echo "BL30=$BL30"
	if [ $ATF_BUILDVER -gt 1 ] && [ X"$BL30" != X"" ]; then
		export SCP_BL2
		echo "SCP_BL2=$BL30"
	fi
	echo "BL31=$BL31"
	echo "BL32=$BL32"
	echo "BL33=$BL33"
	echo "$SPD_OPTION"
	echo "BUILD_TYPE=$BUILD_TYPE"

	#
	# If a build was done with BL32, and followed by another without,
	# the BL32 component remains in fip.bin, so we delete the build dir
	# contents before calling make
	#
	rm -rf build/"$ATF_PLATFORM/$BUILD_TYPE"/*

	#
	# Build ARM Trusted Firmware and create FIP
	#
	if [ $VERBOSE -eq 1 ]; then
		echo "Calling ARM Trusted Firmware build:"
		echo "CROSS_COMPILE="$CROSS_COMPILE" make -j$NUM_THREADS PLAT="$ATF_PLATFORM" $SPD_OPTION DEBUG=$DEBUG ${PLATFORM_BUILDFLAGS} all fip"
	fi
	CROSS_COMPILE="$CROSS_COMPILE" make -j$NUM_THREADS PLAT="$ATF_PLATFORM" $SPD_OPTION DEBUG=$DEBUG ${PLATFORM_BUILDFLAGS} all fip
	if [ $? -eq 0 ]; then
		#
		# Copy resulting images to UEFI image dir
		#
		if [ $VERBOSE -eq 1 ]; then
			echo "Copying bl1.bin and fip.bin to "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/""
		fi
		cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/{bl1,fip}.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
	else
		return 1
	fi
}

# Check to see if we are in a trusted firmware directory
# refuse to continue if we aren't
if [ ! -d bl32 ]
then
	echo "ERROR: we aren't in the arm-trusted-firmware directory."
	usage
	exit 1
fi

build=

if [ $# = 0 ]
then
	usage
	exit 1
else
	while [ "$1" != "" ]; do
		case $1 in
			"-e" )
				shift
				EDK2_DIR="$1"
				;;
			"/h" | "/?" | "-?" | "-h" | "--help" )
				usage
				exit
				;;
			"-t" )
				shift
				BUILD_PROFILE="$1"
				;;
			* )
				build="$1"
				;;
		esac
		shift
	done
fi

if [ X"$build" = X"" ]; then
	echo "No platform specified!" >&2
	echo
	usage
	exit 1
fi

build_platform $build
exit $?
