-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bouffalolab] Update Dockerfile to setup compile environment for Bouf…
…falo Lab SoC build (#23700) * Update Dockerfile to setup toolchain for Bouffalo Lab SoC build * Fix restyle * Update docker image version * setup toolchain under /opt/bouffalolab_sdk * fix Restyle
- Loading branch information
Showing
4 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
20 changes: 14 additions & 6 deletions
20
integrations/docker/images/chip-build-bouffalolab/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ | ||
&& 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
66
integrations/docker/images/chip-build-bouffalolab/setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |