Skip to content

Commit

Permalink
silabs-multiprotocol: Revert to Gecko SDK v4.3.1 (#3388)
Browse files Browse the repository at this point in the history
* Revert "silabs-multiprotocol: Update to Gecko SDK v4.4.0 (#3370)"

This reverts commit 07104ea.

* Update CHANGELOG.md accordingly

* Update silabs-multiprotocol/CHANGELOG.md

Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>

---------

Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
  • Loading branch information
agners and puddly committed Jan 5, 2024
1 parent 96d37f4 commit 01eff65
Show file tree
Hide file tree
Showing 14 changed files with 1,230 additions and 46 deletions.
4 changes: 4 additions & 0 deletions silabs-multiprotocol/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.4.1

- Revert back to Silicon Labs Gecko SDK 4.3.1 to maintain compatibility with Home Assistant Core 2023.12.0 and Zigbee2MQTT. If you are running 2024.1.0 with ZHA, you don't have to downgrade.

## 2.4.0

- Use Silicon Labs Gecko SDK 4.4.0
Expand Down
33 changes: 10 additions & 23 deletions silabs-multiprotocol/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ RUN \
FROM --platform=linux/amd64 cross-builder-${BUILD_ARCH} AS zigbeed-builder

ARG GECKO_SDK_VERSION
ARG BUILD_ARCH

RUN \
set -x \
Expand All @@ -103,7 +102,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 @@ -116,22 +115,12 @@ 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 @@ -147,8 +136,6 @@ 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

FROM $BUILD_FROM
Expand Down Expand Up @@ -179,10 +166,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

# OTBR accesses the CPC Daemon build directory
COPY --from=cpcd-builder /usr/src/cpc-daemon /usr/src/gecko_sdk/platform/service/cpc/daemon
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

# 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 @@ -210,10 +197,12 @@ 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 @@ -234,13 +223,11 @@ RUN \
-DOTBR_VERSION= \
-DOT_PACKAGE_VERSION= \
-DOTBR_DBUS=OFF \
-DOT_THREAD_VERSION=1.3 \
-DOT_MULTIPAN_RCP=ON \
-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_BUS=VENDOR \
-DOT_POSIX_CONFIG_RCP_VENDOR_DEPS_PACKAGE=SilabsRcpDeps \
-DOT_POSIX_CONFIG_RCP_VENDOR_INTERFACE=/usr/src/silabs-vendor-interface/cpc_interface.cpp \
-DOT_PLATFORM_CONFIG="openthread-core-silabs-posix-config.h" \
-DOT_CONFIG="openthread-core-silabs-posix-config.h" \
-DOT_LINK_RAW=1 \
-DOTBR_VENDOR_NAME="Home Assistant" \
-DOTBR_PRODUCT_NAME="Silicon Labs Multiprotocol" \
Expand Down
6 changes: 3 additions & 3 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.4.0
GECKO_SDK_VERSION: v4.4.0
UNIVERSAL_SILABS_FLASHER: 0.0.16
CPCD_VERSION: v4.3.1
GECKO_SDK_VERSION: v4.3.1
UNIVERSAL_SILABS_FLASHER: 0.0.13
2 changes: 1 addition & 1 deletion silabs-multiprotocol/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 2.4.0
version: 2.4.1
slug: silabs_multiprotocol
name: Silicon Labs Multiprotocol
description: Zigbee and OpenThread multiprotocol add-on
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
From e0792b7605e6d6cb2ebd491025aee7f84d1edbaa Mon Sep 17 00:00:00 2001
Message-ID: <e0792b7605e6d6cb2ebd491025aee7f84d1edbaa.1692864566.git.stefan@agner.ch>
From 53d4be5c893dac04a909563444453fb471852ccc Mon Sep 17 00:00:00 2001
Message-Id: <53d4be5c893dac04a909563444453fb471852ccc.1677692173.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 17 Feb 2022 22:57:16 +0100
Subject: [PATCH] Avoid writing to system console
Expand All @@ -13,18 +13,18 @@ stderr.
1 file changed, 1 insertion(+), 1 deletion(-)

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

- 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);
- openlog(aIdent, (LOG_CONS | LOG_PID) | (aPrintStderr ? LOG_PERROR : 0), OTBR_SYSLOG_FACILITY_ID);
+ openlog(aIdent, LOG_PID | (aPrintStderr ? LOG_PERROR : 0), LOG_USER);
sLevel = aLevel;
sDefaultLevel = sLevel;
}
--
2.42.0
2.39.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
From 29c0b6b142c6692a53a83fb4604fc2bcebeb17af Mon Sep 17 00:00:00 2001
Message-ID: <29c0b6b142c6692a53a83fb4604fc2bcebeb17af.1691047014.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 13 Jul 2023 20:00:34 +0200
Subject: [PATCH] [rest] support erasing all persistent info (#1908)

Add REST API to support erasing all persistent information, effectively
factory resetting the OTBR. The implementation follows the semantic of
the D-Bus API and automatically disables the Thread network.

After erasing all persistent information the dataset is cleared too. So
this allows to build a new Thread network with subsequent use of the
PUT method to the /node/dataset/active endpoint.
---
src/rest/openapi.yaml | 9 +++++++++
src/rest/resource.cpp | 38 ++++++++++++++++++++++++++++++++++----
src/rest/resource.hpp | 1 +
src/rest/response.cpp | 2 +-
4 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/src/rest/openapi.yaml b/src/rest/openapi.yaml
index 43747e2e01..2ba2a4dd56 100644
--- a/src/rest/openapi.yaml
+++ b/src/rest/openapi.yaml
@@ -43,6 +43,15 @@ paths:
application/json:
schema:
type: object
+ delete:
+ tags:
+ - node
+ summary: Erase all persistent information, essentially factory reset the Border Router.
+ responses:
+ "200":
+ description: Successful operation
+ "409":
+ description: Thread interface is in wrong state.
/node/ba-id:
get:
tags:
diff --git a/src/rest/resource.cpp b/src/rest/resource.cpp
index 1139a2d788..a60e9d9483 100644
--- a/src/rest/resource.cpp
+++ b/src/rest/resource.cpp
@@ -257,16 +257,46 @@ exit:
}
}

