Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silabs multiprotocol BT HCI support #3572

53 changes: 42 additions & 11 deletions silabs-multiprotocol/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ RUN \
FROM --platform=linux/amd64 cross-builder-${BUILD_ARCH} AS zigbeed-builder

ARG GECKO_SDK_VERSION
ARG BUILD_ARCH

RUN \
set -x \
Expand All @@ -102,7 +103,7 @@ RUN \
&& curl -O https://www.silabs.com/documents/login/software/slc_cli_linux.zip \
&& unzip slc_cli_linux.zip \
&& cd slc_cli/ && chmod +x slc

ENV PATH="/usr/src/slc_cli/:$PATH"

RUN \
Expand All @@ -115,12 +116,22 @@ COPY --from=cpcd-builder /usr/local/ /usr/${DEBIAN_CROSS_PREFIX}/
COPY gecko-sdk-patches/0001-Use-TCP-socket-instead-of-serial-port-SDK.patch /usr/src
COPY zigbeed-app-patches/0001-Use-TCP-socket-instead-of-serial-port-main-app.patch /usr/src

# hadolint ignore=SC3037,SC2039
RUN \
set -x \
&& cd gecko_sdk \
&& patch -p1 < /usr/src/0001-Use-TCP-socket-instead-of-serial-port-SDK.patch \
&& GECKO_SDK=$(pwd) \
&& slc signature trust --sdk=${GECKO_SDK} \
&& if [ "${BUILD_ARCH}" = "armv7" ]; then \
/bin/echo -e "\nprovides:\n - name: zigbee_use_release_libraries\n - name: arm32v7\n" >> protocol/zigbee/app/zigbeed/zigbeed.slcp; \
elif [ "${BUILD_ARCH}" = "amd64" ]; then \
/bin/echo -e "\nprovides:\n - name: zigbee_use_release_libraries\n" >> protocol/zigbee/app/zigbeed/zigbeed.slcp; \
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \
/bin/echo -e "\nprovides:\n - name: zigbee_use_release_libraries\n - name: arm64v8\n" >> protocol/zigbee/app/zigbeed/zigbeed.slcp; \
else \
exit 1; \
fi \
&& cd protocol/zigbee \
&& slc generate \
--sdk=${GECKO_SDK} \
Expand All @@ -136,8 +147,24 @@ RUN \
LD="${DEBIAN_CROSS_PREFIX}-gcc" \
CXX="${DEBIAN_CROSS_PREFIX}-g++" \
C_FLAGS="-std=gnu99 -DEMBER_MULTICAST_TABLE_SIZE=16" \
LD_FLAGS="" \
GROUP_START="-Wl,--start-group" GROUP_END="-Wl,--end-group -lpthread" \
debug

# hadolint ignore=SC3037,SC2039
RUN \
set -x \
&& cd gecko_sdk \
&& GECKO_SDK=$(pwd) \
&& cd app/bluetooth/example_host/bt_host_cpc_hci_bridge \
&& make -f makefile \
AR="${DEBIAN_CROSS_PREFIX}-ar" \
CC="${DEBIAN_CROSS_PREFIX}-gcc" \
LD="${DEBIAN_CROSS_PREFIX}-gcc" \
CXX="${DEBIAN_CROSS_PREFIX}-g++" \
C_FLAGS="-std=gnu99" \
LD_FLAGS=""

FROM $BUILD_FROM

ARG UNIVERSAL_SILABS_FLASHER
Expand Down Expand Up @@ -166,10 +193,10 @@ ENV WEB_GUI=1
ENV DOCKER 1

COPY otbr-patches/0001-Avoid-writing-to-system-console.patch /usr/src
COPY otbr-patches/0001-rest-support-erasing-all-persistent-info-1908.patch /usr/src
COPY otbr-patches/0002-rest-support-deleting-the-dataset.patch /usr/src
COPY otbr-patches/0003-mdns-update-mDNSResponder-to-1790.80.10.patch /usr/src
COPY otbr-patches/0004-mdns-add-Linux-specific-patches.patch /usr/src

