Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optee-utee-build crate #156

Merged
merged 3 commits into from
Dec 31, 2024
Merged

Add optee-utee-build crate #156

merged 3 commits into from
Dec 31, 2024

Conversation

ivila
Copy link
Contributor

@ivila ivila commented Dec 20, 2024

  1. add optee-utee-build crate to make building process simpler
  2. use optee-utee-build to build hello_world example
  3. fix pipeline

this PR relates to #155, and should resolves #135 too.

@b49020
Copy link
Contributor

b49020 commented Dec 20, 2024

  1. add optee-utee-build crate to make building process simpler
  2. use optee-utee-build to build hello_world example

Split these into separate commits and also add documentation as a separate commit to describe APIs exposed by optee-utee-build for TA developers.

  1. fix pipeline

I suppose it's independent of this PR which is something @DemesneGH should be able to fix in the dockerfile with required dependencies for CI. We want to keep testing with latest OP-TEE mainline build rather than sticking to a stable release.

@ivila
Copy link
Contributor Author

ivila commented Dec 20, 2024

also add documentation as a separate commit

@b49020 May I ask what the documentation you points to, the README.md or the comments in rust codes?

@b49020
Copy link
Contributor

b49020 commented Dec 20, 2024

also add documentation as a separate commit

@b49020 May I ask what the documentation you points to, the README.md or the comments in rust codes?

I will suggest to create a dedicated document titled something like "Tutorial: Writing Rust TAs using optee-utee-build" under https://github.com/apache/incubator-teaclave-trustzone-sdk/tree/main/docs

@DemesneGH
Copy link
Contributor

I suppose it's independent of this PR which is something @DemesneGH should be able to fix in the dockerfile with required dependencies for CI.

Sure, I'm working on that.

@ivila
Copy link
Contributor Author

ivila commented Dec 20, 2024

I still have some changes to make and I am writing the document of how to use this crate, everything should be done in 3 days, so we can pause reviewing this PR and wait until I am finish with it.

@ivila
Copy link
Contributor Author

ivila commented Dec 23, 2024

@b49020 @DemesneGH PR fixed.

@ivila
Copy link
Contributor Author

ivila commented Dec 23, 2024

Update to remove the confusing extra properties of gp.ta.version and gp.ta.description, as in this commit jforissier said they are just misleading TA properties:
image

@DemesneGH
Copy link
Contributor

I suppose it's independent of this PR which is something @DemesneGH should be able to fix in the dockerfile with required dependencies for CI.

Sure, I'm working on that.

The PR for CI fix: #157.

@ivila
Copy link
Contributor Author

ivila commented Dec 24, 2024

update to use latest ci

docs/migrating-to-new-building-env.md Outdated Show resolved Hide resolved
optee-utee-build/Cargo.toml Show resolved Hide resolved
.licenserc.yaml Outdated Show resolved Hide resolved
examples/hello_world-rs/ta/Makefile Show resolved Hide resolved
optee-utee-build/src/linker.rs Outdated Show resolved Hide resolved
optee-utee-build/src/ta_config.rs Outdated Show resolved Hide resolved
optee-utee-build/src/ta_config.rs Outdated Show resolved Hide resolved
optee-utee-build/Cargo.toml Show resolved Hide resolved
@ivila ivila force-pushed the main branch 2 times, most recently from 5f6e455 to f59a40a Compare December 26, 2024 06:24
@b49020
Copy link
Contributor

b49020 commented Dec 27, 2024

Thanks @ivila for your efforts addressing review comments, the last one pending for me is here. With that addressed, feel free to add:

Reviewed-by: Sumit Garg <[email protected]>

@b49020
Copy link
Contributor

b49020 commented Dec 27, 2024

Once this PR gets merged, let's make all the examples to use optee-utee-build crate too which can be a followup PR.

@ivila
Copy link
Contributor Author

ivila commented Dec 31, 2024

Is there anything I miss? I think this PR is inactive for a long time.😐

@ivila ivila force-pushed the main branch 2 times, most recently from 65f9a5c to d6792ba Compare December 31, 2024 02:45
Copy link
Contributor

@DemesneGH DemesneGH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some minor recommendations resolved please feel free to add: Reviewed-by: Yuan Zhuang <[email protected]>

1. introduce build method to make building process simpler.
2. introduce Builder struct for developers who want to customize the
   building process.
