[Linaro-uefi,v2,1/3] atf, opteed: Support BL32_EXTRA1 and BL32_EXTRA2

Message ID 20180302034946.30580-2-victor.chong@linaro.org
State New
Headers show
Series
  • Add support for ATF BL32_EXTRA1 and BL32_EXTRA2
Related show

Commit Message

Victor Chong March 2, 2018, 3:49 a.m.
Previously, we were using a 'headless' version of optee_os binary for
hikey and hikey960. With BL32_EXTRA1 and BL32_EXTRA2, we now enable
optee_os header parsing to allow dynamic runtime support of either a
64- or 32-bit optee_os builds, and also the pager feature.

Signed-off-by: Victor Chong <victor.chong@linaro.org>
---
 atf-build.sh    | 14 ++++++++++++--
 opteed-build.sh |  4 ++++
 2 files changed, 16 insertions(+), 2 deletions(-)

--
2.15.1

Comments

Leif Lindholm March 15, 2018, 1:38 p.m. | #1
On Fri, Mar 02, 2018 at 03:49:44AM +0000, Victor Chong wrote:
> Previously, we were using a 'headless' version of optee_os binary for
> hikey and hikey960. With BL32_EXTRA1 and BL32_EXTRA2, we now enable
> optee_os header parsing to allow dynamic runtime support of either a
> 64- or 32-bit optee_os builds, and also the pager feature.
> 
> Signed-off-by: Victor Chong <victor.chong@linaro.org>
> ---
>  atf-build.sh    | 14 ++++++++++++--
>  opteed-build.sh |  4 ++++
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/atf-build.sh b/atf-build.sh
> index 5e03569..fb80ad0 100755
> --- a/atf-build.sh
> +++ b/atf-build.sh
> @@ -67,7 +67,7 @@ function build_platform
>  		echo "PLATFORM_BUILDFLAGS=$PLATFORM_BUILDFLAGS"
>  	fi
> 
> -	unset BL30 BL31 BL32 BL33
> +	unset BL30 BL31 BL32 BL32_EXTRA1 BL32_EXTRA2 BL33
>  	BL30="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o scp_bin`"
>  	if [ $ATF_BUILDVER -gt 1 ]; then
>  		unset SCP_BL2
> @@ -100,9 +100,17 @@ function build_platform
>  		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`"
> +		TOS_BIN_EXTRA1="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra1`"
> +		TOS_BIN_EXTRA2="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra2`"
>  		if [ X"$TOS_BIN" != X"" ]; then
>  			BL32=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN
>  		fi
> +		if [ X"$TOS_BIN_EXTRA1" != X"" ]; then
> +			BL32_EXTRA1=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA1
> +		fi
> +		if [ X"$TOS_BIN_EXTRA2" != X"" ]; then
> +			BL32_EXTRA2=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA2
> +		fi
> 
>  		if [ X"$SPD" != X"" ] && [ X"$BL32" != X"" ]; then
>  			#
> @@ -149,7 +157,7 @@ function build_platform
>  		;;
>  	esac
> 
> -	export BL30 BL31 BL32 BL33
> +	export BL30 BL31 BL32 BL32_EXTRA1 BL32_EXTRA2 BL33
> 
>  	echo "BL30=$BL30"
>  	if [ $ATF_BUILDVER -gt 1 ] && [ X"$BL30" != X"" ]; then
> @@ -158,6 +166,8 @@ function build_platform
>  	fi
>  	echo "BL31=$BL31"
>  	echo "BL32=$BL32"
> +	echo "BL32_EXTRA1=$BL32_EXTRA1"
> +	echo "BL32_EXTRA2=$BL32_EXTRA2"
>  	echo "BL33=$BL33"
>  	echo "$SPD_OPTION"
>  	echo "BUILD_TYPE=$BUILD_TYPE"
> diff --git a/opteed-build.sh b/opteed-build.sh
> index 4de48d3..008e033 100755
> --- a/opteed-build.sh
> +++ b/opteed-build.sh
> @@ -103,10 +103,14 @@ function build_platform
>  		# Copy resulting images to UEFI image dir
>  		#
>  		TOS_BIN="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin`"
> +		TOS_BIN_EXTRA1="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra1`"
> +		TOS_BIN_EXTRA2="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra2`"
>  		if [ $VERBOSE -eq 1 ]; then
>  			echo "Copying '$TOS_BIN' to '$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/'"

