diff --git a/integrations/docker/images/chip-build-bouffalolab/Dockerfile b/integrations/docker/images/chip-build-bouffalolab/Dockerfile index e00fbcfb8c99ca..61695f50adbee2 100644 --- a/integrations/docker/images/chip-build-bouffalolab/Dockerfile +++ b/integrations/docker/images/chip-build-bouffalolab/Dockerfile @@ -1,9 +1,17 @@ ARG VERSION=latest FROM connectedhomeip/chip-build:${VERSION} -RUN set -x \ - && pip install bflb-iot-tool \ - && apt-get update \ - && apt-get install -fy \ - vim \ - && : # last line +RUN apt update -y \ + && apt install vim -fy \ + && apt clean \ + && pip3 install bflb-iot-tool \ + && : # last line + +COPY setup.sh /tmp + +RUN cd /tmp \ + && bash setup.sh \ + && rm setup.sh \ + && : # last line + +ENV BOUFFALOLAB_SDK_ROOT=/opt/bouffalolab_sdk diff --git a/integrations/docker/images/chip-build-bouffalolab/setup.sh b/integrations/docker/images/chip-build-bouffalolab/setup.sh new file mode 100644 index 00000000000000..44e353432ccab8 --- /dev/null +++ b/integrations/docker/images/chip-build-bouffalolab/setup.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +set -x +CURRENT_DIR=$( + cd "$(dirname "$0")" + pwd +) + +SDK_ROOT=/opt/bouffalolab_sdk +# Currently, only setup toolchain under $SDK_ROOT +TOOLCHAIN_SETUP_ROOT=$SDK_ROOT/toolchain + +TOOLCHAIN_SYMBOLIC_LINK_PATH="" +git -C . rev-parse 2>/dev/null +if [[ "$?" == "0" ]]; then + # Examples in Bouffalo Lab IOT SDK repo expect toolchain under repo, + # let's create a symbolic link to Bouffalo Lab toolchain, + # if this script runs under repo + TOOLCHAIN_SYMBOLIC_LINK_PATH=$CURRENT_DIR/../toolchain +fi + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + toolchains_url=( + "riscv/Thead_riscv/Linux_x86_64" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_thead_linux64.zip" "toolchain_riscv_thead_linux_x86_64" + "riscv/Linux" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_linux64.zip" "toolchain_riscv_sifive_linux" + ) +elif [[ "$OSTYPE" == "darwin"* ]]; then + toolchains_url=( + "riscv/Darwin" "https://dev.bouffalolab.com/media/upload/download/toolchain_riscv_sifive_macos.zip" "toolchain_riscv_sifive_macos" + ) +else + echo "Not support for ""$OSTYPE" +fi + +if [ ! -d "$TOOLCHAIN_SETUP_ROOT" ]; then + mkdir -p "$TOOLCHAIN_SETUP_ROOT" +fi +rm -rf "$TOOLCHAIN_SETUP_ROOT"/*.zip + +for ((i = 0; i < ${#toolchains_url[@]}; i += 3)); do + path=${toolchains_url[i]} + url=${toolchains_url[i + 1]} + output=${toolchains_url[i + 2]} + + wget -P "$TOOLCHAIN_SETUP_ROOT"/ "$url" + toolchain_zip=$(basename "$url") + if [ ! -f "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" ]; then + exit 1 + fi + rm -rf "$TOOLCHAIN_SETUP_ROOT/$path" + mkdir -p "$TOOLCHAIN_SETUP_ROOT/$path" + unzip "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" -d "$TOOLCHAIN_SETUP_ROOT/$path" + mv "$TOOLCHAIN_SETUP_ROOT/$path/$output"/* "$TOOLCHAIN_SETUP_ROOT/$path" + rm -rf "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" + + if [ -f "$TOOLCHAIN_SETUP_ROOT/$path"/chmod755.sh ]; then + cd "$TOOLCHAIN_SETUP_ROOT/$path"/ + bash chmod755.sh + cd "$CURRENT_DIR" + fi +done + +if [[ "$TOOLCHAIN_SYMBOLIC_LINK_PATH" != "" ]]; then + rm -rf "$TOOLCHAIN_SYMBOLIC_LINK_PATH" + ln -s "$TOOLCHAIN_SETUP_ROOT" "$TOOLCHAIN_SYMBOLIC_LINK_PATH" +fi diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index ded2dcab943228..eb49bab5f87f7c 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -13,6 +13,7 @@ FROM connectedhomeip/chip-build-k32w:${VERSION} AS k32w FROM connectedhomeip/chip-build-imx:${VERSION} AS imx FROM connectedhomeip/chip-build-ti:${VERSION} AS ti FROM connectedhomeip/chip-build-openiotsdk:${VERSION} AS openiotsdk +FROM connectedhomeip/chip-build-bouffalolab:${VERSION} AS bouffalolab FROM connectedhomeip/chip-build:${VERSION} # qemu-src copied over because qemu directory contains symlinks to the src @@ -50,6 +51,8 @@ COPY --from=ti /opt/ti/sysconfig_1.13.0 /opt/ti/sysconfig_1.13.0 COPY --from=openiotsdk /opt/gcc-arm-none-eabi-10.3-2021.10/ /opt/gcc-arm-none-eabi-10.3-2021.10/ COPY --from=openiotsdk /opt/FVP_Corstone_SSE-300/ /opt/FVP_Corstone_SSE-300/ +COPY --from=bouffalolab /opt/bouffalolab_sdk /opt/bouffalolab_sdk + # Android license file "acceping" is done by writing license hashes # into the 'licenses' subfolder. This allows any user (in particular # 'vscode' to accept licenses) @@ -110,3 +113,4 @@ ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/root ENV FVP_CORSTONE_300_PATH=/opt/FVP_Corstone_SSE-300 ENV ARM_GCC_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10 +ENV BOUFFALOLAB_SDK_ROOT=/opt/bouffalolab_sdk diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 9c82e92de70a7c..9d2a1e88240ae6 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.6.11 Version bump reason: install nodejs into chip-build image, since github js actions seem to need it. +0.6.12 Version bump reason: Update Bouffalo Lab build environment.