Skip to content

Commit

Permalink
Adapt the script to build OTBR and CLI references separately;
Browse files Browse the repository at this point in the history
Add support for nrf52840 1.3.1 build
  • Loading branch information
sunytt committed Jun 21, 2023
1 parent f258462 commit 80346af
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 53 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Bootstrap
run: |
cd /tmp
Expand All @@ -48,14 +52,20 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
- name: Build reference release for 1.3
- name: Build full ncs reference release for 1.3
run: |
export PATH=/tmp/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH=/tmp/gcc-arm-none-eabi-9-2019-q4-major/
REFERENCE_PLATFORM=ncs REFERENCE_RELEASE_TYPE=1.3 ./script/make-reference-release.bash
- name: Build nrf52840 CLI reference release for 1.3.1
run: |
export PATH=/tmp/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH
REFERENCE_PLATFORM=nrf52840 REFERENCE_RELEASE_TYPE=1.3 ./script/make-reference-release.bash
REFERENCE_TYPE=CLI REFERENCE_PLATFORM=nrf52840 REFERENCE_RELEASE_TYPE=1.3.1 ./script/make-reference-release.bash
- uses: actions/upload-artifact@v3
with:
name: reference-releases
path: |
build/ot-1.3*
build/*
retention-days: 1
if-no-files-found: error
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ $ git submodule update --init --recursive
At the root of the repository:

```
$ REFERENCE_PLATFORM=(nrf52840|efr32mg12|ncs|none) REFERENCE_RELEASE_TYPE=(1.2|1.3|1.3.1) [SD_CARD=/dev/...] [OTBR_RCP_BUS=(UART|SPI)] [IN_CHINA=(0|1)] [OTBR_RADIO_URL='spinel+hdlc+uart:///dev/ttyUSB0'] ./script/make-reference-release.bash
$ REFERENCE_PLATFORM=(nrf52840|efr32mg12|ncs|none) REFERENCE_RELEASE_TYPE=(1.2|1.3|1.3.1) [REFERENCE_TYPE=(OTBR|CLI)] [SD_CARD=/dev/...] [OTBR_RCP_BUS=(UART|SPI)] [IN_CHINA=(0|1)] [OTBR_RADIO_URL='spinel+hdlc+uart:///dev/ttyUSB0'] ./script/make-reference-release.bash
```

This will produce a reference release folder in `./build/`. The folder will be
named after the release type, date and the OpenThread commit id.
named after the release type, date and the OpenThread/ot-br-posix commit id.

`SD_CARD` is expected to be the device file path of an SD card inserted to
the host. If this variable is specified, the script will flash the Raspberry Pi
Expand Down Expand Up @@ -55,6 +55,8 @@ When `REFERENCE_RELEASE_TYPE` is `1.3` or `1.3.1`, reference release contains fo
- Change log
- Quick start guide

With `REFERENCE_TYPE` it's possible to only generate the specified type of reference release. If set to `CLI`, only CLI firmware for hardware type specified by `REFERENCE_PLATFORM` is generated. If set to `OTBR`, only OTBR reference release which contains Raspberry Pi image and a RCP firmware will be generated. If this variable is not specified, all types of reference releases are generated.

**Note**: Currently, only the following boards are supported for CLI/RCP firmwares:

- nRF52840 dongles
Expand Down
83 changes: 53 additions & 30 deletions script/make-firmware.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ build_dir=""
build_script_flags=()
NRFUTIL=""

readonly build_1_3_options_common=(
"-DOT_SRP_SERVER=ON"
"-DOT_ECDSA=ON"
"-DOT_SERVICE=ON"
"-DOT_DNSSD_SERVER=ON"
"-DOT_SRP_CLIENT=ON"
)

readonly build_1_3_options_efr32=(
""
)

readonly build_1_3_options_nrf=(
""
)

readonly build_1_2_options_common=(
'-DOT_THREAD_VERSION=1.2'
'-DOT_REFERENCE_DEVICE=ON'
Expand All @@ -79,6 +63,8 @@ readonly build_1_2_options_common=(
'-DOT_COAP=OFF'
'-DOT_COAPS=OFF'
'-DOT_ECDSA=OFF'
"-DOT_SRP_SERVER=OFF"
"-DOT_SRP_CLIENT=OFF"
'-DOT_FULL_LOGS=OFF'
'-DOT_IP6_FRAGM=OFF'
'-DOT_LINK_RAW=OFF'
Expand Down Expand Up @@ -107,6 +93,35 @@ readonly build_1_1_env_nrf=(
'USB=1'
)

readonly build_1_3_options_common=(
"-DOT_SRP_SERVER=ON"
"-DOT_ECDSA=ON"
"-DOT_SERVICE=ON"
"-DOT_DNSSD_SERVER=ON"
"-DOT_SRP_CLIENT=ON"
)

readonly build_1_3_options_efr32=(
""
)

readonly build_1_3_options_nrf=(
${build_1_2_options_nrf[@]}
)

readonly build_1_3_1_options_common=(
"-DOT_THREAD_VERSION=1.3.1"
${build_1_3_options_common[@]}
)

readonly build_1_3_1_options_efr32=(
""
)

readonly build_1_3_1_options_nrf=(
${build_1_3_options_nrf[@]}
)

# Args
# - $1: The name of the hex file to zip
# - $2: The basename of the file
Expand Down Expand Up @@ -173,8 +188,18 @@ build_ot()

mkdir -p "$OUTPUT_ROOT"

local dist_apps=(
ot-cli-ftd
ot-rcp
)
if [ "${FW_TYPE}" = "CLI" ]; then
dist_apps=(ot-cli-ftd)
elif [ "${FW_TYPE}" = "RCP" ]; then
dist_apps=(ot-rcp)
fi

case "${thread_version}" in
"1.2")
"1.2" | "1.3" | "1.3.1")
# Build OpenThread 1.2
cd "${platform_repo}"
git clean -xfd
Expand All @@ -193,10 +218,6 @@ build_ot()
fi

# Package and distribute
local dist_apps=(
ot-cli-ftd
ot-rcp
)
for app in "${dist_apps[@]}"; do
package_ot "${app}"
done
Expand All @@ -216,10 +237,6 @@ build_ot()
make -f examples/Makefile-"${platform}" "${options[@]}"

# Package and distribute
local dist_apps=(
ot-cli-ftd
ot-rcp
)
for app in "${dist_apps[@]}"; do
package_ot "${app}" "${thread_version}" output/"${platform}"/bin/"${app}"
done
Expand Down Expand Up @@ -276,20 +293,26 @@ build()
;;
esac
elif [ "${REFERENCE_RELEASE_TYPE}" = "1.3" ] || [ "${REFERENCE_RELEASE_TYPE}" = "1.3.1" ]; then
options=("${build_1_3_options_common[@]}")
option_version=${REFERENCE_RELEASE_TYPE//./_}
option_name_common="build_${option_version}_options_common[@]"
options=${!option_name_common}

case "${platform}" in
nrf*)
options+=("${build_1_3_options_nrf[@]}")
option_name_nrf="build_${option_version}_options_nrf[@]"
options_nrf=${!option_name_nrf}
options+="${options_nrf[@]}"
platform_repo=ot-nrf528xx

thread_version=1.2 build_type="USB_trans" build_ot "${options[@]}" "$@"
thread_version="${REFERENCE_RELEASE_TYPE}" build_type="USB_trans" build_ot ${options[@]} "$@"
;;
efr32mg12)
options+=("${build_1_3_options_efr32[@]}")
option_name_efr32="build_${option_version}_options_efr32[@]"
options_efr32=${!option_name_efr32}
options+="${options_efr32[@]}"
platform_repo=ot-efr32
build_script_flags=("--skip-silabs-apps")
thread_version=1.2 build_ot "-DBOARD=brd4166a" "${options[@]}" "$@"
thread_version=1.2 build_ot "-DBOARD=brd4166a" ${options[@]} "$@"
;;
esac
else
Expand Down
46 changes: 28 additions & 18 deletions script/make-reference-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,39 @@ main()
# ==========================================================================
echo "REFERENCE_RELEASE_TYPE=${REFERENCE_RELEASE_TYPE?}"
mkdir -p build
OUTPUT_ROOT=$(realpath build/ot-"${REFERENCE_RELEASE_TYPE?}-$(date +%Y%m%d)-$(cd openthread && git rev-parse --short HEAD)")
OUTPUT_ROOT=$(realpath build/ot-"${REFERENCE_RELEASE_TYPE?}-$(date +%Y%m%d)-$(cd openthread && git rev-parse --short HEAD)-$(cd ot-br-posix && git rev-parse --short HEAD)")
mkdir -p "$OUTPUT_ROOT"
echo "REFERENCE_TYPE=${REFERENCE_TYPE:=ALL}"

# ==========================================================================
# Build firmware
# ==========================================================================
if [ "${REFERENCE_PLATFORM}" != "none" ]; then
OUTPUT_ROOT="$OUTPUT_ROOT"/fw_dongle_${REFERENCE_PLATFORM}/ ./script/make-firmware.bash "${REFERENCE_PLATFORM}"
if [ "${REFERENCE_TYPE}" = "ALL" ] || [ "${REFERENCE_TYPE}" = "CLI" ]; then
# ==========================================================================
# Build CLI firmware
# ==========================================================================
OUTPUT_ROOT="$OUTPUT_ROOT"/fw_dongle_${REFERENCE_PLATFORM}/ FW_TYPE="CLI" ./script/make-firmware.bash "${REFERENCE_PLATFORM}"
fi

# ==========================================================================
# Build THCI
# ==========================================================================
if [ "${REFERENCE_RELEASE_TYPE?}" = "1.2" ]; then
mkdir -p "$OUTPUT_ROOT"/thci
OUTPUT_ROOT="$OUTPUT_ROOT"/thci/ ./script/make-thci.bash
fi
if [ "${REFERENCE_TYPE}" = "ALL" ] || [ "${REFERENCE_TYPE}" = "OTBR" ]; then
# ==========================================================================
# Build RCP firmware
# ==========================================================================
if [ "${REFERENCE_PLATFORM}" != "none" ]; then
OUTPUT_ROOT="$OUTPUT_ROOT"/fw_dongle_${REFERENCE_PLATFORM}/ FW_TYPE="RCP" ./script/make-firmware.bash "${REFERENCE_PLATFORM}"
fi

# ==========================================================================
# Build raspbian
# ==========================================================================
mkdir -p "$OUTPUT_ROOT"
OUTPUT_ROOT="$OUTPUT_ROOT" ./script/make-raspbian.bash
# ==========================================================================
# Build THCI
# ==========================================================================
if [ "${REFERENCE_RELEASE_TYPE?}" = "1.2" ]; then
mkdir -p "$OUTPUT_ROOT"/thci
OUTPUT_ROOT="$OUTPUT_ROOT"/thci/ ./script/make-thci.bash
fi

# ==========================================================================
# Build raspbian
# ==========================================================================
mkdir -p "$OUTPUT_ROOT"
OUTPUT_ROOT="$OUTPUT_ROOT" ./script/make-raspbian.bash
fi

# ==========================================================================
# Package docs
Expand Down

0 comments on commit 80346af

Please sign in to comment.