-void Resource::NodeInfo(const Request &aRequest, Response &aResponse) const
+void Resource::DeleteNodeInfo(Response &aResponse) const
{
+ otbrError error = OTBR_ERROR_NONE;
std::string errorCode;
- if (aRequest.GetMethod() == HttpMethod::kGet)
+
+ VerifyOrExit(mNcp->GetThreadHelper()->Detach() == OT_ERROR_NONE, error = OTBR_ERROR_INVALID_STATE);
+ VerifyOrExit(otInstanceErasePersistentInfo(mInstance) == OT_ERROR_NONE, error = OTBR_ERROR_REST);
+ mNcp->Reset();
+
+exit:
+ if (error == OTBR_ERROR_NONE)
{
- GetNodeInfo(aResponse);
+ errorCode = GetHttpStatus(HttpStatusCode::kStatusOk);
+ aResponse.SetResponsCode(errorCode);
}
- else
+ else if (error == OTBR_ERROR_INVALID_STATE)
+ {
+ ErrorHandler(aResponse, HttpStatusCode::kStatusConflict);
+ }
+ else if (error != OTBR_ERROR_NONE)
{
+ ErrorHandler(aResponse, HttpStatusCode::kStatusInternalServerError);
+ }
+}
+
+void Resource::NodeInfo(const Request &aRequest, Response &aResponse) const
+{
+ std::string errorCode;
+
+ switch (aRequest.GetMethod())
+ {
+ case HttpMethod::kGet:
+ GetNodeInfo(aResponse);
+ break;
+ case HttpMethod::kDelete:
+ DeleteNodeInfo(aResponse);
+ break;
+ default:
ErrorHandler(aResponse, HttpStatusCode::kStatusMethodNotAllowed);
+ break;
}
}

diff --git a/src/rest/resource.hpp b/src/rest/resource.hpp
index 0c089c7296..d79085dbfc 100644
--- a/src/rest/resource.hpp
+++ b/src/rest/resource.hpp
@@ -137,6 +137,7 @@ private:
void HandleDiagnosticCallback(const Request &aRequest, Response &aResponse);

void GetNodeInfo(Response &aResponse) const;
+ void DeleteNodeInfo(Response &aResponse) const;
void GetDataBaId(Response &aResponse) const;
void GetDataExtendedAddr(Response &aResponse) const;
void GetDataState(Response &aResponse) const;
diff --git a/src/rest/response.cpp b/src/rest/response.cpp
index 93cbe0b6df..3460b90e1f 100644
--- a/src/rest/response.cpp
+++ b/src/rest/response.cpp
@@ -34,7 +34,7 @@
#define OT_REST_RESPONSE_ACCESS_CONTROL_ALLOW_HEADERS \
"Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, " \
"Access-Control-Request-Headers"
-#define OT_REST_RESPONSE_ACCESS_CONTROL_ALLOW_METHOD "GET, OPTIONS, PUT"
+#define OT_REST_RESPONSE_ACCESS_CONTROL_ALLOW_METHOD "DELETE, GET, OPTIONS, PUT"
#define OT_REST_RESPONSE_CONNECTION "close"

