This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new 2125f97  Update makefile and environment variables (#36)
2125f97 is described below

commit 2125f9725b9369cec9f67a1a848786756fc4504a
Author: Yuan Zhuang <[email protected]>
AuthorDate: Thu Sep 2 01:21:11 2021 +0800

    Update makefile and environment variables (#36)
---
 .cargo/config            | 16 ++++++++--------
 .github/workflows/ci.yml |  4 ++--
 Makefile                 |  5 ++++-
 README.md                | 20 ++++++++++++++++----
 environment              |  5 ++++-
 5 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/.cargo/config b/.cargo/config
index dd84eec..d8f9b85 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -16,8 +16,8 @@
 # under the License.
 
 [target.aarch64-unknown-optee-trustzone]
-linker = "optee/toolchains/aarch64/bin/aarch64-linux-gnu-ld"
-ar = "optee/toolchains/aarch64/bin/aarch64-linux-gnu-gcc-ar"
+linker = "aarch64-linux-gnu-ld"
+ar = "aarch64-linux-gnu-gcc-ar"
 rustflags = [
     "-C", "link-arg=-e__ta_entry",
     "-C", "link-arg=-nostdlib",
@@ -29,12 +29,12 @@ rustflags = [
 ]
 
 [target.aarch64-unknown-linux-gnu]
-linker = "optee/toolchains/aarch64/bin/aarch64-linux-gnu-gcc"
-ar = "optee/toolchains/aarch64/bin/aarch64-linux-gnu-gcc-ar"
+linker = "aarch64-linux-gnu-gcc"
+ar = "aarch64-linux-gnu-gcc-ar"
 
 [target.arm-unknown-optee-trustzone]
-linker = "optee/toolchains/aarch32/bin/arm-linux-gnueabihf-ld.bfd"
-ar = "optee/toolchains/aarch32/bin/arm-linux-gnueabihf-ar"
+linker = "arm-linux-gnueabihf-ld.bfd"
+ar = "arm-linux-gnueabihf-ar"
 rustflags = [
     "-C", "link-arg=-e__ta_entry",
     "-C", "link-arg=-nostdlib",
@@ -45,5 +45,5 @@ rustflags = [
 ]
 
 [target.arm-unknown-linux-gnueabihf]
-linker = "optee/toolchains/aarch32/bin/arm-linux-gnueabihf-gcc"
-ar = "optee/toolchains/aarch32/bin/arm-linux-gnueabihf-gcc-ar"
+linker = "arm-linux-gnueabihf-gcc"
+ar = "arm-linux-gnueabihf-gcc-ar"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ddfed8e..57a787d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -37,8 +37,8 @@ jobs:
           ln -sf /root/.cargo ~/.cargo
       - name: Building
         run: |
-          make optee &&
           source environment &&
+          make optee &&
           . ~/.cargo/env &&
           rustup default nightly-2019-07-08 &&
           make examples
@@ -60,8 +60,8 @@ jobs:
           ln -sf /root/.cargo ~/.cargo
       - name: Building
         run: |
-          make optee &&
           source environment &&
+          make optee &&
           . ~/.cargo/env &&
           rustup default nightly-2019-07-08 &&
           (cd optee-utee && xargo build --target 
aarch64-unknown-optee-trustzone -vv) &&
diff --git a/Makefile b/Makefile
index 8252bce..f93e717 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-OPTEE_PATH        ?= $(CURDIR)/optee
+OPTEE_PATH        ?= $(OPTEE_DIR)
 OPTEE_BUILD_PATH  ?= $(OPTEE_PATH)/build
 OPTEE_OS_PATH     ?= $(OPTEE_PATH)/optee_os
 OPTEE_CLIENT_PATH ?= $(OPTEE_PATH)/optee_client
@@ -60,6 +60,9 @@ examples-install: $(EXAMPLES_INSTALL)
 $(EXAMPLES_INSTALL):
        install -D 
$(@:%-install=%)/host/target/$(HOST_TARGET)/release/$(@:examples/%-install=%) 
-t out/host/
        install -D $(@:%-install=%)/ta/target/$(TA_TARGET)/release/*.ta -t 
out/ta/
+       if [ -d "$(@:%-install=%)/plugin/target/" ]; then \
+               install -D 
$(@:%-install=%)/plugin/target/$(HOST_TARGET)/release/*.plugin.so -t 
out/plugin/; \
+       fi
 
 optee-os-clean:
        make -C $(OPTEE_OS_PATH) O=out/arm clean
diff --git a/README.md b/README.md
index 8993339..6e06458 100644
--- a/README.md
+++ b/README.md
@@ -43,19 +43,24 @@ $ rustup default 1.44.0 && cargo +1.44.0 install xargo
 $ rustup default nightly-2019-07-08
 ```
 
-Then, download ARM toolchains and build OP-TEE libraries. Note that the OP-TEE
-target is QEMUv8, and you can modify the Makefile to other targets accordingly.
+Before building examples, the environment should be properly setup.
 
 ``` sh
-$ make optee
+$ source environment
 ```
 
-Before building examples, the environment should be properly setup.
+By default, the `OPTEE_DIR` is `incubator-teaclave-trustzone-sdk/optee/`.
+If you already have [OP-TEE repository](https://github.com/OP-TEE) 
+cloned, you can set OP-TEE root directory before source environment:
 
 ``` sh
+$ export OPTEE_DIR=path/to/your/optee/root/directory
 $ source environment
 ```
 
+Note that your OPTEE root directory should have `build/`, `optee_os/` and 
+`optee_client/` as sub-directory.
+
 By default, the target platform is `aarch64`. If you want to build for the 
`arm`
 target, you can setup `ARCH` before source the environment like this:
 
@@ -64,6 +69,13 @@ $ export ARCH=arm
 $ source environment
 ```
 
+Then, download ARM toolchains and build OP-TEE libraries. Note that the OP-TEE
+target is QEMUv8, and you can modify the Makefile to other targets accordingly.
+
+``` sh
+$ make optee
+```
+
 At last, you can get started with our examples.
 
 ``` sh
diff --git a/environment b/environment
index b6ed00c..4168101 100644
--- a/environment
+++ b/environment
@@ -17,7 +17,10 @@
 
 export RUST_TARGET_PATH="$(pwd)"
 export 
RUST_COMPILER_RT_ROOT=$RUST_TARGET_PATH/rust/rust/src/llvm-project/compiler-rt
-export OPTEE_DIR="$(pwd)/optee"
+if [ -z "$OPTEE_DIR" ]
+then
+  export OPTEE_DIR="$(pwd)/optee"
+fi
 export OPTEE_OS_DIR="$OPTEE_DIR/optee_os"
 export OPTEE_CLIENT_DIR="$OPTEE_DIR/optee_client"
 export OPTEE_CLIENT_INCLUDE="$OPTEE_DIR/optee_client/out/export/usr/include"

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to