Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,102 @@ jobs:
ln -s $RUST_STD_DIR rust
make std-examples

# Test cargo-optee build no-std examples - aarch64
test-cargo-optee-nostd-aarch64:
runs-on: ubuntu-latest
container:
image: teaclave/teaclave-trustzone-emulator-nostd-expand-memory:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
# Run entrypoint.sh to set up the bash profile
/entrypoint.sh true
# Install jq for JSON parsing
apt-get update && apt-get install -y jq
- name: Test cargo-optee no-std build (aarch64)
shell: bash -l {0} # Use login shell to load the profile
run: |
# Build using cargo-optee tool with default aarch64 settings
./ci/build.sh

# Test cargo-optee build no-std examples - arm32
test-cargo-optee-nostd-arm32:
runs-on: ubuntu-latest
container:
image: teaclave/teaclave-trustzone-emulator-nostd-expand-memory:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
# Run entrypoint.sh to set up the bash profile
/entrypoint.sh true
# Install jq for JSON parsing
apt-get update && apt-get install -y jq
- name: Test cargo-optee no-std build (arm32)
shell: bash -l {0} # Use login shell to load the profile
run: |
# Switch to ARM32 configuration and build
# Note: Explicit environment reload needed for GitHub Actions
# (wrapper function in .bashrc not working for non-interactive shells: docker exec cmd=[...])
# We can fix this by updating entrypoint.sh to make ~/.profile source ~/.bashrc
switch_config --ta no-std/arm32 && \
switch_config --host arm32 && \
source ${TEACLAVE_TOOLCHAIN_BASE}/environment && \
./ci/build.sh --ta arm --host arm

# Test cargo-optee build std examples - aarch64
test-cargo-optee-std-aarch64:
runs-on: ubuntu-latest
container:
image: teaclave/teaclave-trustzone-emulator-std-expand-memory:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
# Run entrypoint.sh to set up the bash profile
/entrypoint.sh true
# Install jq for JSON parsing
apt-get update && apt-get install -y jq
- name: Test cargo-optee std build (aarch64)
shell: bash -l {0} # Use login shell to load the profile
run: |
# Link rust directory for std support
ln -s $RUST_STD_DIR rust
# Build using cargo-optee tool with default aarch64 std settings
./ci/build.sh --std

# Test cargo-optee build std examples - arm32
test-cargo-optee-std-arm32:
runs-on: ubuntu-latest
container:
image: teaclave/teaclave-trustzone-emulator-std-expand-memory:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup environment
run: |
# Run entrypoint.sh to set up the bash profile
/entrypoint.sh true
# Install jq for JSON parsing
apt-get update && apt-get install -y jq
- name: Test cargo-optee std build (arm32)
shell: bash -l {0} # Use login shell to load the profile
run: |
# Link rust directory for std support
ln -s $RUST_STD_DIR rust
# Switch to ARM32 std configuration and build
# Note: Explicit environment reload needed for GitHub Actions
# (wrapper function in .bashrc not working for non-interactive shells: docker exec cmd=[...])
# We can fix this by updating entrypoint.sh to make ~/.profile source ~/.bashrc
switch_config --ta std/arm32 && \
switch_config --host arm32 && \
source ${TEACLAVE_TOOLCHAIN_BASE}/environment && \
./ci/build.sh --ta arm --host arm --std

license:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ header:
- '**/Cargo.lock'
- 'KEYS'
- 'DISCLAIMER'
- '*.json'
- '**/*.json'
- 'examples/tls_server-rs/ta/test-ca/**'
- '**/uuid.txt'
- '**/plugin_uuid.txt'
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ The Docker image automates the entire setup process for TrustZone emulation
in QEMU, enabling you to focus on writing and testing your applications
efficiently, without the hassle of manual configuration.

**UPDATES:** We have introduced a more convenient build tool, [cargo-optee](./cargo-optee/README.md),
which provides better abstraction and a more ergonomic developer experience. In the long term,
we plan to gradually move away from the Makefile + Cargo workflow and adopt a more idiomatic Rust-based
development approach. To ensure a smooth transition, the existing Makefile-based build components are
still retained and supported.

**Choose your development mode in Emulator:**
- 🚀 [Quick Emulation And Development in Docker](docs/emulate-and-dev-in-docker.md)
- 🚀 [Developing TAs with Rust Standard Library](docs/emulate-and-dev-in-docker-std.md)
Expand Down
42 changes: 42 additions & 0 deletions cargo-optee/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.

[package]
name = "cargo-optee"
version = "0.1.0"
authors = ["Teaclave Contributors <[email protected]>"]
license = "Apache-2.0"
repository = "https://github.com/apache/teaclave-trustzone-sdk.git"
description = "A cargo subcommand for building OP-TEE Trusted Applications"
edition = "2021"

[[bin]]
name = "cargo-optee"
path = "src/main.rs"

[dependencies]
clap = { version = "4.5", features = ["derive"] }
anyhow = "1.0"
cargo_metadata = "0.18"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
toml = "0.8"
indexmap = "=2.11.4"
env_logger = "0.11"
log = "0.4"
tempfile = "3.8"
dirs = "5.0"
Loading
Loading