namespace otbr {
--
2.41.0

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From b7c0c61b56d32ec5fc65160d10c0fd66f0ac9c8a Mon Sep 17 00:00:00 2001
Message-ID: <b7c0c61b56d32ec5fc65160d10c0fd66f0ac9c8a.1691047014.git.stefan@agner.ch>
In-Reply-To: <29c0b6b142c6692a53a83fb4604fc2bcebeb17af.1691047014.git.stefan@agner.ch>
References: <29c0b6b142c6692a53a83fb4604fc2bcebeb17af.1691047014.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Wed, 21 Jun 2023 12:04:33 +0200
Subject: [PATCH] [mdns] update mDNSResponder to 1790.80.10

---
script/bootstrap | 11 +++++------
tests/scripts/bootstrap.sh | 9 ++++-----
2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/script/bootstrap b/script/bootstrap
index 0b72aa4971..2256f5e437 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -56,16 +56,15 @@ install_packages_apt()

# mDNS
sudo apt-get install --no-install-recommends -y libavahi-client3 libavahi-common-dev libavahi-client-dev avahi-daemon
- (MDNS_RESPONDER_SOURCE_NAME=mDNSResponder-1310.80.1 \
+ (MDNS_RESPONDER_SOURCE_NAME=mDNSResponder-1790.80.10 \
&& cd /tmp \
&& wget --no-check-certificate https://github.com/apple-oss-distributions/mDNSResponder/archive/refs/tags/$MDNS_RESPONDER_SOURCE_NAME.tar.gz \
&& mkdir -p $MDNS_RESPONDER_SOURCE_NAME \
&& tar xvf $MDNS_RESPONDER_SOURCE_NAME.tar.gz -C $MDNS_RESPONDER_SOURCE_NAME --strip-components=1 \
- && cd /tmp/$MDNS_RESPONDER_SOURCE_NAME/Clients \
- && sed -i '/#include <ctype.h>/a #include <stdarg.h>' dns-sd.c \
- && sed -i '/#include <ctype.h>/a #include <sys/param.h>' dns-sd.c \
- && cd /tmp/$MDNS_RESPONDER_SOURCE_NAME/mDNSPosix \
- && make os=linux && sudo make install os=linux)
+ && cd /tmp/"$MDNS_RESPONDER_SOURCE_NAME"/mDNSShared \
+ && sed -i 's/__block mStatus err;/mStatus err;/' uds_daemon.c \
+ && cd /tmp/"$MDNS_RESPONDER_SOURCE_NAME"/mDNSPosix \
+ && make os=linux tls=no && sudo make install os=linux tls=no)

# Boost
sudo apt-get install --no-install-recommends -y libboost-dev libboost-filesystem-dev libboost-system-dev
diff --git a/tests/scripts/bootstrap.sh b/tests/scripts/bootstrap.sh
index a89e9ccd6e..6b4affffce 100755
--- a/tests/scripts/bootstrap.sh
+++ b/tests/scripts/bootstrap.sh
@@ -126,15 +126,14 @@ case "$(uname)" in
fi

if [ "${OTBR_MDNS-}" == 'mDNSResponder' ]; then
- SOURCE_NAME=mDNSResponder-1310.80.1
+ SOURCE_NAME=mDNSResponder-1790.80.10
wget https://github.com/apple-oss-distributions/mDNSResponder/archive/refs/tags/$SOURCE_NAME.tar.gz \
&& mkdir -p $SOURCE_NAME \
&& tar xvf $SOURCE_NAME.tar.gz -C $SOURCE_NAME --strip-components=1 \
- && cd $SOURCE_NAME/Clients \
- && sed -i '/#include <ctype.h>/a #include <stdarg.h>' dns-sd.c \
- && sed -i '/#include <ctype.h>/a #include <sys/param.h>' dns-sd.c \
+ && cd "$SOURCE_NAME"/mDNSShared \
+ && sed -i 's/__block mStatus err;/mStatus err;/' uds_daemon.c \
&& cd ../mDNSPosix \
- && make os=linux && sudo make install os=linux
+ && make os=linux tls=no && sudo make install os=linux tls=no
fi

# Enable IPv6
--
2.41.0

Loading

0 comments on commit 01eff65

Please sign in to comment.