3. introduce HeaderFileGenerator struct for developers who want to
   generate a header file only.
4. introduce Linker struct for developers who want to handle linking
   stuff only.

Signed-off-by: ivila <[email protected]>
Reviewed-by: Sumit Garg <[email protected]>
Reviewed-by: Yuan Zhuang <[email protected]>
@ivila
Copy link
Contributor Author

ivila commented Dec 31, 2024

update to add reviewer

@DemesneGH
Copy link
Contributor

Thanks! Will merge after the CI passed.

@DemesneGH
Copy link
Contributor

@ivila CI failed because:

24-12-31T02:52:27.0302935Z    Compiling ta v0.2.0 (/__w/incubator-teaclave-trustzone-sdk/incubator-teaclave-trustzone-sdk/examples/hello_world-rs/ta)
2024-12-31T02:52:27.0773416Z error[E0432]: unresolved import `optee_utee_build::TAConfig`
2024-12-31T02:52:27.0774266Z   --> build.rs:19:24
2024-12-31T02:52:27.0774662Z    |
2024-12-31T02:52:27.0775144Z 19 | use optee_utee_build::{TAConfig, RustEdition, Error};
2024-12-31T02:52:27.0776717Z    |                        ^^^^^^^^
2024-12-31T02:52:27.0777049Z    |                        |
2024-12-31T02:52:27.0777428Z    |                        no `TAConfig` in the root
2024-12-31T02:52:27.0777908Z    |                        help: a similar name exists in the module: `TaConfig`
2024-12-31T02:52:27.0778270Z 
2024-12-31T02:52:27.0819894Z For more information about this error, try `rustc --explain E0432`.
2024-12-31T02:52:27.0909479Z error: could not compile `ta` (build script) due to 1 previous error

@ivila
Copy link
Contributor Author

ivila commented Dec 31, 2024

@ivila CI failed because:

24-12-31T02:52:27.0302935Z    Compiling ta v0.2.0 (/__w/incubator-teaclave-trustzone-sdk/incubator-teaclave-trustzone-sdk/examples/hello_world-rs/ta)
2024-12-31T02:52:27.0773416Z error[E0432]: unresolved import `optee_utee_build::TAConfig`
2024-12-31T02:52:27.0774266Z   --> build.rs:19:24
2024-12-31T02:52:27.0774662Z    |
2024-12-31T02:52:27.0775144Z 19 | use optee_utee_build::{TAConfig, RustEdition, Error};
2024-12-31T02:52:27.0776717Z    |                        ^^^^^^^^
2024-12-31T02:52:27.0777049Z    |                        |
2024-12-31T02:52:27.0777428Z    |                        no `TAConfig` in the root
2024-12-31T02:52:27.0777908Z    |                        help: a similar name exists in the module: `TaConfig`
2024-12-31T02:52:27.0778270Z 
2024-12-31T02:52:27.0819894Z For more information about this error, try `rustc --explain E0432`.
2024-12-31T02:52:27.0909479Z error: could not compile `ta` (build script) due to 1 previous error

Sorry about that, I always miss the example part😂

1. add optee-utee-build in build-dependencies
2. remove uuid from build-dependencies
3. use build method from optee-utee-build instead of custom build script
4. use gcc as linker instead of ld.bfd to avoid compilation problems on
   Arm host
5. remove ta_static.rs file
6. remove configuration consts in src/main.rs

Signed-off-by: ivila <[email protected]>
Reviewed-by: Sumit Garg <[email protected]>
Reviewed-by: Yuan Zhuang <[email protected]>
1. add document "Writing Rust TAs using optee-utee-build"
2. suggest developers using optee-utee-build in
   "Migrating to new building env"
3. add description about the supported host machines in README.md

Signed-off-by: ivila <[email protected]>
Reviewed-by: Sumit Garg <[email protected]>
Reviewed-by: Yuan Zhuang <[email protected]>
@ivila
Copy link
Contributor Author

ivila commented Dec 31, 2024

update to fix the compilation error of hello-world example

@DemesneGH DemesneGH merged commit 131a55a into apache:main Dec 31, 2024
7 checks passed
@DemesneGH
Copy link
Contributor

FYI the optee-utee-build crate has been published on https://crates.io/crates/optee-utee-build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build issues on aarch64 Linux hosts
3 participants