Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Telink] Cleanup Docker image #29886

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21 : [chip-build-java] Ensure java is actually available in the docker image
22 : [Telink] Cleanup Docker image
55 changes: 6 additions & 49 deletions integrations/docker/images/stage-2/chip-build-telink/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,20 @@ ARG VERSION=1
FROM ghcr.io/project-chip/chip-build:${VERSION} as build
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip

RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# Setup toolchain
WORKDIR /opt/telink
RUN set -x \
&& mkdir /opt/telink \
&& cd /opt/telink \
&& wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/sha256.sum | shasum --check --ignore-missing \
&& curl --location https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz --output zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& tar xvf zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& rm -rf zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& cd zephyr-sdk-0.16.1 \
&& ./setup.sh -t riscv64-zephyr-elf -h -c \
&& cd / \
&& zephyr-sdk-0.16.1/setup.sh -t riscv64-zephyr-elf \
&& : # last line

# Setup Zephyr
ARG ZEPHYR_REVISION=5e5f3cfde3fb5070b2e6cfb8ab08bc688b5aa3d4
WORKDIR /opt/telink/zephyrproject
RUN set -x \
&& python3 -m pip install -U --no-cache-dir \
west==1.0.0 \
imgtool==1.7.0 \
&& python3 -m pip install -U --no-cache-dir west \
&& git clone https://github.com/telink-semi/zephyr \
&& cd zephyr \
&& git reset ${ZEPHYR_REVISION} --hard \
Expand All @@ -41,45 +27,16 @@ RUN set -x \
&& : # last line

FROM ghcr.io/project-chip/chip-build:${VERSION}
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip

COPY --from=build /opt/telink/zephyr-sdk-0.16.1/ /opt/telink/zephyr-sdk-0.16.1/
COPY --from=build /opt/telink/zephyrproject/ /opt/telink/zephyrproject/

ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/telink/zephyr-sdk-0.16.1

RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
ccache \
dfu-util=0.9-1 \
device-tree-compiler \
gcc-multilib \
g++-multilib \
libsdl2-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& python3 -m pip install -U --no-cache-dir \
pyelftools==0.27 \
&& pip3 install --no-cache-dir --user -r /opt/telink/zephyrproject/zephyr/scripts/requirements.txt \
&& : # last line

# Setup Telink tools required for "west flash"
ARG TELINK_TOOLS_BASE=/opt/telink/tools
RUN wget http://wiki.telink-semi.cn/tools_and_sdk/Tools/IDE/telink_riscv_ice_flash_tool.zip -O /opt/telink/tools.zip \
&& unzip /opt/telink/tools.zip -d ${TELINK_TOOLS_BASE} \
&& rm /opt/telink/tools.zip \
&& mv ${TELINK_TOOLS_BASE}/telink_riscv_linux_toolchain/* ${TELINK_TOOLS_BASE} \
&& rm -rf ${TELINK_TOOLS_BASE}/telink_riscv_linux_toolchain \
&& chmod +x ${TELINK_TOOLS_BASE}/flash/bin/SPI_burn \
&& chmod +x ${TELINK_TOOLS_BASE}/ice/ICEman \
&& : # last line

# Add path to Telink tools
ENV PATH="${TELINK_TOOLS_BASE}/flash/bin:${PATH}"
ENV PATH="${TELINK_TOOLS_BASE}/ice:${PATH}"

ARG ZEPHYR_PROJECT_DIR=/opt/telink/zephyrproject
ENV TELINK_ZEPHYR_BASE=${ZEPHYR_PROJECT_DIR}/zephyr
ENV ZEPHYR_BASE=${ZEPHYR_PROJECT_DIR}/zephyr
ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.16.1
Loading