# OTBR accesses the CPC Daemon build directory
COPY --from=cpcd-builder /usr/src/cpc-daemon /usr/src/gecko_sdk/platform/service/cpc/daemon

# Required and installed during build (script/bootstrap), could be removed
ENV OTBR_BUILD_DEPS build-essential ninja-build cmake wget ca-certificates \
Expand Down Expand Up @@ -197,12 +224,10 @@ RUN \
lsb-release \
netcat \
sudo \
libmbedtls-dev \
&& cd ot-br-posix \
&& patch -p1 < /usr/src/0001-Avoid-writing-to-system-console.patch \
&& patch -p1 < /usr/src/0001-rest-support-erasing-all-persistent-info-1908.patch \
&& patch -p1 < /usr/src/0002-rest-support-deleting-the-dataset.patch \
&& patch -p1 < /usr/src/0003-mdns-update-mDNSResponder-to-1790.80.10.patch \
&& patch -p1 < /usr/src/0004-mdns-add-Linux-specific-patches.patch \
&& ln -s ../../../openthread/ third_party/openthread/repo \
&& (cd third_party/openthread/repo \
&& ln -s ../../../../silabs-vendor-interface/openthread-core-silabs-posix-config.h src/posix/platform/openthread-core-silabs-posix-config.h) \
Expand All @@ -223,11 +248,13 @@ RUN \
-DOTBR_VERSION= \
-DOT_PACKAGE_VERSION= \
-DOTBR_DBUS=OFF \
-DOT_THREAD_VERSION=1.3 \
-DOT_MULTIPAN_RCP=ON \
-DOT_POSIX_CONFIG_RCP_BUS=VENDOR \
-DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=SilabsRcpDeps \
-DCPCD_SOURCE_DIR=/usr/src/gecko_sdk/platform/service/cpc/daemon \
-DOT_POSIX_RCP_VENDOR_BUS=ON \
-DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=/usr/src/silabs-vendor-interface/posix_vendor_rcp.cmake \
-DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=/usr/src/silabs-vendor-interface/cpc_interface.cpp \
-DOT_CONFIG="openthread-core-silabs-posix-config.h" \
-DOT_PLATFORM_CONFIG="openthread-core-silabs-posix-config.h" \
-DOT_LINK_RAW=1 \
-DOTBR_VENDOR_NAME="Home Assistant" \
-DOTBR_PRODUCT_NAME="Silicon Labs Multiprotocol" \
Expand Down Expand Up @@ -255,6 +282,10 @@ COPY --from=zigbeed-builder \
/usr/src/gecko_sdk/protocol/zigbee/app/zigbeed/output/build/debug/zigbeed \
/usr/local/bin

COPY --from=zigbeed-builder \
/usr/src/gecko_sdk/app/bluetooth/example_host/bt_host_cpc_hci_bridge/exe/bt_host_cpc_hci_bridge \
/usr/local/bin

RUN ldconfig && touch /accept_silabs_msla

