Skip to content

Commit 1b4a3e8

Browse files
Integrate network-manager with openthread-br plus miscellaneous updates (#37)
* Add a git-with-metadata download method that can capture metadata from the git repository and include it in the download archive for use at build time. * Move overlay.{sh,mk} into include directory * Use git-with-metadata for the gn build * Update mDNSReponder package to 2881.0.25 * Update openthread-br to 07fc9adf and add a patch for an enhanced ubus interface * Update network-manager app to 8f221d80 This change integrates the TBRM cluster with openthread-br using ubus. * Move CI to OpenWrt 24.10.4 * Fix error handling in git-with-metadata hook
1 parent 7255445 commit 1b4a3e8

17 files changed

Lines changed: 4193 additions & 56 deletions

File tree

.containers/matter-openwrt-build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG OPENWRT_VERSION=24.10.2
1+
ARG OPENWRT_VERSION=24.10.4
22
FROM ghcr.io/openwrt/sdk:x86-generic-${OPENWRT_VERSION}
33
LABEL org.opencontainers.image.description="Pre-warmed OpenWrt SDK"
44

.github/workflows/build-packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Build
1818
uses: addnab/docker-run-action@v3
1919
with:
20-
image: ghcr.io/project-chip/matter-openwrt-build:24.10.2
20+
image: ghcr.io/project-chip/matter-openwrt-build:24.10.4
2121
options: --volume ${{ github.workspace }}:/workspace
2222
shell: bash
2323
run: |

devel/gn/Makefile

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,12 @@ include $(TOPDIR)/rules.mk
1616

1717
PKG_NAME:=gn
1818
PKG_SOURCE_URL:=https://gn.googlesource.com/gn
19-
PKG_SOURCE_PROTO:=git
19+
PKG_SOURCE_PROTO:=git-with-metadata
2020
PKG_SOURCE_MIRROR:=0 # don't try OpenWrt mirror
2121

22-
# GN versioning is based on the number of commits since the tag `initial-commit`,
23-
# and is exposed to build scripts via the `gn_version` variable. When updating
24-
# PKG_SOURCE_VERSION to a new commit hash, GN_VERSION needs to be obtained via
25-
# git describe HEAD --match initial-commit | cut -f 3 -d -
26-
# and updated below.
2722
PKG_SOURCE_DATE:=2025-03-21
2823
PKG_SOURCE_VERSION:=6e8e0d6d4a151ab2ed9b4a35366e630c55888444
29-
PKG_MIRROR_HASH:=0767a5dffe09bbb779df2be610554b7b3c660fb7910f60136bd25c34faf33bab
30-
GN_VERSION:=2223
24+
PKG_MIRROR_HASH:=544da724e63e496be1f29df66259a6dd61bd6f4925b6310766185a5488d95681
3125

3226
PKG_LICENSE:=BSD-3-Clause
3327
PKG_LICENSE_FILES:=LICENSE
@@ -37,6 +31,13 @@ HOST_BUILD_PARALLEL:=1
3731

3832
include $(INCLUDE_DIR)/package.mk
3933
include $(INCLUDE_DIR)/host-build.mk
34+
include ../../include/git-with-metadata.mk
35+
36+
define GitWithMetadata/gather
37+
desc="`git describe HEAD --abbrev=12 --match initial-commit`" && \
38+
echo -n "GN_VERSION=" && echo "$$$$desc" | cut -d - -f 3 && \
39+
echo -n "GN_COMMIT=" && echo "$$$$desc" | cut -d - -f 4 | cut -c 2-
40+
endef
4041

4142
define Package/gn
4243
SECTION:=devel
@@ -51,10 +52,13 @@ endef
5152

5253
define Host/Configure
5354
cd $(HOST_BUILD_DIR) && $(HOST_CONFIGURE_VARS) \
54-
$(STAGING_DIR_HOST)/bin/python build/gen.py --no-last-commit-position
55-
echo "$$$$GN_LAST_COMMIT_HEADER" | \
56-
VER_NUM=$(GN_VERSION) VER_STR="$(GN_VERSION) (`echo "$(PKG_SOURCE_VERSION)" | cut -c 1-12`)" \
57-
perl -lpe 's/\$$$$(\w+)/$$$$ENV{$$$$1}/ge' >$(HOST_BUILD_DIR)/out/last_commit_position.h
55+
$(STAGING_DIR_HOST)/bin/python build/gen.py --no-last-commit-position && \
56+
{ . .git-metadata && \
57+
echo "#ifndef OUT_LAST_COMMIT_POSITION_H_" && \
58+
echo "#define OUT_LAST_COMMIT_POSITION_H_" && \
59+
echo "#define LAST_COMMIT_POSITION_NUM $$$$GN_VERSION" && \
60+
echo "#define LAST_COMMIT_POSITION \"$$$$GN_VERSION ($$$$GN_COMMIT)\"" && \
61+
echo "#endif // OUT_LAST_COMMIT_POSITION_H_" ; } >$(HOST_BUILD_DIR)/out/last_commit_position.h
5862
endef
5963

6064
define Host/Compile
@@ -66,14 +70,5 @@ define Host/Install
6670
$(INSTALL_BIN) $(HOST_BUILD_DIR)/out/gn $(1)/bin
6771
endef
6872

69-
define GN_LAST_COMMIT_HEADER
70-
#ifndef OUT_LAST_COMMIT_POSITION_H_
71-
#define OUT_LAST_COMMIT_POSITION_H_
72-
#define LAST_COMMIT_POSITION_NUM $$VER_NUM
73-
#define LAST_COMMIT_POSITION "$$VER_STR"
74-
#endif // OUT_LAST_COMMIT_POSITION_H_
75-
endef
76-
export GN_LAST_COMMIT_HEADER
77-
7873
$(eval $(call BuildPackage,gn))
7974
$(eval $(call HostBuild))

include/git-with-metadata.mk

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
GWM_SH:=$(patsubst %.mk,%.sh,$(abspath $(lastword $(MAKEFILE_LIST))))
16+
17+
# Hook function that gathers git metadata; it can be overridden by the
18+
# package Makefile. The output of this shell command (or commands) is
19+
# captured into a .git-metadata file located at the root of the source tree.
20+
define GitWithMetadata/gather
21+
git show -s --format="COMMIT_TIMESTAMP=%ct" HEAD
22+
endef
23+
24+
# Expands into a shell expression that resolves a variable from
25+
# .git-metadata at build time, usually for passing as an argument
26+
# to configure or cmake.
27+
# Example: $(call GitWithMetadata/resolve,COMMIT_HASH)
28+
define GitWithMetadata/resolve
29+
"`. .git-metadata && echo "$$$$$(1)"`"
30+
endef
31+
32+
ifndef DownloadMethod/default
33+
$(error git-with-metadata.mk must be included after package.mk)
34+
endif
35+
36+
# Set up hooks and delegate to the 'git' download method.
37+
$(eval dl_tar_pack=true dl_tar_pack && $(value dl_tar_pack))
38+
define DownloadMethod/git-with-metadata
39+
gwm_gather_$(if $(filter skip,$(SUBMODULES)),checkout,submodules)() { $(GitWithMetadata/gather) ; } && \
40+
SUBDIR=$(SUBDIR) && . $(GWM_SH) && $(call DownloadMethod/git,$(1),$(2))
41+
endef

include/git-with-metadata.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2025 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This script is sourced at the start of a git download command sequence.
16+
# It intercepts `git` and `true` commands so additional work can be
17+
# performed at these injection points.
18+
19+
GWM_IN_HOOK=
20+
GWM_META="$(mktemp -t gwm-meta.XXXXXX)"
21+
22+
git() { command git "$@" && { [ -n "$GWM_IN_HOOK" ] || gwm_hook git "$@"; }; }
23+
true() { [ -n "$GWM_IN_HOOK" ] || gwm_hook true "$@"; }
24+
25+
gwm_gather() {
26+
local func="gwm_gather_$1"
27+
if type "$func" >/dev/null; then
28+
echo "Gathering meta-data..."
29+
"$func" | tee "$GWM_META"
30+
fi
31+
}
32+
33+
gwm_hook() {
34+
local GWM_IN_HOOK=1
35+
if [ "$1 $2" = "git checkout" ]; then
36+
gwm_gather checkout
37+
elif [ "$1 $2 $3" = "git submodule update" ]; then
38+
gwm_gather submodules
39+
elif [ "$1 $2" = "true dl_tar_pack" ]; then
40+
[ -s "$GWM_META" ] && mv "$GWM_META" "$SUBDIR/.git-metadata"
41+
fi
42+
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
OVERLAY_MK:=$(abspath $(lastword $(MAKEFILE_LIST)))
16-
OVERLAY_SH:=$(dir $(OVERLAY_MK))overlay.sh
15+
OVERLAY_SH:=$(patsubst %.mk,%.sh,$(abspath $(lastword $(MAKEFILE_LIST))))
1716

1817
define BuildPackageOverlay
1918
$(call BuildPackageOverlay/$(if $(DUMP),Dump,Build),$(notdir $(1)),$(call overlay_base,$(1)))
File renamed without changes.

overlay/hostapd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include ../overlay.mk
15+
include ../../include/overlay.mk
1616
$(eval $(call BuildPackageOverlay,network/services/hostapd))

service/matter-netman/Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ PKG_SOURCE_SUBMODULES:=\
2626
third_party/nlio/repo
2727

2828
# Hash can be regenerated with make package/matter-netman/check FIXUP=1
29-
PKG_SOURCE_DATE:=2025-07-08
30-
PKG_SOURCE_VERSION:=dda2252eb28440305c883d0204737dce5b3abe62
31-
PKG_MIRROR_HASH:=ad81137221dafc0302c70cb90a03ab2472a02ee3c03e8cef8edcba26fd34201d
29+
PKG_SOURCE_DATE:=2025-10-29
30+
PKG_SOURCE_VERSION:=8f221d80d3f78d63ff4ad3d2d363e702430b5df7
31+
PKG_MIRROR_HASH:=eb565be9381ce88369b063d5ba25855218b657e366b3258c74e4cc41956c08b2
3232

3333
# Use local source dir for development
3434
# USE_SOURCE_DIR:=$(HOME)/workspace/connectedhomeip
@@ -50,7 +50,7 @@ define Package/matter-netman/default
5050
CATEGORY:=Network
5151
TITLE:=Matter Network Infrastructure Manager Daemon
5252
URL:=https://github.com/project-chip/connectedhomeip
53-
DEPENDS:=+libstdcpp +libatomic
53+
DEPENDS:=+libstdcpp +libatomic +libubus +libubox
5454
USERID:=matter:matter
5555
endef
5656

@@ -90,10 +90,10 @@ endef
9090

9191
# General options
9292
CONFIGURE_OPTIONS:=\
93+
--enable-ubus \
94+
--enable-detail-logging \
9395
--enable-recommended=no \
9496
--enable-access-restrictions=no \
95-
--enable-wifi=no \
96-
--enable-openthread=no \
9797
--enable-network-layer-ble=no \
9898
--enable-tracing-support=no
9999

@@ -124,9 +124,10 @@ OS_VERSION:=$(if $(filter-out SNAPSHOT,$(VERSION_NUMBER)),$(VERSION_NUMBER)-)$(V
124124
TARGET_CFLAGS+=\
125125
-DCHIP_DEVICE_CONFIG_ENABLE_TEST_SETUP_PARAMS=0 \
126126
-DCHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"$(PKG_VERSION)@$(OS_VERSION)\" \
127-
-DCHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING=\"\" \
127+
-DCHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING=\"-\" \
128128
-DCHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME=\"$(VERSION_DIST)\" \
129-
-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"\"
129+
-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"\" \
130+
-DCHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER=\"\"
130131

131132
# https://github.com/openwrt/openwrt/issues/13016
132133
TARGET_CFLAGS+= -Wno-format-nonliteral
@@ -149,9 +150,10 @@ define Build/Compile
149150
endef
150151

151152
define Package/matter-netman/default/install
152-
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/matter $(1)/etc/init.d
153+
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/matter $(1)/etc/init.d $(1)/usr/share/acl.d
153154
$(INSTALL_BIN) $(OUT_DIR)/matter-network-manager-app $(1)/usr/sbin
154155
$(INSTALL_DATA) ./files/bootstrap.sh $(1)/usr/share/matter/
156+
$(INSTALL_DATA) ./files/matter_acl.json $(1)/usr/share/acl.d
155157
$(INSTALL_BIN) ./files/matter.init $(1)/etc/init.d/matter
156158
endef
157159

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"user": "matter",
3+
"access": {
4+
"otbr": {
5+
"methods": ["*"]
6+
}
7+
},
8+
"subscribe": [ "otbr" ],
9+
"listen": [ "ubus.object.*" ]
10+
}

0 commit comments

Comments
 (0)