Skip to content

Commit fd3f803

Browse files
authored
[docker][microTVM]Fix Zephyr 0.15.2 SDK installation and separate Zephyr python environment (#13829)
This PR fixes the SDK installation and separates SDK installation from ZephyrProject installation. Also it separates the Zephyr python environment to 3.8 which is the required version and it is different than tvm virtual env.
1 parent 6fdb1b7 commit fd3f803

File tree

4 files changed

+42
-16
lines changed

4 files changed

+42
-16
lines changed

docker/Dockerfile.ci_cortexm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,15 @@ COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh
7676
RUN bash /install/ubuntu_install_sccache.sh
7777
ENV PATH /opt/sccache:$PATH
7878

79-
# Zephyr SDK deps
79+
# Zephyr Project
8080
COPY install/ubuntu_install_zephyr.sh /install/ubuntu_install_zephyr.sh
8181
COPY install/ubuntu_init_zephyr_project.sh /install/ubuntu_init_zephyr_project.sh
82-
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
8382
RUN bash /install/ubuntu_install_zephyr.sh
8483
ENV ZEPHYR_BASE=/opt/zephyrproject/zephyr
84+
85+
#Zephyr SDK
86+
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
87+
RUN bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
8588
ENV PATH /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
8689

8790
# NRF

docker/Dockerfile.ci_riscv

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh
8080
RUN bash /install/ubuntu_install_sccache.sh
8181
ENV PATH /opt/sccache:$PATH
8282

83-
# Zephyr SDK deps
83+
# Zephyr Project
8484
COPY install/ubuntu_install_zephyr.sh /install/ubuntu_install_zephyr.sh
8585
COPY install/ubuntu_init_zephyr_project.sh /install/ubuntu_init_zephyr_project.sh
86-
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
8786
RUN bash /install/ubuntu_install_zephyr.sh
8887
ENV ZEPHYR_BASE=/opt/zephyrproject/zephyr
8988

89+
#Zephyr SDK
90+
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
91+
RUN bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
92+
ENV PATH /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
93+
9094
# Download RISC-V gcc toolchain (linux)
9195
COPY install/ubuntu_download_xuantie_gcc_linux.sh /install/ubuntu_download_xuantie_gcc_linux.sh
9296
RUN bash /install/ubuntu_download_xuantie_gcc_linux.sh /opt/riscv/riscv64-unknown-linux-gnu

docker/install/ubuntu_install_zephyr.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,27 @@ sudo apt-get update
3838

3939
sudo apt-install-and-clear -y cmake
4040

41-
pip3 install west
41+
# Find release version
42+
apt-get update
43+
apt-install-and-clear -y \
44+
lsb-core
45+
46+
release=$(lsb_release -sc)
47+
if [ "${release}" == "bionic" ]; then
48+
python_cmd="python3"
49+
elif [ "${release}" == "focal" ]; then
50+
python_cmd="python3.8"
51+
else
52+
echo "Don't know which version of python to use for Zephyr."
53+
exit 2
54+
fi
55+
56+
# Current Zephyr version is compatible with python3.8.
57+
# We use a different python env for Zephyr to test the
58+
# real world scenario where TVM and Zephyr could be in different
59+
# python environments.
60+
# TODO: use virtual env for Zephyr.
61+
$python_cmd -m pip install west
4262

4363
# Init ZephyrProject
4464
ZEPHYR_PROJECT_PATH=/opt/zephyrproject
@@ -58,10 +78,4 @@ chmod -R o+w ${ZEPHYR_PROJECT_PATH}
5878
mkdir zephyr/.cache
5979
chmod o+rwx zephyr/.cache
6080

61-
pip3 install -r /opt/zephyrproject/zephyr/scripts/requirements.txt
62-
63-
# the requirements above overwrite junintparser with an older version, but it is not
64-
# used so overwrite it again with the correct version
65-
pip3 install junitparser==2.4.2
66-
67-
bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
81+
$python_cmd -m pip install -r /opt/zephyrproject/zephyr/scripts/requirements.txt

docker/install/ubuntu_install_zephyr_sdk.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ INSTALLATION_PATH=$1
4343
shift
4444

4545
ZEPHYR_SDK_FILE_SHA=8e3572fbca9f9ba18a4436c00d680af34a85e239f7fe66c7988da85571a0d23d
46+
ZEPHYR_SDK_FILE_NAME=zephyr-sdk-0.15.2_linux-x86_64.tar.gz
4647
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_linux-x86_64.tar.gz
47-
echo "$ZEPHYR_SDK_FILE_SHA zephyr-sdk-0.15.2_linux-x86_64.tar.gz" | sha256sum --check
48+
echo "$ZEPHYR_SDK_FILE_SHA ${ZEPHYR_SDK_FILE_NAME}" | sha256sum --check
4849

49-
tar xvf zephyr-sdk-0.15.2_linux-x86_64.tar.gz
50-
mv zephyr-sdk-0.15.2 zephyr-sdk
51-
rm zephyr-sdk-0.15.2_linux-x86_64.tar.gz
50+
mkdir ${INSTALLATION_PATH}
51+
tar -xvf ${ZEPHYR_SDK_FILE_NAME} -C "${INSTALLATION_PATH}" --strip-components=1
52+
rm ${ZEPHYR_SDK_FILE_NAME}
53+
54+
# Setup SDK
55+
cd ${INSTALLATION_PATH}
56+
./setup.sh -h

0 commit comments

Comments
 (0)