test example is now wolftpm-wrap-test made the paths correct and temp stored in .libs for libtools

pull/92/head
Aidan Garske 2025-02-28 10:57:02 -08:00
parent 0e7cb36e8a
commit b11b47c43a
5 changed files with 84 additions and 108 deletions

View File

@ -26,7 +26,7 @@ These recipes have been tested using these versions of yocto:
- Dunfell (v3.1)
- Zeus (v3.0)
- Thud (v2.6)
- Sumo (v2.5)
- Sumo (v2.5)
The wolfSSL library recipe is also included in the openembedded meta-networking
layer, located [here](https://github.com/openembedded/meta-openembedded/tree/master/meta-networking/recipes-connectivity/wolfssl).
@ -52,7 +52,8 @@ git clone https://github.com/wolfSSL/meta-wolfssl.git
After installing your build's Yocto/OpenEmbedded components:
1. Insert the 'meta-wolfssl' layer location into your build's bblayers.conf
1. Insert the 'meta-wolfssl' layer in `build/conf/bblayers.conf` location
into your build's bblayers.conf
file, in the BBLAYERS section:
```
@ -65,20 +66,20 @@ After installing your build's Yocto/OpenEmbedded components:
2. Once the 'meta-wolfssl' layer has been added to your BBLAYERS collection,
you have two options
1. If you want to directly add wolfSSL recipes to your image recipe
1. If you want to directly add wolfSSL recipes to your image recipe
proceed to step 3.
2. If you want to run `bitbake wolf*` on a particular recipe then it needs
2. If you want to run `bitbake wolf*` on a particular recipe then it needs
to be added to the IMAGE_INSTALL.
This can be done by adding the following line to `local.conf` located in
`path/to/poky/build/conf`.
This can be done by adding the following line to `local.conf` located in
`path/to/poky/build/conf`.
- For Dunfell and newer versions of Yocto:
```
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm "
```
- For versions of Yocto older than Dunfell:
```
@ -95,14 +96,14 @@ After installing your build's Yocto/OpenEmbedded components:
3. Edit your build's local.conf file to install the recipes you would like
to include (ie: wolfssl, wolfssh, wolfmqtt, wolftpm)
to include (ie: wolfssl, wolfssh, wolfmqtt, wolftpm)
- For Dunfell and newer versions of Yocto
```
IMAGE_INSTALL:append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu "
```
- For versions of Yocto older than Dunfell
```
IMAGE_INSTALL_append = " wolfssl wolfssh wolfmqtt wolftpm wolfclu "
@ -112,8 +113,8 @@ After installing your build's Yocto/OpenEmbedded components:
specific combination of recipes.
If you did step 2.2 make sure you comment out recipes that you don't desire
because leaving them uncommented may add unneed --enable-* options in your
build, which could increase the size of the build and turn on uneeded
because leaving them uncommented may add unneed --enable-* options in your
build, which could increase the size of the build and turn on uneeded
features.
Once your image has been built, the default location for the wolfSSL library
@ -198,8 +199,8 @@ This layer offers wolfSSL support for the following open source projects:
- [curl](https://layers.openembedded.org/layerindex/recipe/5765/)
- [OpenSSH](https://layers.openembedded.org/layerindex/recipe/5083/)
Example Application Recipes
---------------------------
wolfSSL Example Application Recipes
-----------------------------------
Several wolfSSL example application recipes are included in this layer. These
include:
@ -241,6 +242,46 @@ When your image builds, these will be installed to the '/usr/bin' system
directory. When inside your executing image, you can run them from the
terminal.
wolfTPM Example Application Recipes
-----------------------------------
wolfTPM example `wrap_test` is included in this layer.
The recipes for this applications are located at:
```
meta-wolfssl/recipes-examples/wolftpm/wolftpm-wrap-test.bb
```
You'll need to compile wolTPM and the example wrap_test. This can be done
with these commands in the build directory:
```
$ bitbake wolftpm
$ bitbake wolftpm-wrap-test
```
To install this applications into your image, you will need to edit your
`build/conf/local.conf` file and add `wolftpm` and `wolftpm-wrap-test` to
your "IMAGE_INSTALL" variable like so:
- For Dunfell and newer versions of Yocto
```
IMAGE_INSTALL:append = " wolftpm wolftpm-wrap-test"
```
- For versions of Yocto older than Dunfell
```
IMAGE_INSTALL_append = " wolftpm wolftpm-wrap-test"
```
When your image builds, this will be installed to the `/usr/bin` system
directory. When inside your executing image, you can run them from the
terminal like so:
```
./wolftpm-wrap-test
```
Excluding Recipe from Build
---------------------------
@ -253,10 +294,10 @@ Wolfssl-py and Wolfcrypt-py Installation Requirements
To use the python wrapper for wolfSSL and wolfcrypt in a yocto build it will
require python3, python3-cffi and wolfSSL are built on the target system.
If you are using older version of yocto (2.x) or (3.x), you will need to download
If you are using older version of yocto (2.x) or (3.x), you will need to download
and add the meta-oe and meta-python recipes from openembedded's [meta-openembedded](https://github.com/openembedded/meta-openembedded) to the image.
It will be necassary then to make sure at minimum that the IMAGE_INSTALL:append
It will be necassary then to make sure at minimum that the IMAGE_INSTALL:append
looks as follows:
- For Dunfell and newer versions of Yocto
@ -293,7 +334,7 @@ Testing Wolfssl-py and Wolfcrypt-py
To test the python wrapper for wolfSSL and wolfcrypt in a yocto build it will
require python3, python3-pytest, python3-cffi and wolfSSL are built on the target system.
It will be necassary then to make sure at minimum that the IMAGE_INSTALL:append
It will be necassary then to make sure at minimum that the IMAGE_INSTALL:append
looks as follows:
@ -334,7 +375,7 @@ $ pytest
This should then result in a pass or fail for the desired suit.
If you are testing this with the core-image-minimal yocto build, make sure
If you are testing this with the core-image-minimal yocto build, make sure
to add a DNS server to /etc/resolv.conf like such with root perms
```
@ -346,6 +387,8 @@ Running Image on the QEMU
To run meta-wolfssl image on the QEMU (Quick EMUlator) you can follow these
general steps. For this example we will use the Yocto Project Poky.
Refer to:
[Yocto Project](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html) for a detailed guide.
1. Initialize the Build
This can be done by running these commands:
@ -360,20 +403,20 @@ bitbake in the build directory.
2. Run bitbake
Next you can run bitbake to build the OS image that you want. Make sure
you have the correct variables added in the `local.conf` For this example
we will run `core-image-base`. Which can be built by running this comamnd
you have the correct variables added in the `local.conf` For this example
we will run `core-image-base`. Which can be built by running this comamnd
from the `build` directoy:
```
$ bitbake core-image-base
```
This will run bitbake and build the image with your added
This will run bitbake and build the image with your added
meta-wolfssl recipes.
3. Run the Image in QEMU
You can now simulate your image with the QEMU This can be done by running
the qemu that comes in your Yocto Project the default system is usually
the qemu that comes in your Yocto Project the default system is usually
`qemux86-64` but you can find what its set to by looking at your `local.conf`.
We can run this command to start the emulator:
@ -383,7 +426,7 @@ $ runqemu qemux86-64
4. Run Your Recipes
Now that you are in the QEMU you can navigate your way to the `usr/bin`
directory which contains the your wolfssl your applications. Lets say we
directory which contains the your wolfssl your applications. Lets say we
included these images in our `local.conf`
```
@ -398,7 +441,7 @@ $ ./wolfcrypttest
$ ./wolfcryptbenchmark
```
This will run the wolfcrypt test and benchmark examples from the QEMU.
This will run the wolfcrypt test and benchmark examples from the QEMU.
wolfProvider
------------

View File

@ -41,7 +41,7 @@ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'', d)}"
BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'wolftpm-examples', \
'wolftpm-wrap-test', \
'${LAYERDIR}/recipes-examples/wolftpm/*.bb ${LAYERDIR}/recipes-examples/wolftpm/*.bbappend', \
'', d)}"

