This is an automated email from the ASF dual-hosted git repository. yuanz pushed a commit to branch release-v0.2.0 in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git
commit a65b0ffe39276b865c04d93cd1526931fcb7724c Author: Yuan Zhuang <[email protected]> AuthorDate: Fri Mar 18 07:14:51 2022 +0800 Remove git submodules (#63) * Remove git submodules - Remove git submodules optee/ and rust/ - Initialize optee/ and rust/ submodules in setup.sh - Update ci.yml * Update the getting started documentation * Remove .gitmodules --- .github/workflows/ci.yml | 2 ++ .gitmodules | 21 ------------ README.md | 46 ++++++++++++++++++------- optee/build | 1 - optee/optee_client | 1 - optee/optee_os | 1 - rust/compiler-builtins | 1 - rust/libc | 1 - rust/rust | 1 - setup.sh | 88 +++++++++++++++++++++++++++++++++++++++++++++--- 10 files changed, 119 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df22076..e5aa727 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: ln -sf /root/.cargo ~/.cargo - name: Building run: | + ./setup.sh && source environment && make optee && . ~/.cargo/env && @@ -62,6 +63,7 @@ jobs: ln -sf /root/.cargo ~/.cargo - name: Building run: | + ./setup.sh && source environment && make optee && . ~/.cargo/env && diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 48bfdb9..0000000 --- a/.gitmodules +++ /dev/null @@ -1,21 +0,0 @@ -[submodule "optee/build"] - path = optee/build - url = https://github.com/OP-TEE/build.git -[submodule "optee/optee_os"] - path = optee/optee_os - url = https://github.com/OP-TEE/optee_os.git -[submodule "optee/optee_client"] - path = optee/optee_client - url = https://github.com/OP-TEE/optee_client.git -[submodule "rust/rust"] - path = rust/rust - url = https://github.com/mesalock-linux/rust.git - branch = teaclave-trustzone-sdk-1.56.1 -[submodule "rust/libc"] - path = rust/libc - url = https://github.com/mesalock-linux/libc.git - branch = teaclave-trustzone-sdk-0.2.99 -[submodule "rust/compiler-builtins"] - path = rust/compiler-builtins - url = https://github.com/mesalock-linux/compiler-builtins.git - branch = teaclave-trustzone-sdk-0.1.44 diff --git a/README.md b/README.md index d5cd63d..0c025c5 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,10 @@ crates). Teaclave TrustZone SDK is a sub-project of [Apache Teaclave (incubating ## Getting started -To get started, you need to clone the project, initialize related submodules, -and install building dependencies (The complete list of prerequisites can be found here: [OP-TEE Prerequisites](https://optee.readthedocs.io/en/latest/building/prerequisites.html)). +#### 1. Clone the project and install building dependencies + +The complete list of prerequisites can be found here: [OP-TEE Prerequisites](https://optee.readthedocs.io/en/latest/building/prerequisites.html). + Alternatively, you can use a docker container built with our [Dockerfile](Dockerfile). ``` sh @@ -32,16 +34,11 @@ $ sudo apt-get install android-tools-adb android-tools-fastboot autoconf \ # clone the project $ git clone [email protected]:apache/incubator-teaclave-trustzone-sdk.git $ cd incubator-teaclave-trustzone-sdk -# initialize related submodules and install Rust environment -$ ./setup.sh ``` -By default, the `OPTEE_DIR` is `incubator-teaclave-trustzone-sdk/optee/`. -``` sh -# initialize OP-TEE submodule -$ git submodule update --init -- optee -``` -If you already have [OP-TEE repository](https://github.com/OP-TEE) +#### 2. Install Rust environment and initialize related submodules + +* 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: ``` sh @@ -51,6 +48,16 @@ $ export OPTEE_DIR=path/to/your/optee/root/directory Note that your OPTEE root directory should have `build/`, `optee_os/` and `optee_client/` as sub-directory. + + +* Run the script as follows to install Rust environment and set up submodules in `optee/` and `rust/`. + +``` +$ ./setup.sh +``` + +#### 3. Set environment variables + Before building examples, the environment should be properly setup. ``` sh @@ -65,6 +72,8 @@ $ export ARCH=arm $ source environment ``` +#### 4. Build OP-TEE libraries + 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. @@ -72,12 +81,22 @@ target is QEMUv8, and you can modify the Makefile to other targets accordingly. $ make optee ``` -At last, you can get started with our examples. +#### 5. Build Rust examples + +Run this command to build all Rust examples: ``` sh $ make examples ``` +Collect all example CAs and TAs to `/incubator-teaclave-trustzone-sdk/out`: + +``` sh +$ make examples-install +``` + +#### 6. Run Rust examples + Please read detailed [instructions](https://teaclave.apache.org/trustzone-sdk-docs/getting-started-with-optee-for-qemu-armv8/) to run these examples on OP-TEE for QEMU. For other supported devices, please find @@ -85,8 +104,9 @@ more documents [here](https://optee.readthedocs.io/en/latest/general/platforms.h ## Documentation -- [Getting Started with OPTEE for QEMU ARMv8](docs/getting-started-with-optee-for-qemu-armv8.md) -- [Overview of OP-TEE Rust Examples](docs/overview-of-optee-rust-examples.md) +- [Getting Started with OPTEE for QEMU ARMv8](https://teaclave.apache.org/trustzone-sdk-docs/getting-started-with-optee-for-qemu-armv8/) +- [Overview of OP-TEE Rust Examples](https://teaclave.apache.org/trustzone-sdk-docs/overview-of-optee-rust-examples/) +- [Debugging OP-TEE TA](https://teaclave.apache.org/trustzone-sdk-docs/debugging-optee-ta.md/) - [Host API Reference](https://teaclave.apache.org/api-docs/trustzone-sdk/optee-teec/) - [TA API Reference](https://teaclave.apache.org/api-docs/trustzone-sdk/optee-utee/) diff --git a/optee/build b/optee/build deleted file mode 160000 index 6a868e3..0000000 --- a/optee/build +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a868e301304a7b3cdf8c10b684331bf81b6af1d diff --git a/optee/optee_client b/optee/optee_client deleted file mode 160000 index 06db73b..0000000 --- a/optee/optee_client +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 06db73b3f3fdb8d23eceaedbc46c49c0b45fd1e2 diff --git a/optee/optee_os b/optee/optee_os deleted file mode 160000 index d0b742d..0000000 --- a/optee/optee_os +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d0b742d1564834dac903f906168d7357063d5459 diff --git a/rust/compiler-builtins b/rust/compiler-builtins deleted file mode 160000 index 45a2e49..0000000 --- a/rust/compiler-builtins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 45a2e4996fe732172004b292b07397f9a02265ab diff --git a/rust/libc b/rust/libc deleted file mode 160000 index 1ddfbbb..0000000 --- a/rust/libc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1ddfbbbc190bec0f5ec32b08e97585b34d0c6b09 diff --git a/rust/rust b/rust/rust deleted file mode 160000 index 6abda66..0000000 --- a/rust/rust +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6abda667852184641149d34da4730d96ba4f7d31 diff --git a/setup.sh b/setup.sh index 4bfada5..04fb8d5 100755 --- a/setup.sh +++ b/setup.sh @@ -17,6 +17,9 @@ # specific language governing permissions and limitations # under the License. +set -xe + +########################################## # install Rust and select a proper version curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2021-09-20 source $HOME/.cargo/env @@ -27,7 +30,84 @@ rustup default 1.44.0 && cargo +1.44.0 install xargo # switch to nightly rustup default nightly-2021-09-20 -# 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 library/stdarch && git submodule update --init library/backtrace +######################################################## +# initialize submodules: optee_os / optee_client / build +OPTEE_RELEASE_VERSION=3.16.0 + +if [[ -z $OPTEE_DIR ]] || [[ $OPTEE_DIR==$PWD/optee ]] +then + OPTEE_DIR=$PWD/optee + echo optee dir: $OPTEE_DIR + OPTEE_SUBMODULES=("optee_os" "optee_client" "build") + + if [ ! -d $OPTEE_DIR ] + then + mkdir $OPTEE_DIR + else + rm -r $OPTEE_DIR/* + fi + + # download optee release + echo "Downloading optee release..." + for submodule in ${OPTEE_SUBMODULES[*]} + do + echo "Downloading $submodule..." + curl --retry 5 -s -S \ + -L https://github.com/OP-TEE/$submodule/archive/refs/tags/$OPTEE_RELEASE_VERSION.tar.gz \ + -o $OPTEE_DIR/$OPTEE_RELEASE_VERSION.tar.gz + if [ ! $? -eq 0 ] + then + rm $OPTEE_DIR/$OPTEE_RELEASE_VERSION.tar.gz && \ + echo "Download failed" && \ + exit 1 + fi + echo "Uncompressing $submodule..." + mkdir -p $OPTEE_DIR/$submodule && \ + tar zxf $OPTEE_DIR/$OPTEE_RELEASE_VERSION.tar.gz \ + -C $OPTEE_DIR/$submodule --strip-components 1 + if [ ! $? -eq 0 ] + then + rm $OPTEE_DIR/$OPTEE_RELEASE_VERSION.tar.gz && \ + rm -r $OPTEE_DIR/$submodule && \ + echo "Downloaded file is damaged" && \ + exit 1 + fi + rm $OPTEE_DIR/$OPTEE_RELEASE_VERSION.tar.gz + done + echo "Download finished" +else + echo "OPTEE_DIR has been set, omit to download optee submodules" +fi + + +######################################################## +# initialize submodules: rust / compiler-builtins / libc +RUST_COMMIT_ID=6abda667852184641149d34da4730d96ba4f7d31 +COMPILER_BUILTINS_COMMIT_ID=45a2e4996fe732172004b292b07397f9a02265ab +LIBC_COMMIT_ID=1ddfbbbc190bec0f5ec32b08e97585b34d0c6b09 + +if [ ! -d rust/ ] +then + mkdir rust/ +else + rm -r rust/* +fi + +cd rust + +git clone https://github.com/mesalock-linux/rust.git && \ + (cd rust && \ + git checkout $RUST_COMMIT_ID && \ + git submodule update --init library/stdarch && \ + git submodule update --init library/backtrace) + +git clone https://github.com/mesalock-linux/compiler-builtins.git && \ + (cd compiler-builtins && \ + git checkout $COMPILER_BUILTINS_COMMIT_ID && \ + git submodule update --init libm) + +git clone https://github.com/mesalock-linux/libc.git && \ + (cd libc && \ + git checkout $LIBC_COMMIT_ID) + +echo "Rust submodules initialized" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
