diff options
author | Yash Goyal <Yash.Goyal@arm.com> | 2021-03-16 02:12:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 04:12:25 -0500 |
commit | cfb1ad058c70e5ff6d43aa2115e294b3e0b4742e (patch) | |
tree | 6769d17278235d23f636f433146aea06a1391424 | |
parent | b0a846bb8b00d73e6a27adb743e9c225d55ad06e (diff) |
Added Parsec support to mbed-fcce (#274)
* Added Parsec support to mbed-fcce
1. Renamed mbed-fcc to mbed-fcce
1. Compile fcce with parsec-se-driver when MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT=ON
* Removed the duplicate files
* remade the pal-platform.json patch
Co-authored-by: Yash Goyal <yash.goyal@pelion.com>
-rw-r--r-- | meta-lmp-support/recipes-core/images/console-image-lmp.bb | 2 | ||||
-rw-r--r-- | recipes-core/images/console-image.bb | 2 | ||||
-rw-r--r-- | recipes-wigwag/mbed-fcc/mbed-fcc_0.0.1.bb | 56 | ||||
-rw-r--r-- | recipes-wigwag/mbed-fcce/mbed-fcce/0001-Added-trusted-storage-to-Yocto-target.patch | 105 | ||||
-rw-r--r-- | recipes-wigwag/mbed-fcce/mbed-fcce/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch (renamed from recipes-wigwag/mbed-fcc/mbed-fcc/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch) | 0 | ||||
-rw-r--r-- | recipes-wigwag/mbed-fcce/mbed-fcce/linux-se-config.cmake | 36 | ||||
-rw-r--r-- | recipes-wigwag/mbed-fcce/mbed-fcce_4.7.1.bb | 92 |
7 files changed, 235 insertions, 58 deletions
diff --git a/meta-lmp-support/recipes-core/images/console-image-lmp.bb b/meta-lmp-support/recipes-core/images/console-image-lmp.bb index d843c7e..2cf5784 100644 --- a/meta-lmp-support/recipes-core/images/console-image-lmp.bb +++ b/meta-lmp-support/recipes-core/images/console-image-lmp.bb @@ -41,7 +41,7 @@ path-set \ pelion-version \ " PELION_BASE_OPTIONAL = " \ -mbed-fcc \ +mbed-fcce \ " PELION_SYSTEMS_MANAGEMENT = "\ diff --git a/recipes-core/images/console-image.bb b/recipes-core/images/console-image.bb index 9136e78..e50d0c1 100644 --- a/recipes-core/images/console-image.bb +++ b/recipes-core/images/console-image.bb @@ -28,7 +28,7 @@ path-set \ pelion-version \ " PELION_BASE_OPTIONAL = " \ -mbed-fcc \ +mbed-fcce \ " PELION_SYSTEMS_MANAGEMENT = "\ diff --git a/recipes-wigwag/mbed-fcc/mbed-fcc_0.0.1.bb b/recipes-wigwag/mbed-fcc/mbed-fcc_0.0.1.bb deleted file mode 100644 index 6a12c66..0000000 --- a/recipes-wigwag/mbed-fcc/mbed-fcc_0.0.1.bb +++ /dev/null @@ -1,56 +0,0 @@ -DESCRIPTION = "FCC tool" - -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=4336ad26bb93846e47581adc44c4514d" - -DEPENDS = "deviceos-users python3-native python3-pip-native python3 python3-setuptools-native python3-setuptools-scm cmake-native mercurial-native python3-pyusb-native" -RDEPENDS_${PN} += "bash python3 python3-core" - -inherit cmake pkgconfig gitpkgv distutils3 setuptools3 python3native - -PV = "1.0+git${SRCPV}" -PKGV = "1.0+git${GITPKGV}" -PR = "r0" - -SRCREV = "cbad9f99477dbd4f071ce3e31ab8623004cd70a3" - -SRC_URI = "git://git@github.com/ARMmbed/factory-configurator-client-example.git;protocol=https;; \ -file://0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch \ -" -S = "${WORKDIR}/git" -FILES_${PN} = "/wigwag/wwrelay-utils/I2C/*" - - -do_configure () { - cd ${S} - export PYTHONPATH=$PYTHONPATH:`pwd`/recipe-sysroot-native/usr/lib/python3.8 - export PATH=$PYTHONPATH:$PATH - export HTTP_PROXY=${HTTP_PROXY} - export HTTPS_PROXY=${HTTPS_PROXY} - pip3 install mbed-cli==1.10.5 click==7.1.2 requests pyopenssl==20.0.1 -} - -do_compile() { - cd ${S} - export HTTP_PROXY=${HTTP_PROXY} - export HTTPS_PROXY=${HTTPS_PROXY} - BUILD_TYPE=${1:-DEBUG} - mbedpath=$(which mbed); - python3 $mbedpath deploy - #<todo> make a machine specific patch for sunxi vs rpi - # userandom=random - # sed -i "/char dev_random\[/c\char dev_random[] = \"/dev/${userandom}\";" ./mbed-cloud-client/mbed-client-pal/Source/Port/Reference-Impl/OS_Specific/Linux/Board_Specific/TARGET_Yocto_Generic/pal_plat_Yocto_Generic.c - python3 pal-platform/pal-platform.py -v deploy --target=Yocto_Generic_YoctoLinux_mbedtls generate - cd __Yocto_Generic_YoctoLinux_mbedtls/ - export ARMGCC_DIR=$(realpath $(pwd)/../../recipe-sysroot-native/usr/) - cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_TOOLCHAIN_FILE=../pal-platform/Toolchain/POKY-GLIBC/POKY-GLIBC.cmake -DEXTARNAL_DEFINE_FILE=../linux-config.cmake - make factory-configurator-client-example.elf - -} - -do_install() { - install -d ${D}/wigwag - install -d ${D}/wigwag/wwrelay-utils - install -d ${D}/wigwag/wwrelay-utils/I2C - install -m 755 ${S}/__Yocto_Generic_YoctoLinux_mbedtls/factory-configurator-client-example.elf ${D}/wigwag/wwrelay-utils/I2C/factory-configurator-client-armcompiled.elf -} diff --git a/recipes-wigwag/mbed-fcce/mbed-fcce/0001-Added-trusted-storage-to-Yocto-target.patch b/recipes-wigwag/mbed-fcce/mbed-fcce/0001-Added-trusted-storage-to-Yocto-target.patch new file mode 100644 index 0000000..3e9cfec --- /dev/null +++ b/recipes-wigwag/mbed-fcce/mbed-fcce/0001-Added-trusted-storage-to-Yocto-target.patch @@ -0,0 +1,105 @@ +From f06acc1ff0df91d265de03b19702292e24ed08a5 Mon Sep 17 00:00:00 2001 +From: Yash Goyal <yash.goyal@pelion.com> +Date: Tue, 16 Mar 2021 00:04:27 -0700 +Subject: [PATCH] Added trusted storage to Yocto target + +parsec-se-driver will be added as DEPENDS in the recipe as its a rust +based project +--- + pal-platform/pal-platform.json | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/pal-platform/pal-platform.json b/pal-platform/pal-platform.json +index caf0e0e..9e50cb9 100644 +--- a/pal-platform/pal-platform.json ++++ b/pal-platform/pal-platform.json +@@ -46,26 +46,26 @@ + "version": "1.0.0", + "from": { + "protocol": "git", +- "location": "https://github.com/ARMmbed/psa_trusted_storage_linux.git", ++ "location": "https://github.com/PelionIoT/psa_trusted_storage_linux.git", + "tag": "ptsl-0.0.1-psa-storage-api-1.0.0" + }, + "to": "Middleware/trusted_storage/trusted_storage" + }, + "parsec_se_driver": { +- "version": "0.3.1", ++ "version": "0.4.0", + "from": { + "protocol": "git", + "location": "https://github.com/parallaxsecond/parsec-se-driver.git", +- "tag": "0.3.1" ++ "tag": "0.4.0" + }, + "to": "Middleware/parsec_se_driver/parsec_se_driver" + }, + "curl": { +- "version": "7.72.0", ++ "version": "7.75.0", + "from": { + "protocol": "git", + "location": "https://github.com/curl/curl.git", +- "tag": "curl-7_72_0" ++ "tag": "curl-7_75_0" + }, + "to": "Middleware/curl/curl" + } +@@ -89,14 +89,14 @@ + }, + "to": "Middleware/mbedtls/mbedtls" + }, +- "curl": { +- "version": "7.72.0", ++ "trusted_storage": { ++ "version": "1.0.0", + "from": { + "protocol": "git", +- "location": "https://github.com/curl/curl.git", +- "tag": "curl-7_72_0" ++ "location": "https://github.com/PelionIoT/psa_trusted_storage_linux.git", ++ "tag": "ptsl-0.0.1-psa-storage-api-1.0.0" + }, +- "to": "Middleware/curl/curl" ++ "to": "Middleware/trusted_storage/trusted_storage" + } + } + }, +@@ -118,11 +118,11 @@ + "to": "Middleware/mbedtls/mbedtls" + }, + "curl": { +- "version": "7.72.0", ++ "version": "7.75.0", + "from": { + "protocol": "git", + "location": "https://github.com/curl/curl.git", +- "tag": "curl-7_72_0" ++ "tag": "curl-7_75_0" + }, + "to": "Middleware/curl/curl" + } +@@ -213,17 +213,17 @@ + "version": "1.0.0", + "from": { + "protocol": "git", +- "location": "https://github.com/ARMmbed/psa_trusted_storage_linux.git", ++ "location": "https://github.com/PelionIoT/psa_trusted_storage_linux.git", + "tag": "ptsl-0.0.1-psa-storage-api-1.0.0" + }, + "to": "Middleware/trusted_storage/trusted_storage" + }, + "parsec_se_driver": { +- "version": "0.3.1", ++ "version": "0.4.0", + "from": { + "protocol": "git", + "location": "https://github.com/parallaxsecond/parsec-se-driver.git", +- "tag": "0.3.1" ++ "tag": "0.4.0" + }, + "to": "Middleware/parsec_se_driver/parsec_se_driver" + } +-- +2.17.1 + diff --git a/recipes-wigwag/mbed-fcc/mbed-fcc/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch b/recipes-wigwag/mbed-fcce/mbed-fcce/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch index bcfd1e5..bcfd1e5 100644 --- a/recipes-wigwag/mbed-fcc/mbed-fcc/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch +++ b/recipes-wigwag/mbed-fcce/mbed-fcce/0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch diff --git a/recipes-wigwag/mbed-fcce/mbed-fcce/linux-se-config.cmake b/recipes-wigwag/mbed-fcce/mbed-fcce/linux-se-config.cmake new file mode 100644 index 0000000..762d6a0 --- /dev/null +++ b/recipes-wigwag/mbed-fcce/mbed-fcce/linux-se-config.cmake @@ -0,0 +1,36 @@ +# global defines and configuration goes here... +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../) + +SET(SA_PV_OS_NAME "linux") +SET(CMAKE_C_FLAGS "-std=c99") +OPTION(USE_CRYPTO_SUBMODULE "Build and use libmbedcrypto from the crypto submodule." ON) +OPTION(LINK_WITH_TRUSTED_STORAGE "Explicitly link mbed TLS library to trusted_storage." ON) + +SET(PAL_TLS_BSP_DIR ${NEW_CMAKE_SOURCE_DIR}/mbed-cloud-client/mbed-client-pal/Configs/mbedTLS) + +add_definitions( + -DMBED_CONF_MBED_TRACE_ENABLE=1 + -DMBEDTLS_CONFIG_FILE="\\"${PAL_TLS_BSP_DIR}/mbedTLSConfig_${OS_BRAND}.h"\\" + -DPAL_USER_DEFINED_CONFIGURATION="\\"source/pal_config_linux.h"\\" + -DMBED_CLIENT_USER_CONFIG_FILE="\\"source/mbed_cloud_client_user_config.h"\\" + -DMBED_CLOUD_CLIENT_USER_CONFIG_FILE="\\"source/mbed_cloud_client_user_config.h"\\" + -DPSA_STORAGE_USER_CONFIG_FILE="\\"source/psa_storage_user_config.h"\\" + -DFCE_ETHERNET_INTERFACE + -DMBED_CONF_MBED_CLOUD_CLIENT_PSA_SUPPORT + -DMBED_CONF_MBED_CLOUD_CLIENT_SECURE_ELEMENT_SUPPORT +) +#Add parsec flags +if(PARSEC_TPM_SE_SUPPORT) +add_definitions( + -DMBED_CONF_APP_SECURE_ELEMENT_PARSEC_TPM_SUPPORT + -DMBED_CONF_MBED_CLOUD_CLIENT_NON_PROVISIONED_SECURE_ELEMENT=1 +) +endif() + +# MBEDTLS PSA Crypto +add_definitions( + -DMBEDTLS_USE_PSA_CRYPTO + -DMBEDTLS_PSA_CRYPTO_C + -DMBEDTLS_PSA_CRYPTO_STORAGE_C + -DMBEDTLS_PSA_CRYPTO_SE_C +) diff --git a/recipes-wigwag/mbed-fcce/mbed-fcce_4.7.1.bb b/recipes-wigwag/mbed-fcce/mbed-fcce_4.7.1.bb new file mode 100644 index 0000000..1f9739c --- /dev/null +++ b/recipes-wigwag/mbed-fcce/mbed-fcce_4.7.1.bb @@ -0,0 +1,92 @@ +DESCRIPTION = "FCCE tool" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=4336ad26bb93846e47581adc44c4514d" + +MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT ?= "OFF" +MBED_EDGE_CMAKE_BUILD_TYPE ?= "Debug" + +DEPENDS = "deviceos-users python3-native python3-pip-native python3 python3-setuptools-native python3-setuptools-scm cmake-native mercurial-native python3-pyusb-native" +DEPENDS += "${@ 'parsec-se-driver' if d.getVar('MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT') == 'ON' else ' '}" + +RDEPENDS_${PN} += "bash python3 python3-core" + +inherit cmake pkgconfig gitpkgv distutils3 setuptools3 python3native + +SRC_URI = " \ +git://github.com/parallaxsecond/parsec-se-driver.git;protocol=https;name=parsec;destsuffix=parsec-se-driver \ +git://git@github.com/ARMmbed/factory-configurator-client-example.git;protocol=https; \ +file://0001-Added-trusted-storage-to-Yocto-target.patch \ +file://0001-fix-build-getting-cross-compiler-iface-setting-to-et.patch \ +file://linux-se-config.cmake \ +" + +SRCREV_pn-${PN} = "${PV}" +SRCREV_parsec = "0.4.0" + +S = "${WORKDIR}/git" +FILES_${PN} = "/wigwag/wwrelay-utils/I2C/*" + +do_configure() { + + cd ${S} + + export PYTHONPATH=$PYTHONPATH:`pwd`/recipe-sysroot-native/usr/lib/python3.8 + export PATH=$PYTHONPATH:$PATH + + export HTTP_PROXY=${HTTP_PROXY} + export HTTPS_PROXY=${HTTPS_PROXY} + + pip3 install mbed-cli==1.10.5 click==7.1.2 requests pyopenssl==20.0.1 + +} + +do_compile() { + + cd ${S} + + export HTTP_PROXY=${HTTP_PROXY} + export HTTPS_PROXY=${HTTPS_PROXY} + + mbedpath=$(which mbed); + python3 $mbedpath deploy + + python3 pal-platform/pal-platform.py -v deploy --target=Yocto_Generic_YoctoLinux_mbedtls generate + + if [ ${MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT} == "ON" ]; then + + # Manually adding the parsec-se-driver Middleware + cp -R ${WORKDIR}/parsec-se-driver ${S}/pal-platform/Middleware/parsec_se_driver/parsec_se_driver + + # Place the precompiled parsec-se-driver static library + if [ ${MBED_EDGE_CMAKE_BUILD_TYPE} == "Debug" ]; then + mkdir -p ${S}/pal-platform/Middleware/parsec_se_driver/parsec_se_driver/target/debug + cp ${PKG_CONFIG_SYSROOT_DIR}/usr/lib/libparsec_se_driver.a ${S}/pal-platform/Middleware/parsec_se_driver/parsec_se_driver/target/debug/ + else + mkdir -p ${S}/pal-platform/Middleware/parsec_se_driver/parsec_se_driver/target/release + cp ${PKG_CONFIG_SYSROOT_DIR}/usr/lib/libparsec_se_driver.a ${S}/pal-platform/Middleware/parsec_se_driver/parsec_se_driver/target/release/ + fi + fi + + cd ${S}/__Yocto_Generic_YoctoLinux_mbedtls/ + + export ARMGCC_DIR=$(realpath $(pwd)/../../recipe-sysroot-native/usr/) + + if [ ${MBED_EDGE_CORE_CONFIG_PARSEC_TPM_SE_SUPPORT} == "ON" ]; then + cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE="${MBED_EDGE_CMAKE_BUILD_TYPE}" -DCMAKE_TOOLCHAIN_FILE=../pal-platform/Toolchain/POKY-GLIBC/POKY-GLIBC.cmake -DPARSEC_TPM_SE_SUPPORT=ON -DEXTARNAL_DEFINE_FILE=../../linux-se-config.cmake + else + cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE="${MBED_EDGE_CMAKE_BUILD_TYPE}" -DCMAKE_TOOLCHAIN_FILE=../pal-platform/Toolchain/POKY-GLIBC/POKY-GLIBC.cmake -DEXTARNAL_DEFINE_FILE=../linux-config.cmake + fi + + make factory-configurator-client-example.elf + +} + +do_install() { + + install -d ${D}/wigwag + install -d ${D}/wigwag/wwrelay-utils + install -d ${D}/wigwag/wwrelay-utils/I2C + install -m 755 ${S}/__Yocto_Generic_YoctoLinux_mbedtls/factory-configurator-client-example.elf ${D}/wigwag/wwrelay-utils/I2C/factory-configurator-client-armcompiled.elf + +} |