You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2021/09/08 20:14:13 UTC

[incubator-teaclave-trustzone-sdk] branch master updated: add setup.sh to setup rust environment and initialize rust submodule (#40)

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 7668004  add setup.sh to setup rust environment and initialize rust submodule (#40)
7668004 is described below

commit 76680044fbd7e0c5260474aa6acd4d901258842b
Author: BruceFan <fa...@baidu.com>
AuthorDate: Thu Sep 9 04:14:07 2021 +0800

    add setup.sh to setup rust environment and initialize rust submodule (#40)
---
 README.md | 38 +++++++++++++++-----------------------
 setup.sh  | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/README.md b/README.md
index 6e06458..72f8323 100644
--- a/README.md
+++ b/README.md
@@ -15,13 +15,6 @@ and install building dependencies (The complete list of prerequisites can be fou
 Alternatively, you can use a docker container built with our [Dockerfile](Dockerfile).
 
 ``` sh
-# clone the project and initialize related submodules
-$ git clone git@github.com:apache/incubator-teaclave-trustzone-sdk.git
-$ cd incubator-teaclave-trustzone-sdk
-$ git submodule update --init
-$ (cd rust/compiler-builtins && git submodule update --init libm)
-$ (cd rust/rust && git submodule update --init src/stdsimd)
-
 # install dependencies
 $ sudo apt-get install android-tools-adb android-tools-fastboot autoconf \
         automake bc bison build-essential ccache cscope curl device-tree-compiler \
@@ -32,35 +25,34 @@ $ sudo apt-get install android-tools-adb android-tools-fastboot autoconf \
         python3-pycryptodome python3-pyelftools python-serial python3-serial \
         rsync unzip uuid-dev xdg-utils xterm xz-utils zlib1g-dev
 
-# install Rust and select a proper version
-$ curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2019-07-08
-$ source $HOME/.cargo/env
-$ rustup component add rust-src && rustup target install aarch64-unknown-linux-gnu arm-unknown-linux-gnueabihf
-
-# install Xargo
-$ rustup default 1.44.0 && cargo +1.44.0 install xargo
-# switch to nightly
-$ rustup default nightly-2019-07-08
+# clone the project
+$ git clone git@github.com:apache/incubator-teaclave-trustzone-sdk.git
+$ cd incubator-teaclave-trustzone-sdk
+# initialize related submodules and install Rust environment
+$ ./setup.sh
 ```
 
-Before building examples, the environment should be properly setup.
-
+By default, the `OPTEE_DIR` is `incubator-teaclave-trustzone-sdk/optee/`.
 ``` sh
-$ source environment
+# initialize OP-TEE submodule
+$ git submodule update --init -- optee
 ```
-
-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:
+cloned, you can set OP-TEE root directory:
 
 ``` 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.
 
+Before building examples, the environment should be properly setup.
+
+``` sh
+$ source environment
+```
+
 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:
 
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..59f405f
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# 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.
+
+# install Rust and select a proper version
+curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2019-07-08
+source $HOME/.cargo/env
+rustup component add rust-src && rustup target install aarch64-unknown-linux-gnu arm-unknown-linux-gnueabihf
+
+# install Xargo
+rustup default 1.44.0 && cargo +1.44.0 install xargo
+# switch to nightly
+rustup default nightly-2019-07-08
+
+# initialize Teaclave TrustZone SDK submodule
+git submodule update --init -- rust
+cd rust/compiler-builtins && git submodule update --init libm
+cd ../rust && git submodule update --init src/stdsimd

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org