[Linaro-uefi,v2,1/2] opteed-build: export ARCH for makefile

Message ID 1518081579-2195-2-git-send-email-haojian.zhuang@linaro.org
State New
Headers show
Series
  • update for hikey
Related show

Commit Message

Haojian Zhuang Feb. 8, 2018, 9:19 a.m.
In edk2-build.sh, ARCH is declared as BUILD_ARCH. Since we always
build on x86, ARCH variable equals to X64.

Then there's error when build OPTEE.

Building opteed Trusted OS Target: AARCH64
Build: X64
Target: ARM
Build: X64
CFG_ARM64_core=y
CROSS_COMPILE_ta_arm64=aarch64-linux-gnu-
CROSS_COMPILE=arm-linux-gnueabihf-
CROSS_COMPILE_core=aarch64-linux-gnu-
PROFILE=RELEASE PLATFORM=hikey
PLATFORM_FLAVOR=hikey
CFG_TEE_CORE_LOG_LEVEL=2
core/core.mk:10: core/arch/X64/plat-hikey/conf.mk: No such file or directory
core/core.mk:12: core/arch/X64/X64.mk: No such file or directory
core/core.mk:114: core/arch/X64/kernel/link.mk: No such file or directory
mk/subdir.mk:151: lib/libutee/arch/X64/sub.mk: No such file or directory
make: * No rule to make target 'lib/libutee/arch/X64/sub.mk'. Stop.

So add TOS_ARCH. By default, TOS_ARCH is arm.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 opteed-build.sh  | 5 ++++-
 platforms.config | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Leif Lindholm Feb. 8, 2018, 10:15 a.m. | #1
On Thu, Feb 08, 2018 at 05:19:38PM +0800, Haojian Zhuang wrote:
> In edk2-build.sh, ARCH is declared as BUILD_ARCH. Since we always
> build on x86, ARCH variable equals to X64.
> 
> Then there's error when build OPTEE.
> 
> Building opteed Trusted OS Target: AARCH64
> Build: X64
> Target: ARM
> Build: X64
> CFG_ARM64_core=y
> CROSS_COMPILE_ta_arm64=aarch64-linux-gnu-
> CROSS_COMPILE=arm-linux-gnueabihf-
> CROSS_COMPILE_core=aarch64-linux-gnu-
> PROFILE=RELEASE PLATFORM=hikey
> PLATFORM_FLAVOR=hikey
> CFG_TEE_CORE_LOG_LEVEL=2
> core/core.mk:10: core/arch/X64/plat-hikey/conf.mk: No such file or directory
> core/core.mk:12: core/arch/X64/X64.mk: No such file or directory
> core/core.mk:114: core/arch/X64/kernel/link.mk: No such file or directory
> mk/subdir.mk:151: lib/libutee/arch/X64/sub.mk: No such file or directory
> make: * No rule to make target 'lib/libutee/arch/X64/sub.mk'. Stop.
> 
> So add TOS_ARCH. By default, TOS_ARCH is arm.
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  opteed-build.sh  | 5 ++++-
>  platforms.config | 2 ++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/opteed-build.sh b/opteed-build.sh
> index 702860e..4de48d3 100755
> --- a/opteed-build.sh
> +++ b/opteed-build.sh
> @@ -21,6 +21,9 @@ function usage
>  function build_platform
>  {
>  	unset CFG_ARM64_core PLATFORM PLATFORM_FLAVOR DEBUG
> +	if [ X"$TOS_ARCH" = X"" ]; then
> +		TOS_ARCH=arm
> +	fi

I still don't like hardcoding, and I'm hoping at some point opteed
will support aarch64, but I'll accept it here since it is completely
contained in the opteed-script.

For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
I will push it together with edk2-platforms and edk2-non-osi updates
once the hikey960 support is ready to go in.

/
    Leif

>  	TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_platform`"
>  	if [ X"$TOS_PLATFORM" = X"" ]; then
>  		TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_platform`"
> @@ -94,7 +97,7 @@ function build_platform
>  	if [ $VERBOSE -eq 1 ]; then
>  		echo "Calling OP-TEE build:"
>  	fi
> -	make -j$NUM_THREADS ${PLATFORM_BUILDFLAGS}
> +	make ARCH=$TOS_ARCH -j$NUM_THREADS ${PLATFORM_BUILDFLAGS}
>  	if [ $? -eq 0 ]; then
>  		#
>  		# Copy resulting images to UEFI image dir
> diff --git a/platforms.config b/platforms.config
> index deb02f4..0e7dd6b 100644
> --- a/platforms.config
> +++ b/platforms.config
> @@ -25,6 +25,8 @@
>  #			Else we will not know which specific Trusted OS to
>  #			build.
>  #			Set to "debug" to create a debug build.
> +# - TOS_ARCH            String describing the architecture to build for.
> +#                       Currently the supported architecture is ARM.
>  # - TOS_PLATFORM	Platform name for Trusted OS build, if
>  #   			different from ARM Trusted Firmware platform
>  #			or UEFI platform name.
> -- 
> 2.7.4
>

Patch

diff --git a/opteed-build.sh b/opteed-build.sh
index 702860e..4de48d3 100755
--- a/opteed-build.sh
+++ b/opteed-build.sh
@@ -21,6 +21,9 @@  function usage
 function build_platform
 {
 	unset CFG_ARM64_core PLATFORM PLATFORM_FLAVOR DEBUG
+	if [ X"$TOS_ARCH" = X"" ]; then
+		TOS_ARCH=arm
+	fi
 	TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_platform`"
 	if [ X"$TOS_PLATFORM" = X"" ]; then
 		TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_platform`"
@@ -94,7 +97,7 @@  function build_platform
 	if [ $VERBOSE -eq 1 ]; then
 		echo "Calling OP-TEE build:"
 	fi
-	make -j$NUM_THREADS ${PLATFORM_BUILDFLAGS}
+	make ARCH=$TOS_ARCH -j$NUM_THREADS ${PLATFORM_BUILDFLAGS}
 	if [ $? -eq 0 ]; then
 		#
 		# Copy resulting images to UEFI image dir
diff --git a/platforms.config b/platforms.config
index deb02f4..0e7dd6b 100644
--- a/platforms.config
+++ b/platforms.config
@@ -25,6 +25,8 @@ 
 #			Else we will not know which specific Trusted OS to
 #			build.
 #			Set to "debug" to create a debug build.
+# - TOS_ARCH            String describing the architecture to build for.
+#                       Currently the supported architecture is ARM.
 # - TOS_PLATFORM	Platform name for Trusted OS build, if
 #   			different from ARM Trusted Firmware platform
 #			or UEFI platform name.