diff --git a/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration new file mode 100755 index 0000000000000000000000000000000000000000..ecb1f189b473152d929836dc96f494030f68deb8 --- /dev/null +++ b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +# Bring up a OpenThread border router for the given configuration +ot-ctl thread stop +ot-ctl ifconfig down +ot-ctl dataset clear +ot-ctl dataset init new +ot-ctl dataset panid 0x1357 +ot-ctl dataset extpanid 11112222deadbeef +ot-ctl dataset networkname "ASOS\ Thread" +ot-ctl dataset channel 26 +ot-ctl dataset masterkey 00112233445566778899aabbccddeeff +ot-ctl dataset commit active +ot-ctl ifconfig up +ot-ctl thread start +#ot-ctl prefix add 2001::/64 paros +#ot-ctl prefix add fd11:22::/64 pasor +#ot-ctl dataset meshlocalprefix fdde:00be:ef00:aaaa:: diff --git a/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration.service b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration.service new file mode 100644 index 0000000000000000000000000000000000000000..453f03a7d480354a118962ffd31dfc3bde7472b8 --- /dev/null +++ b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix/otbr-configuration.service @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +[Unit] +Description=OpenThread Border Router Configuration +ConditionPathExists=/usr/sbin/otbr-configuration +After=sys-subsystem-net-devices-wpan0.device +BindsTo=sys-subsystem-net-devices-wpan0.device + +[Service] +Type=oneshot +ExecStart=/usr/sbin/otbr-configuration diff --git a/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix_%.bbappend b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix_%.bbappend index d8c49415c02788e35e272d4be6f53ee0ed03da81..edef76c75b06853b7554eca2a3ec9533cb8c6b65 100644 --- a/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix_%.bbappend +++ b/meta-ohos-blueprints/recipes-connectivity/openthread/ot-br-posix_%.bbappend @@ -1,8 +1,16 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/ot-br-posix:" -SRC_URI_append = "file://60-otbr-ip-forward.conf" +SRC_URI_append = " \ + file://60-otbr-ip-forward.conf \ + file://otbr-configuration \ + file://otbr-configuration.service \ + " do_install_append() { install -d ${D}${sysconfdir}/sysctl.d/ install -m 0644 ${WORKDIR}/60-otbr-ip-forward.conf ${D}${sysconfdir}/sysctl.d/ + install -D ${WORKDIR}/otbr-configuration ${D}${sbindir}/ + install -D -m 0644 ${WORKDIR}/otbr-configuration.service ${D}${systemd_unitdir}/system/ } + +SYSTEMD_SERVICE_${PN} += " otbr-configuration.service"