From 7a10b2ad612efb093221b41e713fe9df69c5ffc2 Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Tue, 26 Sep 2023 19:50:44 +0530 Subject: [PATCH] [Silabs] Adds support for WiseConnect SDK 3.0 in docker image and image optimization (#29304) * Adding wiseconnect in efr32 docker image * Optimize Dockerfile build * Adds SDK support to VScode docker image * Adds changes as per comments * Adds fix for extracting to /tmp (RAM) * Adds the changes in filepath --------- Co-authored-by: Rohan Sahay --- .../docker/images/base/chip-build/version | 2 +- .../stage-2/chip-build-efr32/Dockerfile | 66 +++++++++++++------ .../vscode/chip-build-vscode/Dockerfile | 5 ++ 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index e7fa94ed060f35..6b3a2854281cac 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -13 : [Bouffalolab] Update bflb-iot-tool to 1.8.6 +14 : [Silabs] Adding Wiseconnect sdk and and image optimization diff --git a/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile b/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile index 619dcb870ba2b2..fbbe8500382be9 100644 --- a/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile @@ -1,43 +1,69 @@ ARG VERSION=1 -FROM ghcr.io/project-chip/chip-build:${VERSION} +FROM ghcr.io/project-chip/chip-build:${VERSION} as build LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip -# GNU ARM Embedded toolchain, cross compiler for various platform builds +# Requirements to clone SDKs in temporary container RUN set -x \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ - gcc-arm-none-eabi \ - binutils-arm-none-eabi \ + git \ git-lfs \ - openjdk-17-jdk \ - python3-sphinx \ - ccache \ && apt-get clean \ && rm -rf /var/lib/apt/lists/ \ && : # last line -#Clone Gecko SDK 4.3.1 (2ba59bf) -RUN git clone --depth=1 --branch=v4.3.1 https://github.com/SiliconLabs/gecko_sdk.git && \ - cd gecko_sdk && \ +# Clone Gecko SDK 4.3.1 (2ba59bf) +RUN git clone --depth=1 --branch=v4.3.1 https://github.com/SiliconLabs/gecko_sdk.git /tmp/gecko_sdk && \ + cd /tmp/gecko_sdk && \ rm -rf .git \ && : # last line -ENV GSDK_ROOT=/gecko_sdk/ +# Clone Wiseconnect SDK 3.1.0-MatterCert (f84bf66) +RUN git clone --depth=1 --branch=MatterCert https://github.com/SiliconLabs/wiseconnect.git /tmp/wifi_sdk && \ + cd /tmp/wifi_sdk && \ + rm -rf .git \ + && : # last line # SLC-cli install # TODO: figure out a way to make this a fixed version. Currently a moving target. RUN wget https://www.silabs.com/documents/login/software/slc_cli_linux.zip && \ - unzip ./slc_cli_linux.zip -d ./ && \ - rm ./slc_cli_linux.zip + unzip ./slc_cli_linux.zip -d /tmp/slc_cli && \ + rm ./slc_cli_linux.zip \ + && : # last line -ENV PATH="${PATH}:/slc_cli/" +# Final SDK container for compiling using Silabs SDK +FROM ghcr.io/project-chip/chip-build:${VERSION} -# Install Python Packages +# GNU ARM Embedded toolchain, cross compiler for various platform builds +RUN set -x \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ + gcc-arm-none-eabi \ + binutils-arm-none-eabi \ + openjdk-17-jdk-headless \ + python3-sphinx \ + ccache \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/ \ + # Install Python Packages + && pip3 install \ + # codegen.py build requirements + # TODO: why are these added here instead of build-env? + lark \ + jinja2 \ + stringcase \ + # Sphinx dependencies (for slc-cli) + myst_parser \ + sphinx_rtd_theme \ + sphinx_tabs \ + linkify-it-py \ + && : # last line -# codegen.py build requirements -# TODO: why are these added here instead of build-env? -RUN pip3 install lark jinja2 stringcase +ENV GSDK_ROOT=/opt/silabs/gecko_sdk/ +ENV WISECONNECT_PATH=/opt/silabs/wifi_sdk/ +ENV PATH="${PATH}:/opt/silabs/slc_cli/" -# Sphinx dependencies (for slc-cli) -RUN pip3 install myst_parser sphinx_rtd_theme sphinx_tabs linkify-it-py +COPY --from=build /tmp/gecko_sdk /opt/silabs/gecko_sdk +COPY --from=build /tmp/wifi_sdk /opt/silabs/wifi_sdk +COPY --from=build /tmp/slc_cli /opt/silabs/slc_cli diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile index 087398852c5d36..024936a18f2855 100644 --- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile @@ -60,6 +60,9 @@ COPY --from=bouffalolab /opt/bouffalolab_sdk /opt/bouffalolab_sdk COPY --from=asr /opt/asr /opt/asr +COPY --from=efr32 /opt/silabs/gecko_sdk /opt/silabs/gecko_sdk +COPY --from=efr32 /opt/silabs/wifi_sdk /opt/silabs/wifi_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) @@ -99,6 +102,8 @@ ENV ANDROID_HOME=/opt/android/sdk ENV ANDROID_NDK_HOME=/opt/android/android-ndk-r23c ENV CY_TOOLS_PATHS="/opt/ModusToolbox/tools_2.4" ENV SILABS_BOARD=BRD4161A +ENV GSDK_ROOT=/opt/silabs/gecko_sdk/ +ENV WISECONNECT_PATH=/opt/silabs/wifi_sdk ENV IDF_PATH=/opt/espressif/esp-idf/ ENV IDF_TOOLS_PATH=/opt/espressif/tools ENV IMX_SDK_ROOT=/opt/fsl-imx-xwayland/6.1-langdale