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

[docker][microTVM]Fix Zephyr 0.15.2 SDK installation and separate Zephyr python environment #13829

Merged
merged 2 commits into from
Jan 24, 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
7 changes: 5 additions & 2 deletions docker/Dockerfile.ci_cortexm
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh
RUN bash /install/ubuntu_install_sccache.sh
ENV PATH /opt/sccache:$PATH

# Zephyr SDK deps
# Zephyr Project
COPY install/ubuntu_install_zephyr.sh /install/ubuntu_install_zephyr.sh
COPY install/ubuntu_init_zephyr_project.sh /install/ubuntu_init_zephyr_project.sh
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
RUN bash /install/ubuntu_install_zephyr.sh
ENV ZEPHYR_BASE=/opt/zephyrproject/zephyr

#Zephyr SDK
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#Zephyr SDK
# Zephyr SDK

COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
RUN bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
ENV PATH /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH

# NRF
Expand Down
8 changes: 6 additions & 2 deletions docker/Dockerfile.ci_riscv
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh
RUN bash /install/ubuntu_install_sccache.sh
ENV PATH /opt/sccache:$PATH

# Zephyr SDK deps
# Zephyr Project
COPY install/ubuntu_install_zephyr.sh /install/ubuntu_install_zephyr.sh
COPY install/ubuntu_init_zephyr_project.sh /install/ubuntu_init_zephyr_project.sh
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
RUN bash /install/ubuntu_install_zephyr.sh
ENV ZEPHYR_BASE=/opt/zephyrproject/zephyr

#Zephyr SDK
COPY install/ubuntu_install_zephyr_sdk.sh /install/ubuntu_install_zephyr_sdk.sh
RUN bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
ENV PATH /opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH

# Download RISC-V gcc toolchain (linux)
COPY install/ubuntu_download_xuantie_gcc_linux.sh /install/ubuntu_download_xuantie_gcc_linux.sh
RUN bash /install/ubuntu_download_xuantie_gcc_linux.sh /opt/riscv/riscv64-unknown-linux-gnu
Expand Down
30 changes: 22 additions & 8 deletions docker/install/ubuntu_install_zephyr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,27 @@ sudo apt-get update

sudo apt-install-and-clear -y cmake

pip3 install west
# Find release version
apt-get update
apt-install-and-clear -y \
lsb-core

release=$(lsb_release -sc)
if [ "${release}" == "bionic" ]; then
python_cmd="python3"
elif [ "${release}" == "focal" ]; then
python_cmd="python3.8"
else
echo "Don't know which version of python to use for Zephyr."
exit 2
fi

# Current Zephyr version is compatible with python3.8.
# We use a different python env for Zephyr to test the
# real world scenario where TVM and Zephyr could be in different
# python environments.
# TODO: use virtual env for Zephyr.
$python_cmd -m pip install west

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

pip3 install -r /opt/zephyrproject/zephyr/scripts/requirements.txt

# the requirements above overwrite junintparser with an older version, but it is not
# used so overwrite it again with the correct version
pip3 install junitparser==2.4.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just using the system Python with python_cmd here? This should still re-install junitparser since that was a hack to get a specific version working in CI which didn't agree with zephyr's requirements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i might have removed pip3 to stop ppl from installing stuff outside the tvm venv


bash /install/ubuntu_install_zephyr_sdk.sh /opt/zephyr-sdk
$python_cmd -m pip install -r /opt/zephyrproject/zephyr/scripts/requirements.txt
13 changes: 9 additions & 4 deletions docker/install/ubuntu_install_zephyr_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ INSTALLATION_PATH=$1
shift

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

tar xvf zephyr-sdk-0.15.2_linux-x86_64.tar.gz
mv zephyr-sdk-0.15.2 zephyr-sdk
rm zephyr-sdk-0.15.2_linux-x86_64.tar.gz
mkdir ${INSTALLATION_PATH}
tar -xvf ${ZEPHYR_SDK_FILE_NAME} -C "${INSTALLATION_PATH}" --strip-components=1
rm ${ZEPHYR_SDK_FILE_NAME}

# Setup SDK
cd ${INSTALLATION_PATH}
./setup.sh -h