So, this debug message should really be updated if we're copying more
files. I would suggest doing this in a similar way as we ended up
doing in atf-build.sh:
https://git.linaro.org/uefi/uefi-tools.git/tree/atf-build.sh#n184

I.e.

if [ $VERBOSE -eq 1 ]; then
       echo "Copying TOS binaries to
       '$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/'"
       CPFLAGS="-v"
else
       CPFLAGS=""
fi

and then cp -a $CPFLAGS ... 

>  		fi
>  		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
> +		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN_EXTRA1" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
> +		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN_EXTRA2" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"

Will this give error messages if not building with TOS_BIN_EXTRA*?

/
    Leif

>  	else
>  		return 1
>  	fi
> --
> 2.15.1
>

Patch

diff --git a/atf-build.sh b/atf-build.sh
index 5e03569..fb80ad0 100755
--- a/atf-build.sh
+++ b/atf-build.sh
@@ -67,7 +67,7 @@  function build_platform
 		echo "PLATFORM_BUILDFLAGS=$PLATFORM_BUILDFLAGS"
 	fi

-	unset BL30 BL31 BL32 BL33
+	unset BL30 BL31 BL32 BL32_EXTRA1 BL32_EXTRA2 BL33
 	BL30="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o scp_bin`"
 	if [ $ATF_BUILDVER -gt 1 ]; then
 		unset SCP_BL2
@@ -100,9 +100,17 @@  function build_platform
 		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`"
+		TOS_BIN_EXTRA1="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra1`"
+		TOS_BIN_EXTRA2="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra2`"
 		if [ X"$TOS_BIN" != X"" ]; then
 			BL32=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN
 		fi
+		if [ X"$TOS_BIN_EXTRA1" != X"" ]; then
+			BL32_EXTRA1=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA1
+		fi
+		if [ X"$TOS_BIN_EXTRA2" != X"" ]; then
+			BL32_EXTRA2=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA2
+		fi

 		if [ X"$SPD" != X"" ] && [ X"$BL32" != X"" ]; then
 			#
@@ -149,7 +157,7 @@  function build_platform
 		;;
 	esac

-	export BL30 BL31 BL32 BL33
+	export BL30 BL31 BL32 BL32_EXTRA1 BL32_EXTRA2 BL33

 	echo "BL30=$BL30"
 	if [ $ATF_BUILDVER -gt 1 ] && [ X"$BL30" != X"" ]; then
@@ -158,6 +166,8 @@  function build_platform
 	fi
 	echo "BL31=$BL31"
 	echo "BL32=$BL32"
+	echo "BL32_EXTRA1=$BL32_EXTRA1"
+	echo "BL32_EXTRA2=$BL32_EXTRA2"
 	echo "BL33=$BL33"
 	echo "$SPD_OPTION"
 	echo "BUILD_TYPE=$BUILD_TYPE"
diff --git a/opteed-build.sh b/opteed-build.sh
index 4de48d3..008e033 100755
--- a/opteed-build.sh
+++ b/opteed-build.sh
@@ -103,10 +103,14 @@  function build_platform
 		# Copy resulting images to UEFI image dir
 		#
 		TOS_BIN="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin`"
+		TOS_BIN_EXTRA1="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra1`"
+		TOS_BIN_EXTRA2="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra2`"
 		if [ $VERBOSE -eq 1 ]; then
 			echo "Copying '$TOS_BIN' to '$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/'"
 		fi
 		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
+		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN_EXTRA1" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
+		cp -a out/arm-plat-"$TOS_PLATFORM"/core/"$TOS_BIN_EXTRA2" "$EDK2_DIR/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
 	else
 		return 1
 	fi