COPY rootfs /
Expand All @@ -266,4 +297,4 @@ HEALTHCHECK --interval=10s --start-period=120s CMD [ "$(s6-svstat -u /run/servic

# use s6-overlay as init system
WORKDIR /
ENTRYPOINT ["/init"]
ENTRYPOINT ["/init"]
4 changes: 2 additions & 2 deletions silabs-multiprotocol/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ build_from:
armv7: ghcr.io/home-assistant/armv7-base-debian:bullseye
amd64: ghcr.io/home-assistant/amd64-base-debian:bullseye
args:
CPCD_VERSION: v4.3.1
GECKO_SDK_VERSION: v4.3.1
CPCD_VERSION: v4.4.2
GECKO_SDK_VERSION: v4.4.2
UNIVERSAL_SILABS_FLASHER: 0.0.17
4 changes: 3 additions & 1 deletion silabs-multiprotocol/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 2.4.5
version: 2.5.0
slug: silabs_multiprotocol
name: Silicon Labs Multiprotocol
description: Zigbee and OpenThread multiprotocol add-on
Expand Down Expand Up @@ -30,6 +30,7 @@ options:
autoflash_firmware: true
cpcd_trace: false
otbr_enable: true
bt_hci_enable: false
otbr_log_level: notice
otbr_firewall: true
ports:
Expand All @@ -48,6 +49,7 @@ schema:
autoflash_firmware: bool
cpcd_trace: bool
otbr_enable: bool
bt_hci_enable: bool
otbr_log_level: list(debug|info|notice|warning|error|critical|alert|emergency)
otbr_firewall: bool
stage: experimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From 53d4be5c893dac04a909563444453fb471852ccc Mon Sep 17 00:00:00 2001
Message-Id: <53d4be5c893dac04a909563444453fb471852ccc.1677692173[email protected]>
From e0792b7605e6d6cb2ebd491025aee7f84d1edbaa Mon Sep 17 00:00:00 2001
Message-ID: <e0792b7605e6d6cb2ebd491025aee7f84d1edbaa.1692864566[email protected]>
From: Stefan Agner <[email protected]>
Date: Thu, 17 Feb 2022 22:57:16 +0100
Subject: [PATCH] Avoid writing to system console
Expand All @@ -13,18 +13,17 @@ stderr.
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/common/logging.cpp b/src/common/logging.cpp
index 5398e47133..69f150dadb 100644
index 5a787e8213..79fccf77ca 100644
--- a/src/common/logging.cpp
+++ b/src/common/logging.cpp
@@ -83,7 +83,7 @@ void otbrLogInit(const char *aIdent, otbrLogLevel aLevel, bool aPrintStderr)
assert(aIdent);
assert(aLevel >= OTBR_LOG_EMERG && aLevel <= OTBR_LOG_DEBUG);
@@ -88,7 +88,7 @@ void otbrLogInit(const char *aProgramName, otbrLogLevel aLevel, bool aPrintStder
ident = strrchr(aProgramName, '/');
ident = (ident != nullptr) ? ident + 1 : aProgramName;

- openlog(aIdent, (LOG_CONS | LOG_PID) | (aPrintStderr ? LOG_PERROR : 0), OTBR_SYSLOG_FACILITY_ID);
+ openlog(aIdent, LOG_PID | (aPrintStderr ? LOG_PERROR : 0), LOG_USER);
- openlog(ident, (LOG_CONS | LOG_PID) | (aPrintStderr ? LOG_PERROR : 0), OTBR_SYSLOG_FACILITY_ID);
+ openlog(ident, LOG_PID | (aPrintStderr ? LOG_PERROR : 0), OTBR_SYSLOG_FACILITY_ID);
sLevel = aLevel;
sDefaultLevel = sLevel;
}
--
2.39.1

2.42.0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ab31af226c8d4ad1f46d03616e68a80f2a04a35e Mon Sep 17 00:00:00 2001
Message-ID: <ab31af226c8d4ad1f46d03616e68a80f2a04a35e.1691047014[email protected]>
In-Reply-To: <29c0b6b142c6692a53a83fb4604fc2bcebeb17af.1691047014[email protected]>
References: <29c0b6b142c6692a53a83fb4604fc2bcebeb17af.1691047014[email protected]>
From 2c0c78e5f4dc85a63934fc0c32c035a9c5b5babd Mon Sep 17 00:00:00 2001
Message-ID: <2c0c78e5f4dc85a63934fc0c32c035a9c5b5babd.1692864566[email protected]>
In-Reply-To: <e0792b7605e6d6cb2ebd491025aee7f84d1edbaa.1692864566[email protected]>
References: <e0792b7605e6d6cb2ebd491025aee7f84d1edbaa.1692864566[email protected]>
From: Stefan Agner <[email protected]>
Date: Mon, 5 Jun 2023 23:41:50 +0200
Subject: [PATCH] [rest] support deleting the dataset
Expand Down Expand Up @@ -122,5 +122,4 @@ index d79085dbfc..362e501471 100644
void DeleteOutDatedDiagnostic(void);
void UpdateDiag(std::string aKey, std::vector<otNetworkDiagTlv> &aDiag);
--
2.41.0

2.42.0
Loading