[Linaro-uefi] atf-build: migrate to bl2_el3

Message ID 1517204902-23796-1-git-send-email-haojian.zhuang@linaro.org
State New
Headers show
Series
  • [Linaro-uefi] atf-build: migrate to bl2_el3
Related show

Commit Message

Haojian Zhuang Jan. 29, 2018, 5:48 a.m.
When migrate to BL2_EL3 in ARM Trusted Firmware, bl2.bin should
be built out of fip.bin. Otherwise, non-TF ROM failes to load
bl2.bin because it doesn't recognize fip.bin format.

So copy bl2.bin to UEFI folder after ATF built.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 atf-build.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Leif Lindholm Jan. 30, 2018, 2:05 p.m. | #1
On Mon, Jan 29, 2018 at 01:48:22PM +0800, Haojian Zhuang wrote:
> When migrate to BL2_EL3 in ARM Trusted Firmware, bl2.bin should
> be built out of fip.bin. Otherwise, non-TF ROM failes to load
> bl2.bin because it doesn't recognize fip.bin format.
> 
> So copy bl2.bin to UEFI folder after ATF built.
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  atf-build.sh | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/atf-build.sh b/atf-build.sh
> index 65d4dbc..db741f5 100755
> --- a/atf-build.sh
> +++ b/atf-build.sh
> @@ -182,9 +182,15 @@ function build_platform
>  		# 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/""
> +			echo "Copying bl1.bin bl2.bin and fip.bin to "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/""

To future-proof this somewhat, could we instead do:

                        echo "Copying images to '$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/':"
			CPFLAGS="-v"
		else
			CPFLAGS=""
		fi

and

		for file in build/"$ATF_PLATFORM/$BUILD_TYPE"/{bl1,bl2,fip}.bin; do
		    	 if [ -f "$file" ]; then
			      	 cp -a $CPFLAGS "$file" "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
			 fi
		done

?

/
    Leif

>  		fi
> -		cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/{bl1,fip}.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
> +		if [ -f build/"$ATF_PLATFORM/$BUILD_TYPE"/bl1.bin ]; then
> +			cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/bl1.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
> +		fi
> +		if [ -f build/"$ATF_PLATFORM/$BUILD_TYPE"/bl2.bin ]; then
> +			cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/bl2.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
> +		fi
> +		cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/fip.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
>  	else
>  		return 1
>  	fi
> -- 
> 2.7.4
>

Patch

diff --git a/atf-build.sh b/atf-build.sh
index 65d4dbc..db741f5 100755
--- a/atf-build.sh
+++ b/atf-build.sh
@@ -182,9 +182,15 @@  function build_platform
 		# 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/""
+			echo "Copying bl1.bin bl2.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/"
+		if [ -f build/"$ATF_PLATFORM/$BUILD_TYPE"/bl1.bin ]; then
+			cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/bl1.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
+		fi
+		if [ -f build/"$ATF_PLATFORM/$BUILD_TYPE"/bl2.bin ]; then
+			cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/bl2.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
+		fi
+		cp -a build/"$ATF_PLATFORM/$BUILD_TYPE"/fip.bin "$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/"
 	else
 		return 1
 	fi