Skip to content

Commit

Permalink
Add IPv6-only variant for chip-tool compilation (#10446)
Browse files Browse the repository at this point in the history
* Add ipv6 only example target to build_examples.py

* Add CI compile step using build_examples.py which will include ipv6 only builds

* Restyle fixes
  • Loading branch information
andy31415 authored and pull[bot] committed Nov 6, 2021
1 parent 2f20a66 commit f666ea8
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ jobs:
scripts/build/gn_build.sh
scripts/tests/gn_tests.sh
done
- name: Build using build_examples.py
timeout-minutes: 30
# NOTE: only vscode image contains the cross compile arm64 sysroot
# so the build command below only compiles x64
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --no-log-timestamps --target-glob 'linux-x64-*' build"
# TODO Log Upload https://github.com/project-chip/connectedhomeip/issues/2227
# TODO https://github.com/project-chip/connectedhomeip/issues/1512
# - name: Run Code Coverage
Expand Down
9 changes: 8 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,12 @@
"description": "What target to build",
"options": [
"android-arm-chip-tool",
"android-arm64-chip-test",
"android-arm64-chip-tool",
"android-x64-chip-tool",
"android-x86-chip-tool",
"efr32-brd4161a-light-rpc",
"efr32-brd4161a-light",
"efr32-brd4161a-light-rpc",
"efr32-brd4161a-lock",
"efr32-brd4161a-window-covering",
"esp32-c3devkit-all-clusters",
Expand All @@ -228,11 +229,17 @@
"esp32-m5stack-all-clusters",
"infineon-p6-lock",
"linux-arm64-all-clusters",
"linux-arm64-all-clusters-ipv6only",
"linux-arm64-chip-tool",
"linux-arm64-chip-tool-ipv6only",
"linux-arm64-thermostat",
"linux-arm64-thermostat-ipv6only",
"linux-x64-all-clusters",
"linux-x64-all-clusters-ipv6only",
"linux-x64-chip-tool",
"linux-x64-chip-tool-ipv6only",
"linux-x64-thermostat",
"linux-x64-thermostat-ipv6only",
"nrf-nrf52840-light",
"nrf-nrf52840-lock",
"nrf-nrf52840-pump",
Expand Down
12 changes: 9 additions & 3 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ def HostTargets():
HostBoard.NATIVE.BoardName() != HostBoard.ARM64.BoardName()):
targets.append(target.Extend('arm64', board=HostBoard.ARM64))

app_targets = []
for target in targets:
yield target.Extend('all-clusters', app=HostApp.ALL_CLUSTERS)
yield target.Extend('chip-tool', app=HostApp.CHIP_TOOL)
yield target.Extend('thermostat', app=HostApp.THERMOSTAT)
app_targets.append(target.Extend(
'all-clusters', app=HostApp.ALL_CLUSTERS))
app_targets.append(target.Extend('chip-tool', app=HostApp.CHIP_TOOL))
app_targets.append(target.Extend('thermostat', app=HostApp.THERMOSTAT))

for target in app_targets:
yield target
yield target.Extend('ipv6only', enable_ipv4=False)


def Esp32Targets():
Expand Down
10 changes: 7 additions & 3 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,24 @@ def PlatformName(self):

class HostBuilder(GnBuilder):

def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE):
def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
runner=runner)

self.app_name = app.BinaryName()
self.map_name = self.app_name + '.map'
self.board = board
self.extra_gn_options = []

if not enable_ipv4:
self.extra_gn_options.append('chip_inet_config_enable_ipv4=false')

def GnBuildArgs(self):
if self.board == HostBoard.NATIVE:
return None
return self.extra_gn_options
elif self.board == HostBoard.ARM64:
return [
return self.extra_gn_options + [
'target_cpu="arm64"',
'is_clang=true',
'chip_crypto="mbedtls"',
Expand Down
42 changes: 42 additions & 0 deletions scripts/build/testdata/build_linux_on_x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,81 @@ bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/all-clusters-app/linux '"'"'--args=target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-all-clusters'

# Generating linux-arm64-all-clusters-ipv6only
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/all-clusters-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-all-clusters-ipv6only'

# Generating linux-arm64-chip-tool
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/chip-tool '"'"'--args=target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-chip-tool'

# Generating linux-arm64-chip-tool-ipv6only
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/chip-tool '"'"'--args=chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-chip-tool-ipv6only'

# Generating linux-arm64-thermostat
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/thermostat/linux '"'"'--args=target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-thermostat'

# Generating linux-arm64-thermostat-ipv6only
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --root={root}/examples/thermostat/linux '"'"'--args=chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-thermostat-ipv6only'

# Generating linux-x64-all-clusters
gn gen --check --fail-on-unused-args --root={root}/examples/all-clusters-app/linux {out}/linux-x64-all-clusters

# Generating linux-x64-all-clusters-ipv6only
gn gen --check --fail-on-unused-args --root={root}/examples/all-clusters-app/linux --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-all-clusters-ipv6only

# Generating linux-x64-chip-tool
gn gen --check --fail-on-unused-args --root={root}/examples/chip-tool {out}/linux-x64-chip-tool

# Generating linux-x64-chip-tool-ipv6only
gn gen --check --fail-on-unused-args --root={root}/examples/chip-tool --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-chip-tool-ipv6only

# Generating linux-x64-thermostat
gn gen --check --fail-on-unused-args --root={root}/examples/thermostat/linux {out}/linux-x64-thermostat

# Generating linux-x64-thermostat-ipv6only
gn gen --check --fail-on-unused-args --root={root}/examples/thermostat/linux --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-thermostat-ipv6only

# Building linux-arm64-all-clusters
ninja -C {out}/linux-arm64-all-clusters

# Building linux-arm64-all-clusters-ipv6only
ninja -C {out}/linux-arm64-all-clusters-ipv6only

# Building linux-arm64-chip-tool
ninja -C {out}/linux-arm64-chip-tool

# Building linux-arm64-chip-tool-ipv6only
ninja -C {out}/linux-arm64-chip-tool-ipv6only

# Building linux-arm64-thermostat
ninja -C {out}/linux-arm64-thermostat

# Building linux-arm64-thermostat-ipv6only
ninja -C {out}/linux-arm64-thermostat-ipv6only

# Building linux-x64-all-clusters
ninja -C {out}/linux-x64-all-clusters

# Building linux-x64-all-clusters-ipv6only
ninja -C {out}/linux-x64-all-clusters-ipv6only

# Building linux-x64-chip-tool
ninja -C {out}/linux-x64-chip-tool

# Building linux-x64-chip-tool-ipv6only
ninja -C {out}/linux-x64-chip-tool-ipv6only

# Building linux-x64-thermostat
ninja -C {out}/linux-x64-thermostat

# Building linux-x64-thermostat-ipv6only
ninja -C {out}/linux-x64-thermostat-ipv6only

0 comments on commit f666ea8

Please sign in to comment.