-
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.
- Loading branch information
Showing
2 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ RUN apt update -y \ | |
COPY setup.sh /tmp | ||
|
||
RUN cd /tmp \ | ||
&& bash setup.sh | ||
&& bash setup.sh |
57 changes: 30 additions & 27 deletions
57
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 |
---|---|---|
@@ -1,53 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
CURRENT_DIR=$(cd "$(dirname "$0")";pwd) | ||
CURRENT_DIR=$( | ||
cd "$(dirname "$0")" | ||
pwd | ||
) | ||
SDK_ROOT_DIR=$CURRENT_DIR/../ | ||
|
||
TOOLCHAIN_SETUP_ROOT=~/.bouffalolab/toolchain | ||
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" \ | ||
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"\ | ||
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 | ||
echo "Not support for ""$OSTYPE" | ||
fi | ||
|
||
if [ ! -d $TOOLCHAIN_SETUP_ROOT ]; then | ||
mkdir -p $TOOLCHAIN_SETUP_ROOT | ||
if [ ! -d "$TOOLCHAIN_SETUP_ROOT" ]; then | ||
mkdir -p "$TOOLCHAIN_SETUP_ROOT" | ||
fi | ||
rm -rf $TOOLCHAIN_SETUP_ROOT/*.zip | ||
rm -rf "$TOOLCHAIN_SETUP_ROOT"/*.zip | ||
|
||
for(( i=0; i<${#toolchains_url[@]}; i+=3)) do | ||
for ((i = 0; i < ${#toolchains_url[@]}; i += 3)); do | ||
path=${toolchains_url[i]} | ||
url=${toolchains_url[i+1]} | ||
output=${toolchains_url[i+2]} | ||
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 | ||
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 2>&1 > /dev/null | ||
mkdir -p $TOOLCHAIN_SETUP_ROOT/$path | ||
unzip $TOOLCHAIN_SETUP_ROOT/$toolchain_zip -d $TOOLCHAIN_SETUP_ROOT/$path 2>&1 > /dev/null | ||
mv $TOOLCHAIN_SETUP_ROOT/$path/$output/* $TOOLCHAIN_SETUP_ROOT/$path | ||
rm -rf $TOOLCHAIN_SETUP_ROOT/$toolchain_zip 2>&1 > /dev/null | ||
|
||
if [ -f $TOOLCHAIN_SETUP_ROOT/$path/chmod755.sh ]; then | ||
cd $TOOLCHAIN_SETUP_ROOT/$path/ | ||
rm -rf "$TOOLCHAIN_SETUP_ROOT/$path" 2>&1 >/dev/null | ||
mkdir -p "$TOOLCHAIN_SETUP_ROOT/$path" | ||
unzip "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" -d "$TOOLCHAIN_SETUP_ROOT/$path" 2>&1 >/dev/null | ||
mv "$TOOLCHAIN_SETUP_ROOT/$path/$output"/* "$TOOLCHAIN_SETUP_ROOT/$path" | ||
rm -rf "$TOOLCHAIN_SETUP_ROOT/$toolchain_zip" 2>&1 >/dev/null | ||
|
||
if [ -f "$TOOLCHAIN_SETUP_ROOT/$path"/chmod755.sh ]; then | ||
cd "$TOOLCHAIN_SETUP_ROOT/$path"/ | ||
bash chmod755.sh | ||
fi | ||
done | ||
|
||
cd $SDK_ROOT_DIR | ||
cd "$SDK_ROOT_DIR" | ||
rm -rf toolchain | ||
ln -s $TOOLCHAIN_SETUP_ROOT toolchain | ||
ln -s "$TOOLCHAIN_SETUP_ROOT" toolchain | ||
|
||
cd $CURRENT_DIR | ||
cd "$CURRENT_DIR" |