Building OTBR Locally#
The purpose of this document is to provide comprehensive steps and guidance on building an OpenThread Border Router (OTBR) that communicates with the Co-Processor Communication Daemon (CPCd). This guide aims to assist developers and engineers in setting up and configuring an OTBR to enhance network communication and management. By following the outlined procedures, you can use the OTBR in a multiprotocol context. For reference on hardware or software requirements, refer to the local host configuration and co-processor configuration.
Install OTBR Repository#
OpenThread host applications can be built from Silicon Lab's SDK as well as GitHub repositories. Silicon Labs provides a vendor extension to build an OpenThread Linux host application with multi-PAN and CPC support.
Start by cloning the SDK source code on your Raspberry Pi:
git clone https://github.com/SiliconLabs/simplicity_sdk.git
sudo apt-get install bind9
For steps on setting up and running CPCd, refer to Building CPCd locally.
Building OTBR#
Before proceeding to build the OTBR, first, ensure:
GSDK OpenThread repo is in ~/simplicity_sdk/util/third_party/openthread
. This folder must be symlinked under ~/simplicity_sdk/util/third_party/ot-br-posix/third_party/openthread/repo
:
ln -s ~/simplicity_sdk/util/third_party/openthread/ ~/simplicity_sdk/util/third_party/ot-br-posix/third_party/openthread/repo
Now, install the dependencies. You can use the bootstrap script for the default usage:
cd ~/simplicity_sdk/util/third_party/ot-br-posix/
./script/bootstrap
To configure the OTBR for multi-PAN and CPC support, you can use Silicon Labs specific configuration settings for border-router and ot-cli. Use the special configuration header hosted in the GSDK/SiSDK under protocol/openthread/platform-abstraction/posix/openthread-core-silabs-posix-config.h
.
sudo cp ~/simplicity_sdk/protocol/openthread/platform-abstraction/posix/openthread-core-silabs-posix-config.h ~/simplicity_sdk/util/third_party/openthread/src/posix/platform/
To build a Thread certifiable otbr-agent, use the following reference commands, which should be run from under the util/third_party/otbr-posix
directory. Make sure to provide the absolute path to $SDK_DIR
and $CPCD_DIR
variables, for example:
export SDK_DIR=<An absolute path to SDK directory>
export CPCD_DIR=<An absolute path to CPCD directory>
Run the bootstrap script:
sudo RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 NAT64=1 DNS64=1 ./script/bootstrap
Note: The specific flags shown in the previous command are for a 'certifiable' OTBR.
Run the setup script to complete building OTBR:
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.4 -DOT_MULTIPAN_RCP=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_RCP_VENDOR_BUS=ON -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$SDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_CLI_VENDOR_EXTENSION=$SDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_cli.cmake -DOT_PLATFORM_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
Some of the important Build Flags are the following:
OT_POSIX_CONFIG_RCP_VENDOR_INTERFACE: This needs to point to vendor interface source files. For Multiprotocol solutions this is the cpc_interface.cpp file.
OT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE: This points to the vendor interface CMake package file. For Multiprotocol solutions this is the posix_vendor_rcp.cmake file. (Note in earlier releases this was referred to as SilabsRcpDeps).
DOT_MULTIPAN_RCP=ON: Compiles the Multipan RCP Code.
OT_POSIX_RCP_VENDOR_BUS=ON
DOT_PLATFORM_CONFIG: This should point to our openthread-core-silabs-posix-config.h file.
To link against the cpc library and header, it is recommended that cpcd is first built and installed. The openthread CMake projects will automatically resolve these dependencies using pkgconfig or by searching in standard installation directories. If cpcd is not installed, the library path and include directory can be specified as CMake arguments (-DCpc_LIBRARY and -DCpc_INCLUDE_DIR respectively), or the root path to the cpc-daemon project can be specified as a CMake argument (-DCPCD_SOURCE_DIR).
Note:
Host applications can be built using 'CMake' only; 'make' is unsupported.
If you are looking to clear or update your build space, ensure to do the following command
sudo rm -rf build/
.
Configuration of the OTBR#
Once the OTBR has been successfully built, you need to modify the Radio URl to point to the correct CPCd iid. Both Zigbeed and the OpenThread stack can connect to CPCd and use the multi-PAN RCP at one time. Spinel messages for each application are labeled with a Spinel Interface ID (IID), which is supplied to the application at startup via the OpenThread Radio URL command line argument. The fact that the RCP is being shared between multiple PANs is transparent to the host applications. In a multiprotocol context, the OTBR is expecting to be iid = 2.
/etc/default/otbr-agent
is the configuration file where you can update the Radio URL as follows:
sudo vi /etc/default/otbr-agent
OTBR_AGENT_OPTS="-I wpan0 -B eth0 spinel+cpc://cpcd_0?iid=2&iid-list=0"
To confirm that the OTBR is correctly running, you can access its CLI utility by executing sudo ot-ctl
.
OTBR Build Commands for SDK Versions#
The following table contains the reference OTBR build commands for a few previous releases.
Common steps for following SDK releases:
SiSDK 2024.06#
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.4 -DOT_MULTIPAN_RCP=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_RCP_VENDOR_BUS=ON -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_CLI_VENDOR_EXTENSION=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_cli.cmake -DOT_PLATFORM_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
GSDK v4.4.3#
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.3 -DOT_MULTIPAN_RCP=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_RCP_VENDOR_BUS=ON -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_PROJECT_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
GSDK v4.4.2#
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.3 -DOT_MULTIPAN_RCP=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_CONFIG_RCP_BUS=VENDOR -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
GSDK v4.4.1, v4.4.0#
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.3 -DOT_MULTIPAN_RCP=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_RCP_VENDOR_BUS=ON -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
GSDK v4.3.3, v4.3.2#
sudo INFRA_IF_NAME=eth0 RELEASE=1 REFERENCE_DEVICE=1 BACKBONE_ROUTER=1 BORDER_ROUTING=1 NAT64=1 DNS64=1 OTBR_OPTIONS="-DOT_THREAD_VERSION=1.3 -DOT_MULTIPAN_RCP=ON -DCMAKE_MODULE_PATH=$GSDK_DIR/protocol/openthread/platform-abstraction/posix -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_CONFIG_RCP_BUS=VENDOR -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=SilabsRcpDeps -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_CONFIG=openthread-core-silabs-posix-config.h -DOTBR_DUA_ROUTING=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON" ./script/setup
Building OT-CLI#
This command will build the posix ot-cli app using CMake (which is a different OT Host application than the OTBR). The command to build the posix ot-cli from the util/third_party/openthread
directory of the SDK using CMake:
sudo ./script/cmake-build posix -DOT_MULTIPAN_RCP=ON -DOT_POSIX_RCP_HDLC_BUS=ON -DOT_POSIX_RCP_SPI_BUS=ON -DOT_POSIX_RCP_VENDOR_BUS=ON -DCPCD_SOURCE_DIR=$CPCD_DIR -DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=$GSDK_DIR/protocol/openthread/platform-abstraction/posix/cpc_interface.cpp -DOT_PLATFORM_CONFIG=openthread-core-silabs-posix-config.h -DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=$SDK_DIR/protocol/openthread/platform-abstraction/posix/posix_vendor_rcp.cmake
Build ‘otbr-agent’ and ‘ot-cli’ host applications using Silicon Labs SDK artifacts provides OT_PLATFORM_CONFIG, CPCD_SOURCE_DIR, and DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE configurations.