diff --git a/README.md b/README.md index c913a54..ee35f71 100644 --- a/README.md +++ b/README.md @@ -341,51 +341,6 @@ to add a DNS server to /etc/resolv.conf like such with root perms echo "nameserver 8.8.8.8" >> /etc/resolv.conf ``` -wolfTPM Examples ----------------- - -Several wolfTPM example application recipes are included in this layer. These include: - -TODO - -The recipes for these applications are located at: -``` -meta-wolfssl/recipes-wolfssl/wolftpm/wolftpm_%.bbappend -``` - -This can be compiled with bitbake using: - -``` -$ bitbake wolftpm -``` - -To install wolfTPM examples into your image, you will need to edit your -"build/conf/local.conf" file with the neccesary options. There are two -steps needed in order to install wolfTPM's examples into your image. - -1. You need to first add wolfTPM to your "IMAGE_INSTALL" variable like so: - -- For Dunfell and newer versions of Yocto -``` -IMAGE_INSTALL:append = " wolftpm " -``` - -- For versions of Yocto older than Dunfell -``` -IMAGE_INSTALL_append = " wolftpm " -``` - -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. - -2. You then need to enable the examples in your image by -setting `ENABLE_WOLFTPM_EXAMPLES` to 1 in your local.conf like so: - -``` -ENABLE_WOLFTPM_EXAMPLES = "1" -``` - wolfProvider ------------ To build wolfProvider view the instructions in this [README](recipes-wolfssl/wolfprovider/README.md) diff --git a/conf/layer.conf b/conf/layer.conf index f1df7d7..a975f01 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -37,7 +37,7 @@ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \ BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \ 'wolftpm', \ - '${LAYERDIR}/recipes-wolfssl/wolftpm/*.bb ${LAYERDIR}/recipes-wolfssl/wolftpm/*.bbappend', \ + '${LAYERDIR}/recipes-wolfssl/wolftpm/*.bb ${LAYERDIR}/*/wolftpm/*.bbappend', \ '', d)}" BBFILES += "${@bb.utils.contains('IMAGE_INSTALL', \ diff --git a/recipes-examples/wolftpm/README.md b/recipes-examples/wolftpm/README.md new file mode 100644 index 0000000..d58e914 --- /dev/null +++ b/recipes-examples/wolftpm/README.md @@ -0,0 +1,62 @@ +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_%.bbappend +``` + +This can be compiled with bitbake using: + +``` +$ bitbake wolftpm +``` + +To install these applications into your image, +you will need to edit your "build/conf/local.conf" +file and add them to the "IMAGE_INSTALL" variable +like so: + +- For Dunfell and newer versions of Yocto +``` +IMAGE_INSTALL:append = " wolftpm " +``` + +- For versions of Yocto older than Dunfell +``` +IMAGE_INSTALL_append = " wolftpm " +``` + +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. + +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 [meta-wolfssl README](https://github.com/wolfSSL/meta-wolfssl/blob/master/README.md) +for more information on setting up your layer. diff --git a/recipes-examples/wolftpm/wolftpm_%.bbappend b/recipes-examples/wolftpm/wolftpm_%.bbappend new file mode 100644 index 0000000..bb279c3 --- /dev/null +++ b/recipes-examples/wolftpm/wolftpm_%.bbappend @@ -0,0 +1,23 @@ +#wolfTPM Examples +WOLFTPM_EXAMPLES_DIR = "${B}/examples" +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) + wolftpm_install_dir = d.getVar('WOLFTPM_INSTALL_DIR', True) + + bbnote = 'bbnote "Installing wolfTPM Examples"\n' + installDir = 'install -m 0755 -d "%s"\n' % (wolftpm_install_dir) + cpExamples = 'cp -r "%s/" "%s/"\n' % (wolftpm_examples_dir, wolftpm_install_dir) + + d.appendVar('do_install', bbnote) + d.appendVar('do_install', installDir) + d.appendVar('do_install', cpExamples) +} + +# Ensure consistent locale +export LC_ALL = "C" diff --git a/recipes-wolfssl/wolftpm/wolftpm_%.bbappend b/recipes-wolfssl/wolftpm/wolftpm_%.bbappend deleted file mode 100644 index 1d4089c..0000000 --- a/recipes-wolfssl/wolftpm/wolftpm_%.bbappend +++ /dev/null @@ -1,41 +0,0 @@ -# For wolfTPM Examples -WOLFTPM_TEST_DIR = "${S}/examples" -WOLFTPM_DIR = "/home/root/wolftpm/examples" -WOLFTPM_TEST_TARGET_DIR = "${D}${WOLFTPM_DIR}" - -python () { - enable_wolftpm_examples = d.getVar('ENABLE_WOLFTPM_EXAMPLES', True) - - if enable_wolftpm_examples == "1": - distro_version = d.getVar('DISTRO_VERSION', True) - wolftpm_test_dir = d.getVar('WOLFTPM_TEST_DIR', True) - wolftpm_test_target_dir = d.getVar('WOLFTPM_TEST_TARGET_DIR', True) - - bb.note("Installing Examples Directory for wolfTPM") - installDir = 'install -m 0755 -d "%s"\n' % (wolftpm_test_target_dir) - cpWolftpmExamples = 'cp -r %s/* %s\n' % (wolftpm_test_dir, wolftpm_test_target_dir) - - d.appendVar('do_install', installDir) - d.appendVar('do_install', cpWolftpmExamples) - - # Remove the unwanted file - d.appendVar('do_install', 'rm -f %s/run_examples.sh\n' % wolftpm_test_target_dir) - - # Append to FILES:${PN} within the Python function - files_var = 'FILES:' + d.getVar('PN', True) - wolftpm_example_files = wolftpm_test_target_dir + '/*' - - pn = d.getVar('PN', True) - wolftpm_dir = d.getVar('WOLFTPM_DIR', 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 + ' ' + wolftpm_dir + '/*' - d.setVar(files_var_name, new_files) -} - -# Python Specific option -export PYTHONDONTWRITEBYTECODE = "1"