View File

@ -1,67 +0,0 @@
wolfTPM Examples
================
Several wolfTPM example applications are included in this
layer, these include:
- attestation
- endorsement
- keygen
- pcr
- seal
- bench
- firmware
- management
- pkcs7
- timestamp
- boot
- gpio
- native
- tls
- wrap
- csr
- nvram
The recipe for these applications is located at:
```
meta-wolfssl/recipes-examples/wolftpm/wolftpm-examples.bb
```
You'll need to compile wolTPM and the examples directory.
This can be done with these commands in the build directory:
```
$ bitbake wolftpm
$ bitbake wolftpm-examples
```
To install these applications into your image, you will
need to edit your "build/conf/local.conf" file and add
`wolftpm` and `wolftpm-examples` to your "IMAGE_INSTALL"
variable like so:
- For Dunfell and newer versions of Yocto
```
IMAGE_INSTALL:append = " wolftpm wolftpm-examples"
```
- For versions of Yocto older than Dunfell
```
IMAGE_INSTALL_append = " wolftpm wolftpm-examples"
```
When your image builds, these will be installed to the
`/usr/bin/examples` system directory. When inside your
executing image, you can run them from the terminal.
For example, we can run the benchmark from the examples
directory like so:
```
$ cd bench
$ ./bench
```
Refer to the [wolfTPM Examples README](https://github.com/wolfSSL/wolfTPM/blob/master/examples/README.md) for more information on the examples directory.
Refer to the [meta-wolfssl README](https://github.com/wolfSSL/meta-wolfssl/blob/master/README.md) for more information on setting up your layer.

View File

@ -1,3 +1,4 @@
#wolftpm-wrap-test.bb
SUMMARY = "wolfTPM Examples Directory"
DESCRIPTION = "wolfTPM examples directory used to demonstrate \
features of a TPM 2.0 module"
@ -15,7 +16,7 @@ SRC_URI = "git://github.com/wolfssl/wolfTPM.git;nobranch=1;protocol=https;rev=1f
do_configure[noexec] = "1"
do_compile[noexec] = "1"
WOLFTPM_EXAMPLES_DIR = "${datadir}/wolftpm-examples"
WOLFTPM_EXAMPLES_DIR = "${datadir}/wolftpm-test"
WOLFTPM_EXAMPLES_INSTALL_DIR = "${D}${WOLFTPM_EXAMPLES_DIR}"
WOLFTPM_EXAMPLES_README = "README.txt"
WOLFTPM_EXAMPLES_README_DIR = "${WOLFTPM_EXAMPLES_INSTALL_DIR}/${WOLFTPM_EXAMPLES_README}"
@ -26,7 +27,7 @@ python () {
wolftpm_examples_install_dir = d.getVar('WOLFTPM_EXAMPLES_INSTALL_DIR', True)
wolftpm_examples_readme_dir = d.getVar('WOLFTPM_EXAMPLES_README_DIR', True)
bb.note("Installing dummy file for wolfTPM examples")
bb.note("Installing dummy file for wolfTPM test example")
installDir = 'install -m 0755 -d "%s"\n' % wolftpm_examples_install_dir
makeDummy = 'echo "This is a dummy package" > "%s"\n' % wolftpm_examples_readme_dir

View File

@ -1,23 +1,22 @@
#wolfTPM Examples
WOLFTPM_EXAMPLES_DIR = "${B}/examples"
#wolftpm_%.bbappend
WOLFTPM_TEST_DIR = "${B}/examples/wrap/.libs"
WOLFTPM_TEST = "wrap_test"
WOLFTPM_TEST_YOCTO = "wolftpm-wrap-test"
WOLFTPM_INSTALL_DIR = "${D}${bindir}"
# Bash dependency for .sh
RDEPENDS:${PN} += "bash"
python () {
# Get the environment variables
wolftpm_examples_dir = d.getVar('WOLFTPM_EXAMPLES_DIR', True)
# Get the environment variables WOLFTPM_TEST_DIR, WOLFTPM_TEST,
# WOLFTPM_TEST_YOCTO, and WOLFTPM_INSTALL_DIR
wolftpm_test_dir = d.getVar('WOLFTPM_TEST_DIR', True)
wolftpm_test = d.getVar('WOLFTPM_TEST', True)
wolftpm_test_yocto = d.getVar('WOLFTPM_TEST_YOCTO', True)
wolftpm_install_dir = d.getVar('WOLFTPM_INSTALL_DIR', True)
bbnote = 'bbnote "Installing wolfTPM Examples"\n'
bbnote = 'bbnote "Installing wolfTPM wrap_test"\n'
installDir = 'install -m 0755 -d "%s"\n' % (wolftpm_install_dir)
cpExamples = 'cp -r "%s/" "%s/"\n' % (wolftpm_examples_dir, wolftpm_install_dir)
cpWrapTest = 'cp "%s/%s" "%s/%s"\n' % (wolftpm_test_dir, wolftpm_test, wolftpm_install_dir, wolftpm_test_yocto)
d.appendVar('do_install', bbnote)
d.appendVar('do_install', installDir)
d.appendVar('do_install', cpExamples)
d.appendVar('do_install', cpWrapTest)
}
# Ensure consistent locale
export LC_ALL = "C"