-
Notifications
You must be signed in to change notification settings - Fork 63
/
environment
95 lines (87 loc) · 3.2 KB
/
environment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
export PATH=$PATH:$HOME/.cargo/bin
# for std: specify the target json file
export RUST_TARGET_PATH="$(pwd)"
if [ -z "$OPTEE_DIR" ]
then
echo -e "OPTEE_DIR has not set, use $PWD/optee/ as default\n"
export OPTEE_DIR=$PWD/optee
fi
export OPTEE_OS_DIR="$OPTEE_DIR/optee_os"
export OPTEE_CLIENT_DIR="$OPTEE_DIR/optee_client"
export CROSS_COMPILE32="arm-linux-gnueabihf-"
export CROSS_COMPILE64="aarch64-linux-gnu-"
if [ "$ARCH_TA" = "arm" ]
then
# build TA as 32-bit
export TA_DEV_KIT_DIR="$OPTEE_OS_DIR/out/arm-plat-vexpress/export-ta_arm32"
if [ "$STD" ]
then
export TARGET_TA="arm-unknown-optee"
echo "set TARGET_TA=$TARGET_TA (std)"
else
export TARGET_TA="arm-unknown-linux-gnueabihf"
echo "set TARGET_TA=$TARGET_TA (no-std)"
fi
export CROSS_COMPILE_TA="$CROSS_COMPILE32"
echo "set CROSS_COMPILE_TA=$CROSS_COMPILE_TA"
else
# build TA as 64-bit by default
export TA_DEV_KIT_DIR="$OPTEE_OS_DIR/out/arm-plat-vexpress/export-ta_arm64"
if [ "$STD" ]
then
export TARGET_TA="aarch64-unknown-optee"
echo "set TARGET_TA=$TARGET_TA (std)"
else
export TARGET_TA="aarch64-unknown-linux-gnu"
echo "set TARGET_TA=$TARGET_TA (no-std)"
fi
export CROSS_COMPILE_TA="$CROSS_COMPILE64"
echo "set CROSS_COMPILE_TA=$CROSS_COMPILE_TA"
fi
# check if libraries exist
if [ -d "$TA_DEV_KIT_DIR" ]
then
echo "set TA_DEV_KIT_DIR=$TA_DEV_KIT_DIR"
else
echo -e "Error: TA_DEV_KIT_DIR=$TA_DEV_KIT_DIR does not exist, please set the correct TA_DEV_KIT_DIR or run \"$ ./build_optee_libraries.sh optee/\" then try again\n"
unset OPTEE_DIR
fi
if [ "$ARCH_HOST" = "arm" ]
then
# build host as 32-bit
export OPTEE_CLIENT_EXPORT="$OPTEE_CLIENT_DIR/export_arm32"
export TARGET_HOST="arm-unknown-linux-gnueabihf"
echo "set TARGET_HOST=$TARGET_HOST"
export CROSS_COMPILE_HOST="$CROSS_COMPILE32"
echo "set CROSS_COMPILE_HOST=$CROSS_COMPILE_HOST"
else
# build host as 64-bit by default
export OPTEE_CLIENT_EXPORT="$OPTEE_CLIENT_DIR/export_arm64"
export TARGET_HOST="aarch64-unknown-linux-gnu"
echo "set TARGET_HOST=$TARGET_HOST"
export CROSS_COMPILE_HOST="$CROSS_COMPILE64"
echo "set CROSS_COMPILE_HOST=$CROSS_COMPILE_HOST"
fi
if [ -d "$OPTEE_CLIENT_EXPORT" ]
then
echo "set OPTEE_CLIENT_EXPORT=$OPTEE_CLIENT_EXPORT"
else
echo -e "Error: OPTEE_CLIENT_EXPORT=$OPTEE_CLIENT_EXPORT does not exist, please set the correct OPTEE_CLIENT_EXPORT or run \"$ ./build_optee_libraries.sh optee/\" then try again\n"
unset OPTEE_DIR
fi