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

Yocto Linux meta recipe for wolfTPM examples #92

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

aidangarske
Copy link

@aidangarske aidangarske commented Oct 24, 2024

Description

Added recipes-examples/wolftpm/wolftpm-wrap-test.bb and recipes-examples/wolftpm/wolftpm_%.bbappend to add support for wolfTPM wrap_test example.
IMAGE_INSTALL argument for wolftpm examples -> wolftpm-wrap-test
Tested on Scarthgap and Kirkstone works on both now.
Runs in runqemu qemux86-64 in usr/bin examplescan be ran like this:

./wolftpm-wrap-test

Copy link
Contributor

@night1rider night1rider left a comment

Choose a reason for hiding this comment

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

Few things that need to happen before we can merge this.

Copy link
Contributor

@night1rider night1rider left a comment

Choose a reason for hiding this comment

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

Seems to be a path issue, it is use the original host system's path and not the target systems.

@night1rider
Copy link
Contributor

night1rider commented Feb 3, 2025

Reviewed again and it seems that resulting script that gets created by libtool uses the host system's paths and not the target systems paths.

Examples: relink_command="(cd /home/msi-debian/WolfWork/yocto/kirkstone/build/tmp/work/core2-64-poky-linux/wolftpm/3.2.0-r0/build; { test -z \" when /home/msi-debian/WolfWork/yocto/kirkstone/build/tmp/work/core2-64-poky-linux/wolftpm/3.2.0-r0/build should be set to /usr/bin as the instructions allude to.

This goes the same for all the tool paths as well so gcc and other tools the script needs don't point to the target's path but the host builder's paths.

Is there a way to override these and provide a path so the libtool script gets generated correctly or is this a change needed in the tooling of wolfTPM?

@dgarske dgarske removed the request for review from cconlon February 5, 2025 19:17
@dgarske dgarske self-assigned this Feb 5, 2025
@dgarske dgarske self-assigned this Feb 28, 2025
@aidangarske aidangarske removed their assignment Feb 28, 2025
@dgarske dgarske assigned aidangarske and unassigned dgarske Mar 5, 2025
@aidangarske aidangarske requested a review from dgarske March 6, 2025 20:32
@aidangarske aidangarske assigned dgarske and night1rider and unassigned aidangarske Mar 6, 2025
dgarske
dgarske previously approved these changes Mar 7, 2025
Copy link
Contributor

@night1rider night1rider left a comment

Choose a reason for hiding this comment

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

I tested this and now it does seem to execute however the output is lacking?
Is this the expect output of the wrap-test?

root@qemux86-64:~# wolftpm-wrap-test 
TPM2 Demo for Wrapper API's
root@qemux86-64:~# 

Am I missing some setup, instructions, or packages?

@aidangarske
Copy link
Author

@night1rider @dgarske This is the expected output for the wrap test without a tpm simulator. If you wanted to run the full test you need to have a tpm simulator loaded onto your image as well and start the simulator before you run the test. Just like if you were running it locally.
I have not tested with the simulator. If you think it would be a good idea to test this fully I can. But this is the same output we get running locally without the simulator. I'll update the readme with this information. So users know to start their tpm/sim before executing the test.

@aidangarske aidangarske self-assigned this Mar 7, 2025
@dgarske
Copy link
Contributor

dgarske commented Mar 7, 2025

@night1rider @dgarske This is the expected output for the wrap test without a tpm simulator. If you wanted to run the full test you need to have a tpm simulator loaded onto your image as well and start the simulator before you run the test. Just like if you were running it locally. I have not tested with the simulator. If you think it would be a good idea to test this fully I can. But this is the same output we get running locally without the simulator. I'll update the readme with this information. So users know to start their tpm/sim before executing the test.

@aidangarske please add instructions to the README.md for how to setup the TPM simulator with Yocto and QEMU.

Copy link
Contributor

@night1rider night1rider left a comment

Choose a reason for hiding this comment

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

Seems that there are some missing instructions or dependencies not indicated in the README.

these commands in the build directory:
```
bitbake wolftpm
bitbake wolftpm-examples
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be bitbake wolftpm-wrap-test not bitbake wolftpm-examples

```

To add wolfTPM configurations you can add configurations to the
EXTRA_OECONF variable. For example you can enable debug logging like
Copy link
Contributor

Choose a reason for hiding this comment

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

Please specify this configuration variable needs to be in a wolftpm_%.bbappened to avoid confusion

Comment on lines +26 to +31
tpm2-tools \
tpm2-tss \
libtss2 \
libtss2-mu \
libtss2-tcti-device \
libtss2-tcti-mssim \
Copy link
Contributor

Choose a reason for hiding this comment

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

I am getting a ERROR: Nothing RPROVIDES for all these packages other than the wolfssl/tpm ones, this means that yocto cannot find a package/recipe with the names of all these libraries/tools. Do you have some external meta library plugged in that is not specified here in the README? This would be in your build/conf/bblayers.conf file.

I am using kirkstone, is it possible these tools are included by default with a newer release of yocto?

```
bitbake core-image-minimal
```

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing step to enter qemu for the created target image. I use runqemu nographic is this appropriate?


4. Start the TPM simulator (in terminal 1):
```
sudo swtpm socket --tpmstate dir=/tmp/mytpm1 \
Copy link
Contributor

Choose a reason for hiding this comment

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

swtpm is not found. I assume this has to do with the missing packages as described earlier.

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.

4 participants