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

@ -52,7 +52,8 @@ git clone https://github.com/wolfSSL/meta-wolfssl.git
After installing your build's Yocto/OpenEmbedded components: 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: file, in the BBLAYERS section:
``` ```
@ -198,8 +199,8 @@ This layer offers wolfSSL support for the following open source projects:
- [curl](https://layers.openembedded.org/layerindex/recipe/5765/) - [curl](https://layers.openembedded.org/layerindex/recipe/5765/)
- [OpenSSH](https://layers.openembedded.org/layerindex/recipe/5083/) - [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 Several wolfSSL example application recipes are included in this layer. These
include: 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 directory. When inside your executing image, you can run them from the
terminal. 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 Excluding Recipe from Build
--------------------------- ---------------------------
@ -346,6 +387,8 @@ Running Image on the QEMU
To run meta-wolfssl image on the QEMU (Quick EMUlator) you can follow these 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. 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 1. Initialize the Build
This can be done by running these commands: This can be done by running these commands:

View File

@ -41,7 +41,7 @@ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'', d)}" '', d)}"
BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \
'wolftpm-examples', \ 'wolftpm-wrap-test', \
'${LAYERDIR}/recipes-examples/wolftpm/*.bb ${LAYERDIR}/recipes-examples/wolftpm/*.bbappend', \ '${LAYERDIR}/recipes-examples/wolftpm/*.bb ${LAYERDIR}/recipes-examples/wolftpm/*.bbappend', \
'', d)}" '', 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" SUMMARY = "wolfTPM Examples Directory"
DESCRIPTION = "wolfTPM examples directory used to demonstrate \ DESCRIPTION = "wolfTPM examples directory used to demonstrate \
features of a TPM 2.0 module" 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_configure[noexec] = "1"
do_compile[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_INSTALL_DIR = "${D}${WOLFTPM_EXAMPLES_DIR}"
WOLFTPM_EXAMPLES_README = "README.txt" WOLFTPM_EXAMPLES_README = "README.txt"
WOLFTPM_EXAMPLES_README_DIR = "${WOLFTPM_EXAMPLES_INSTALL_DIR}/${WOLFTPM_EXAMPLES_README}" 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_install_dir = d.getVar('WOLFTPM_EXAMPLES_INSTALL_DIR', True)
wolftpm_examples_readme_dir = d.getVar('WOLFTPM_EXAMPLES_README_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 installDir = 'install -m 0755 -d "%s"\n' % wolftpm_examples_install_dir
makeDummy = 'echo "This is a dummy package" > "%s"\n' % wolftpm_examples_readme_dir makeDummy = 'echo "This is a dummy package" > "%s"\n' % wolftpm_examples_readme_dir

View File

@ -1,23 +1,22 @@
#wolfTPM Examples #wolftpm_%.bbappend
WOLFTPM_EXAMPLES_DIR = "${B}/examples" WOLFTPM_TEST_DIR = "${B}/examples/wrap/.libs"
WOLFTPM_TEST = "wrap_test"
WOLFTPM_TEST_YOCTO = "wolftpm-wrap-test"
WOLFTPM_INSTALL_DIR = "${D}${bindir}" WOLFTPM_INSTALL_DIR = "${D}${bindir}"
# Bash dependency for .sh
RDEPENDS:${PN} += "bash"
python () { python () {
# Get the environment variables # Get the environment variables WOLFTPM_TEST_DIR, WOLFTPM_TEST,
wolftpm_examples_dir = d.getVar('WOLFTPM_EXAMPLES_DIR', True) # 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) 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) 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', bbnote)
d.appendVar('do_install', installDir) d.appendVar('do_install', installDir)
d.appendVar('do_install', cpExamples) d.appendVar('do_install', cpWrapTest)
} }
# Ensure consistent locale
export LC_ALL = "C"