Added to have image isntall argument

pull/92/head
Aidan 2024-10-28 14:04:13 -07:00
parent 9530fc6738
commit 0e7cb36e8a
3 changed files with 64 additions and 13 deletions

View File

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

View File

@ -24,43 +24,44 @@ layer, these include:
The recipe for these applications is located at: The recipe for these applications is located at:
``` ```
meta-wolfssl/recipes-examples/wolftpm/wolftpm_%.bbappend meta-wolfssl/recipes-examples/wolftpm/wolftpm-examples.bb
``` ```
This can be compiled with bitbake using: 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
$ bitbake wolftpm-examples
``` ```
To install these applications into your image, you will To install these applications into your image, you will
need to edit your "build/conf/local.conf" file and add need to edit your "build/conf/local.conf" file and add
them to the "IMAGE_INSTALL" variable like so: `wolftpm` and `wolftpm-examples` to your "IMAGE_INSTALL"
variable like so:
- For Dunfell and newer versions of Yocto - For Dunfell and newer versions of Yocto
``` ```
IMAGE_INSTALL:append = " wolftpm " IMAGE_INSTALL:append = " wolftpm wolftpm-examples"
``` ```
- For versions of Yocto older than Dunfell - For versions of Yocto older than Dunfell
``` ```
IMAGE_INSTALL_append = " wolftpm " IMAGE_INSTALL_append = " wolftpm wolftpm-examples"
``` ```
When your image builds, these will be installed to the When your image builds, these will be installed to the
`/usr/bin/examples` system directory. When inside your `/usr/bin/examples` system directory. When inside your
executing image, you can run them from the terminal. executing image, you can run them from the terminal.
For example, we can run the wrap test like so from the
examples directory: For example, we can run the benchmark from the examples
directory like so:
``` ```
$ cd wrap $ cd bench
$ ./wrap_test $ ./bench
``` ```
The examples can be excluded from your build by deleting
the recipe `wolftpm_%bbappend`.
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 [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. 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

@ -0,0 +1,45 @@
SUMMARY = "wolfTPM Examples Directory"
DESCRIPTION = "wolfTPM examples directory used to demonstrate \
features of a TPM 2.0 module"
HOMEPAGE = "https://www.wolfssl.com/products/wolftpm"
BUGTRACKER = "https://github.com/wolfssl/wolftpm/issues"
SECTION = "libs"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
S = "${WORKDIR}/git"
DEPENDS += "wolfssl"
SRC_URI = "git://github.com/wolfssl/wolfTPM.git;nobranch=1;protocol=https;rev=1fa15951eb91a8fe89b3326077b9be6fb105edeb"
do_configure[noexec] = "1"
do_compile[noexec] = "1"
WOLFTPM_EXAMPLES_DIR = "${datadir}/wolftpm-examples"
WOLFTPM_EXAMPLES_INSTALL_DIR = "${D}${WOLFTPM_EXAMPLES_DIR}"
WOLFTPM_EXAMPLES_README = "README.txt"
WOLFTPM_EXAMPLES_README_DIR = "${WOLFTPM_EXAMPLES_INSTALL_DIR}/${WOLFTPM_EXAMPLES_README}"
python () {
distro_version = d.getVar('DISTRO_VERSION', True)
wofltpm_examples_dir = d.getVar('WOLFTPM_EXAMPLES_DIR', True)
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")
installDir = 'install -m 0755 -d "%s"\n' % wolftpm_examples_install_dir
makeDummy = 'echo "This is a dummy package" > "%s"\n' % wolftpm_examples_readme_dir
d.appendVar('do_install', installDir)
d.appendVar('do_install', makeDummy)
pn = d.getVar('PN', True)
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
files_var_name = 'FILES_' + pn
else:
files_var_name = 'FILES:' + pn
current_files = d.getVar(files_var_name, True) or ""
new_files = current_files + ' ' + wofltpm_examples_dir + '/*'
d.setVar(files_var_name, new_files)
}