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

[Bouffalolab] Update Dockerfile to setup compile environment for Bouffalo Lab SoC build #23700

Merged
merged 5 commits into from
Nov 23, 2022
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
20 changes: 14 additions & 6 deletions integrations/docker/images/chip-build-bouffalolab/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
wy-hh marked this conversation as resolved.
Show resolved Hide resolved
&& 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
66 changes: 66 additions & 0 deletions integrations/docker/images/chip-build-bouffalolab/setup.sh
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions integrations/docker/images/chip-build-vscode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-build/version
Original file line number Diff line number Diff line change
@@ -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.