介绍
此存储库包含 i.MX MPU 项目 Matter 相关的 Yocto 工程。以下模块将使用此元物质层构建:
- 物质 (CHIP) : https://github.com/nxp/matter.git
- OpenThread 守护程序:https://github.com/openthread/openthread
- OpenThread 边界路由器:https://github.com/openthread/ot-br-posix
所有软件组件修订都基于项目 Matter v1.1.0.1 标签。
以下 Matter 相关二进制文件将通过此 Yocto 层配方安装到 Yocto 映像根文件系统中:
- chip-lighting-app: Matter 照明应用演示
- chip-lighting-app-trusty: i.MX8M Mini 上具有增强安全性的 Matter 照明应用程序
- chip-all-clusters-app:Matter 全集群演示
- thermostat-app:Matter 恒温器演示
- nxp-thermostat-app: 用于 Matter 认证的 NXP 定制恒温器应用程序
- nxp-thermostat-app-trusty: 恩智浦定制恒温器应用,在i.MX8M Mini上具有增强的安全性
- chip-bridge-app: Matter bridge 演示
- chip-tool: Matter 控制器工具
- chip-tool-trusty: 为 i.MX8M Mini 提供增强安全性的 Matter 控制器工具
- ot-daemon:OpenThread 客户端的 OpenThread 守护程序
- ot-client-ctl:OpenThread 客户端的 OpenThread ctrl 工具
- otbr-agent: OpenThread 边界路由器代理
- ot-ctl:OpenThread 边界路由器 ctrl 工具
- otbr-web:OpenThread 边界路由器 Web 管理守护程序
i.MX MPU Matter 平台
我们目前支持 3 种 i.MX MPU 平台,即 i.MX93 EVK、i.MX8M Mini EVK 和 i.MX6ULL EVK。有关更多详细信息,请参阅 NXP i.MX MPU Matter 平台。
如何使用集成的 OpenThread 边界路由器构建 Yocto 映像
构建 Yocto 项目需要以下软件包:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
pylint3 xterm npm zstd build-essential libpython3-dev libdbus-1-dev python3.8-venv
需要安装以下 python 包:
$ pip3 install testresources build mypy==0.910 types-setuptools pylint==2.9.3
$ pip install dbus-python
确保您的默认 Python3 版本至少为 3.8.0:
$ python3 --version
Python 3.8.0
然后,必须设置 Yocto 构建环境。
Yocto 源代码使用清单文件进行维护,存储库工具使用该文件下载相应的源代码。 本文档已使用 i.MX Yocto 6.1.1_1.0.0 版本进行了测试。
测试的硬件是:i.MX 8M Mini EVK、i.MX6ULL EVK 和 i.MX93 EVK。
运行以下命令以下载此版本:
$ mkdir ~/bin
$ cd ~/.bin
$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
$ chmod a+x ~/bin/repo
$ export PATH=${PATH}:~/bin
$ mkdir ${MY_YOCTO} # this directory will be the top directory of the Yocto source code
$ cd ${MY_YOCTO}
$ repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-langdale -m imx-6.1.1-1.0.0.xml
$ repo sync
然后将元物质配方集成到 Yocto 代码库中
$ cd ${MY_YOCTO}/sources/
$ git clone https://github.com/nxp-imx/meta-matter.git
$ git checkout imx_matter_2023_q2
有关下载的 Yocto 版本的更多信息,请参阅相应的 i.MX Yocto Project 用户指南,该指南可在 NXP 官方网站上找到。
将当前目录更改为 Yocto 源码的顶层目录,并执行以下命令:
# For i.MX8M Mini EVK:
$ MACHINE=imx8mmevk-matter DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx8mm
# For i.MX8M Mini EVK which use Firecrest (IW612) module (Note this operation will switch meta-imx and meta-matter repo to specific revision):
$ TARGET_15_4_CHIP=IW612 OT_RCP_BUS=SPI MACHINE=imx8mmevk DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx8mm
# For i.MX6ULL EVK:
$ MACHINE=imx6ullevk DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx6ull
# For i.MX93 EVK:
$ MACHINE=imx93evk-matter DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx93
如果您使用的是 IW612 高度集成的 Wi-Fi 6,BT/BLE 5.2,802.15.4 三射频单芯片,该单芯片已通过 Matter 1.0 和 Thread Group Openthread-1.3 和 Border Router-1.3“ 认证,请执行以下命令:
#For i.MX8M Mini EVK with IW612 RD board:
$ MACHINE=imx8mmevk-iw612-matter OT_RCP_BUS=SPI DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx8mm
#For i.MX93 EVK:
$ MACHINE=imx93evk-iw612-matter OT_RCP_BUS=SPI DISTRO=fsl-imx-xwayland source sources/meta-matter/tools/imx-matter-setup.sh bld-xwayland-imx93
这将为 Matter 构建创建一个 Python 虚拟环境。要退出 Python 虚拟环境,请运行 “$ deactivate”。您还可以在 Yocto 源码的顶层目录下运行 “$ source matter_venv/bin/activate” 重新进入 Matter 构建的 Python 虚拟环境。
这也将创建一个构建目录(i.MX8M Mini EVK的bld-xwayland-imx8mm/,i.MX6ULL EVK的bld-xwayland-imx6ull/或i.MX93 EVK的bld-xwayland-imx93/),并自动输入此目录。请执行以下命令以生成 Yocto 映像:
$ bitbake imx-image-multimedia
执行前面的命令后,将生成 Yocto 图像:
${MY_YOCTO}/bld-xwayland-imx8mm/tmp/deploy/images/imx8mmevk-matter/imx-image-multimedia-imx8mmevk-matter.wic.zst用于 i.MX8M Mini EVK。
${MY_YOCTO}/bld-xwayland-imx6ull/tmp/deploy/images/imx6ullevk/imx-image-multimedia-imx6ullevk.wic.zst,用于 i.MX6ULL EVK。
用于 i.MX93 EVK 的 ${MY_YOCTO}/bld-xwayland-imx93/tmp/deploy/images/imx93evk-matter/imx-image-multimedia-imx93evk-matter.wic.zst。
zst 图像是符号链接文件,因此您应该在解压缩它们之前将它们复制到专用文件夹 ${MY_images} 中。
# For i.MX8M Mini EVK:
$ cp ${MY_YOCTO}/bld-xwayland-imx8mm/tmp/deploy/images/imx8mmevk-matter/imx-image-multimedia-imx8mmevk.wic.zst ${MY_images}
# For i.MX6ULL EVK:
$ cp ${MY_YOCTO}/bld-xwayland-imx6ull/tmp/deploy/images/imx6ullevk/imx-image-multimedia-imx6ullevk.wic.zst ${MY_images}
# For i.MX93 EVK:
$ cp ${MY_YOCTO}/bld-xwayland-imx93/tmp/deploy/images/imx93evk/imx-image-multimedia-imx93evk.wic.zst ${MY_images}
请使用 zstd 命令解压缩此 .zst 存档,然后使用 dd 命令将输出文件编程到 microSD 卡。此 microSD 卡将用于在 i.MX 8M Mini EVK、i.MX6ULL EVK 或 i.MX93 EVK 上启动映像。
执行下面的 dd 命令时要小心,确保输出(“of” 参数)代表 microSD 卡设备!/dev/sdc 表示通过 USB 适配器连接到主机的 microSD 卡;但是,输出设备名称可能会有所不同。请使用 “ls /dev/sd*” 命令验证 SD 卡设备的名称。
$ cd ${MY_images}
# For i.MX8M Mini EVK:
$ zstd -d imx-image-multimedia-imx8mmevk.wic.zst
$ sudo dd if=imx-image-multimedia-imx8mmevk.wic of=/dev/sdc bs=4M conv=fsync
# For i.MX6ULL EVK:
$ zstd -d imx-image-multimedia-imx6ullevk.wic.zst
$ sudo dd if=imx-image-multimedia-imx6ullevk.wic of=/dev/sdc bs=4M conv=fsync
# For i.MX93 EVK:
$ zstd -d imx-image-multimedia-imx93evk.wic.zst
$ sudo dd if=imx-image-multimedia-imx93evk.wic of=/dev/sdc bs=4M conv=fsync
如何使用 Yocto SDK 构建 OpenThread 边界路由器
OpenThread 边界路由器 (OTBR) 有 3 个模块:otbr-agent、ot-ctl 和 otbr-web。
otbr-web 模块需要 liboost static 和 jsoncpp 软件包,它们不包含在默认的 Yocto 映像中。
要构建这些二进制文件,我们需要使用包含 meta-matter 的 Yocto SDK 工具链。 可以使用以下命令生成此 SDK:
# For i.MX8M Mini EVK:
$ cd ${MY_YOCTO}/bld-xwayland-imx8mm
# For i.MX6ULL EVK:
$ cd ${MY_YOCTO}/bld-xwayland-imx6ull
# For i.MX93 EVK:
$ cd ${MY_YOCTO}/bld-xwayland-imx93
$ bitbake imx-image-multimedia -c populate_sdk
然后,通过以 root 权限运行 SDK 安装脚本来安装 Yocto SDK:
# For i.MX8M Mini EVK:
$ sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-multimedia-armv8a-imx8mmevk-toolchain-6.1-langdale.sh
# For i.MX6ULL EVK
$ sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-multimedia-cortexa7t2hf-neon-imx6ullevk-toolchain-6.1-langdale.sh
# For i.MX93 EVK
$ sudo tmp/deploy/sdk/fsl-imx-xwayland-glibc-x86_64-imx-image-multimedia-armv8a-imx93evk-toolchain-6.1-langdale.sh
安装 SDK 时会提示 SDK 安装目录;用户可以指定安装目录,也可以保留默认的 ${/opt/fsl-imx-xwayland/}。如果您需要为多个板级 EVK 构建 SDK,请使用板级特定的路径);例如,您可以使用 /opt/fsl-imx-xwayland/6.1-langdale-imx8mm 用于 i.MX8M Mini EVK SDK,/opt/fsl-imx-xwayland/6.1-langdale-imx6ull 用于 i.MX6ULL EVK,/opt/fsl-imx-xwayland/6.1-langdale-imx93 用于 i.MX93 EVK。
NXP i.MX Release Distro SDK installer version 6.1-langdale
============================================================
Enter target directory for SDK (default: /opt/fsl-imx-xwayland/6.1-langdale):
在主机上安装 Yocto SDK 后,还会生成 SDK 环境设置脚本。 用户需要导入 Yocto 构建环境,每次在新的 shell 中使用 SDK 时,都需要获取此脚本;例如:
# For i.MX8M Mini EVK
$ . /opt/fsl-imx-xwayland/6.1-langdale-imx8mm/environment-setup-armv8a-poky-linux
$ For i.MX6ULL EVK
$ . /opt/fsl-imx-wayland/6.1-langdale-imx6ull/environment-setup-cortexa7t2hf-neon-poky-linux-gnueabi
# For i.MX93 EVK
$ . /opt/fsl-imx-wayland/6.1-langdale-imx93/environment-setup-armv8a-poky-linux
获取最新的 otbr 源代码并执行构建:
$ mkdir ${MY_OTBR} # this directory will be the top directory of the OTBR source code
$ cd ${MY_OTBR}
$ git clone https://github.com/openthread/ot-br-posix
$ cd ot-br-posix
$ git checkout thread-reference-20221027
$ git cherry-pick 528c152a35036ed0effe61e80cf25a978c458bfa
$ git cherry-pick e4a428fa1d666942f6bc634911cc66ab47f81207
$ git submodule update --init
# For i.MX8M Mini EVK
$ ./script/cmake-build -DOTBR_BORDER_ROUTING=ON -DOTBR_REST=ON -DOTBR_WEB=ON -DBUILD_TESTING=OFF -DOTBR_DBUS=ON \
-DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON -DOT_THREAD_VERSION=1.3 -DOTBR_INFRA_IF_NAME=mlan0 \
-DOTBR_BACKBONE_ROUTER=ON -DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=ON -DOTBR_MDNS=mDNSResponder \
-DCMAKE_TOOLCHAIN_FILE=./examples/platforms/nxp/linux-imx/aarch64.cmake
# For i.MX6ULL EVK
$ ./script/cmake-build -DOTBR_BORDER_ROUTING=ON -DOTBR_REST=ON -DOTBR_WEB=ON -DBUILD_TESTING=OFF -DOTBR_DBUS=ON \
-DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON -DOT_THREAD_VERSION=1.3 -DOTBR_INFRA_IF_NAME=mlan0 \
-DOTBR_BACKBONE_ROUTER=ON -DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=ON -DOTBR_MDNS=mDNSResponder \
-DCMAKE_TOOLCHAIN_FILE=./examples/platforms/nxp/linux-imx/arm.cmake
# For i.MX93 EVK
$ ./script/cmake-build -DOTBR_BORDER_ROUTING=ON -DOTBR_REST=ON -DOTBR_WEB=ON -DBUILD_TESTING=OFF -DOTBR_DBUS=ON \
-DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON -DOT_THREAD_VERSION=1.3 -DOTBR_INFRA_IF_NAME=mlan0 \
-DOTBR_BACKBONE_ROUTER=ON -DOT_BACKBONE_ROUTER_MULTICAST_ROUTING=ON -DOTBR_MDNS=mDNSResponder \
-DOT_POSIX_CONFIG_RCP_BUS=SPI -DCMAKE_TOOLCHAIN_FILE=./examples/platforms/nxp/linux-imx/aarch64.cmake
otbr-agent 在 \${MY_OTBR}/build/otbr/src/agent/otbr-agent.
otbr-web 在 \${MY_OTBR}/build/otbr/src/web/otbr-web.
ot-ctl 在 \${MY_OTBR}/build/otbr/third_party/openthread/repo/src/posix/ot-ctl.
请将它们复制到目标 /usr/sbin/ 目录中。
OTBR 不支持增量编译。如果编译过程中出现错误,或者需要重新编译,请在重新编译前删除 ${MY_OTBR}/build。
$ cd ${MY_OTBR}
$ rm -rf build/
如何在目标上设置 OpenThread 边界路由器
使用以下命令将 OTBR 连接到 Wi-Fi 接入点:
# For i.MX8M Mini EVK and i.MX6ULL EVK with 88W8987 WiFi module, and for i.MX93 EVK with IW612 module:
$ modprobe moal mod_para=nxp/wifi_mod_para.conf
$ wpa_passphrase ${SSID} ${PASSWORD} > wifiap.conf
$ wpa_supplicant -d -B -i mlan0 -c ./wifiap.conf
$ udhcpc -i mlan0
$ service otbr_fwcfg start #if no systemd installed, please use /usr/bin/otbr_fwcfg.sh instead
然后配置 Thread 设备:
在 i.MX8M Mini EVK 或 i.MX6ULL EVK 上,我们将使用专用的 Thread 设备(NXP K32W 或任何第三方部件 RCP): 将 Thread 模块插入 i.MX8M Mini EVK 或 i.MX6ULL EVK 的 USB OTG 端口。USB 设备应显示为 /dev/ttyUSB 或 /dev/ttyACM。 检测到 USB 设备后,启动 OTBR 相关服务。
使用 OpenThread Spinel 固件映像编程的 RCP 模块时,执行以下命令:
# If you are using third-party reference RCP
$ otbr-agent -I wpan0 -B mlan0 spinel+hdlc+uart:///dev/ttyACM0 &
# If you are using K32W RCP
$ otbr-agent -I wpan0 -B mlan0 'spinel+hdlc+uart:///dev/ttyUSB0?uart-baudrate=1000000' &
$ iptables -A FORWARD -i mlan0 -o wpan0 -j ACCEPT
$ iptables -A FORWARD -i wpan0 -o mlan0 -j ACCEPT
$ otbr-web &
对于 i.MX93 EVK,我们将使用 IW612 作为 Thread 设备: 我们只需要设置一个 GPIO,然后设置 otbr。
$ gpioset gpiochip6 0=1
$ otbr-agent -I wpan0 -B mlan0 'spinel+spi:///dev/spidev0.0?gpio-reset-device=/dev/gpiochip6&gpio-int-device=/dev/gpiochip4&gpio-int-line=10&gpio-reset-line=1&
spi-mode=0&spi-speed=1000000&spi-reset-delay=0' &
$ iptables -A FORWARD -i mlan0 -o wpan0 -j ACCEPT
$ iptables -A FORWARD -i wpan0 -o mlan0 -j ACCEPT
$ otbr-web &
说明如何在 i.MX MPU 平台上将 Matter 与 OTBR 结合使用的文档可在 NXP Matter 演示指南中找到。
如何构建 Matter 应用程序
默认情况下,Matter 应用程序已安装到 Yocto 映像中。如果需要单独构建,请执行以下命令下载 Matter 应用源码并切换到 v1.0 分支:
$ mkdir ${MY_Matter_Apps} # this is top level directory of this project
$ cd ${MY_Matter_Apps}
$ git clone https://github.com/NXP/matter.git
$ cd matter
$ git checkout origin/v1.1-branch-nxp_imx_2023_q2
$ git submodule update --init
确保 shell 不在 Yocto SDK 环境中。然后,导出名为 IMX_SDK_ROOT 的 shell 环境变量以指定 SDK 的路径。
# For i.MX8M Mini EVK #/opt/fsl-imx-xwayland/6.1-langdale-imx8mm is ${IMX8MM_SDK_INSTALLED_PATH}
$ export IMX_SDK_ROOT=/opt/fsl-imx-xwayland/6.1-langdale-imx8mm
# For i.MX6ULL EVK #/opt/fsl-imx-xwayland/6.1-langdale-imx6ull is ${IMX6ULL_SDK_INSTALLED_PATH}
$ export IMX_SDK_ROOT=/opt/fsl-imx-xwayland/6.1-langdale-imx6ull
# For i.MX93 EVK #/opt/fsl-imx-xwayland/6.1-langdale-imx93 is ${IMX93_SDK_INSTALLED_PATH}
$ export IMX_SDK_ROOT=/opt/fsl-imx-xwayland/6.1-langdale-imx93
用户可以使用 build_examples.py 脚本构建 Matter 应用程序(使用 IMX_SDK_ROOT 指定的 Yocto SDK)。请参考以下示例。
假设工作目录更改为此项目的顶级目录。
$ source scripts/activate.sh
# Build the all-clusters example with below command
$ ./scripts/build/build_examples.py --target imx-all-clusters-app build
# Build the lighting example with below command
$ ./scripts/build/build_examples.py --target imx-lighting-app build
# Build the thermostat example with below command
$ ./scripts/build/build_examples.py --target imx-thermostat build
# Build the chip-tool example with below command
$ ./scripts/build/build_examples.py --target imx-chip-tool build
# Build the ota-provider example with below command
$ ./scripts/build/build_examples.py --target imx-ota-provider-app build
# Build the nxp-thermostat-app for certification device reference
$ ./scripts/examples/imxlinux_example.sh -s examples/nxp-thermostat/linux/ -o out/nxp-thermostat -d
# Build the chip-bridge-app example with below command
$ ./scripts/examples/imxlinux_example.sh -s examples/bridge-app/linux/ -o out/bridge-app -d
# Build the security enhanced with Trusty OS application using build_examples.py, by adding "-trusty" to te target. For example:
$ ./scripts/build/build_examples.py --target imx-chip-tool-trusty build
# Build the security enhanced with Trusty OS application using imxlinux_example.sh, by adding "trusty" to the command. For example:
$ ./scripts/examples/imxlinux_example.sh -s examples/nxp-thermostat/linux -o out/nxp-thermostat-trusty -t
# Build the chip-tool-web application using imxlinux_example.sh, by adding "NXP_CHIPTOOL_WITH_WEB=1" to the command. For example:
$ NXP_CHIPTOOL_WITH_WEB=1 ./scripts/examples/imxlinux_example.sh -s examples/chip-tool/ -o out/chip-tool-web -d
应用程序内置在 out/ 子目录中;在构建示例时,使用 --target 选项指定子目录名称。
例如,imx-all-clusters-app 可执行文件可以在 ${MY_Matter_Apps}/connectedhomeip/out/imx-all-clusters-app/ 中找到。
在构建具有相同名称的应用程序之前,请确保子目录不存在。如果需要为多块板卡(i.MX8M Mini EVK、i.MX6ULL EVK 和 i.MX93 EVK)构建应用程序,用户可以使用 --out-prefix 选项指定板卡专用目录;例如:
$./scripts/build/build_examples.py --target imx-chip-tool --out-prefix ./out/imx8mm build
执行上述命令后,chip-tool 可执行文件将在 ${MY_Matter_Apps}/out/imx8mm/imx-chip-tool/ 中找到。
可以在此处找到解释如何使用 chip-tool 作为 Matter 控制器的官方 Matter 文档。
恩智浦 Matter 演示指南中提供了有关如何在 i.MX MPU 平台上使用 Matter 应用程序的文档,恩智浦芯片工具网站指南中提供了有关如何使用 chip-tool-web 应用程序的文档。
Matter 的安全配置
# Connect the OTG port of the i.MX8M Mini to the host PC.
# Boot the i.MX8M Mini EVK board, during the U-Boot bootloader procedure, press any key on the target console to stop boot process and input U-Boot commands.
u-boot=> fastboot 0
# On host side, use fastboot command to initialise the RPMB partition as secure storage. Note that this is a one time programable partition and cannot be revoked.
$ fastboot oem set-rpmb-hardware-key
# Then provision the PAI, DAC, CD and DAC private key via _fastboot_ instructions on your host.
$ fastboot stage <path-to-PAI-CERT>
$ fastboot oem set-matter-pai-cert
$ fastboot stage <path-to-DAC-CERT>
$ fastboot oem set-matter-dac-cert
$ fastboot stage <path-to-CD-CERT>
$ fastboot oem set-matter-cd-cert
$ fastboot stage <path-to-DAC-PRIVATE_KEY>
$ fastboot oem set-matter-dac-private-key
# You will see the following output from the target U-Boot console when it has been successfully provisioned:
u-boot=> fastboot 0
Starting download of 463 bytes downloading of 463 bytes finished
Set matter pai cert successfully!
Starting download of 491 bytes downloading of 491 bytes finished
Set matter dac cert successfully!
Starting download of 539 bytes downloading of 539 bytes finished
Set matter cd cert successfully!
Starting download of 32 bytes downloading of 32 bytes finished
Set matter dac private key successfully!
测试证明二进制文件可在以下位置找到:meta-matter/tools/test_attestation
Trusty OS 包含适用于 i.MX Matter 的可信应用程序 (TA),由 NXP 维护并作为开源发布。请按照以下说明获取 Trusty OS 源代码并构建它:
$ repo init -u https://github.com/nxp-imx/imx-manifest.git -b imx-trusty-matter -m imx_trusty_matter_2023_q2.xml
$ repo sync -c
# Setup the build environment. This will only configure the current terminal.
$ source trusty/vendor/google/aosp/scripts/envsetup.sh
# Build the i.MX8M Mini Trusty OS binary:
$ ./trusty/vendor/google/aosp/scripts/build.py imx8mm --dynamic_param BUILD_MATTER=true
# The target binary will be put on: build-root/build-imx8mm/lk.bin
# Enable the secure storage service on first boot on i.MX8M Mini Linux shell
$ systemctl enable storageproxyd
$ systemctl start storageproxyd
自 i.MX Matter 2023 Q1 版本以来,启用了硬件安全功能,以增强 i.MX8M Mini 上 Matter 的安全性。认证认证和 P256Keypair 密钥受 ARM Trustzone 保护,并存储在基于 i.MX Matter 安全增强解决方案的安全存储中,该解决方案基于 i.MX8M Mini 上使用 Trusty OS TEE 的安全解决方案。该设计基于 CSA Matter Attestation of Security Requirements 文档。
i.MX Matter 安全存储基于 eMMC RPMB。初始化安全存储和提供凭证是使用 fastboot 完成的。请从 SDK Platform-Tools下载 fastboot,然后将 fastboot 添加到您的 ${PATH} 中。要初始化安全存储,请按照以下说明进行操作:
常见问题
Q1 : 为什么 bitbake 过程中会出现 npm EAI_AGAIN 错误,如何解决?
| npm ERR! code EAI_AGAIN
| npm ERR! errno EAI_AGAIN
| npm ERR! request to https://registry.npmjs.org/angular failed, reason:reason: getaddrinfo EAI_AGAIN registry.cnpmjs.org registry.cnpmjs.org:80
答:当多次编译 otbr 时,会出现此 npm EAI_AGAIN错误。在再次执行 bitbake 命令之前,应清除 otbr 中间编译文件。
$ bitbake -c cleanall otbr
$ bitbake imx-image-multimedia
Q2 : 为什么 “zstd -d imx-image-multimedia-imx8mmevk.wic.zst” 命令无法在文件夹 ${MY_YOCTO}/bld-xwayland-imx8mm/tmp/deploy/images/imx8mmevk/ 中执行?
答:因为 imx-image-multimedia-imx8mmevk.wic.zst 是一个链接文件;请将链接目标文件 zstd 或将 imx-image-multimedia-imx8mmevk.wic.zst 复制到另一个文件夹,然后使用 zstd 解压。
$ ls -al
imx-image-multimedia-imx8mmevk.wic.zst -> imx-image-multimedia-imx8mmevk-20220721181418.rootfs.wic.zst
Q3 : 如何解决以下问题?
FAILED: src/web/web-service/frontend/CMakeFiles/otbr-web-frontend /home/ssd-3/matter/yocto/bld-xwayland/ot-br-posix/build/otbr/src/web/web-service/frontend/CMakeFiles/otbr-web-frontend
cd /home/ssd-3/matter/yocto/bld-xwayland/ot-br-posix/build/otbr/src/web/web-service/frontend && cp /home/ssd-3/matter/yocto/bld-xwayland/ot-br-posix/src/web/web-service/frontend/package.json . && npm install
ERROR: npm is known not to run on Node.js v10.19.0
You'll need to upgrade to a newer Node.js version in order to use this
version of npm. You can find the latest version at https://nodejs.org/
答:将节点更新到最新版本。
$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
$ source ~/.profiles or source ~/.bashrc #You can choose one of them as prompted by the previous command
$ nvm install 18
$ node --version # make sure that it was successfully installed.
Q4 : 如果将 Yocto SDK Python3 导出到 shell 环境中,导致 Matter 引导/主动进程失败,该怎么办?
答:打开一个新 shell,然后删除 Yocto SDK 环境并初始化应用程序构建环境。
$ cd ${MY_Matter_Apps}
$ rm -rf .environment
$ source scripts/activate.sh