Last active
February 23, 2022 19:05
-
-
Save talesmm14/148b9e02966b038f9334dcbbc4c5451a to your computer and use it in GitHub Desktop.
Script to install Zephyr RTOS and ESP32 libs on linux like UBUNTU
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
#!/bin/bash | |
# Information: Script to install Zephyr RTOS | |
# Version: 0.0.1 | |
# Date: 23/02/2020 | |
# Autor: Tales Monteiro Melquiades - [email protected] | |
# Github: https://github.com/talesmm14 | |
# Colors | |
RED='\033[0;31m' # Red | |
GREEN='\033[0;32m' # Green | |
YELLOW='\033[0;33m' # Yellow | |
NC='\033[0m' # No Color | |
cd ~ | |
# Update Your Operating System | |
echo -e "${YELLOW}==== Update Your Operating System ====${NC}" | |
sudo apt-get update -y | |
sudo apt-get upgrade -y | |
echo | |
echo | |
# Install Requirements and Dependecies | |
echo -e "${YELLOW}==== Install Requirements and Dependecies ====${NC}" | |
sudo apt-get install -y --no-install-recommends git cmake ninja-build gperf \ | |
ccache dfu-util device-tree-compiler wget \ | |
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file libpython3.8-dev \ | |
make gcc gcc-multilib g++-multilib libsdl2-dev | |
echo | |
echo | |
# Check Cmake or Update | |
echo -e "${YELLOW}==== Check Cmake version ====${NC}" | |
function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; } | |
cmakeVersion=$(version "$(cmake --version | head -n1 | cut -d' ' -f3)") | |
largerRequirement=$(version "3.20.0") | |
if [ $cmakeVersion -lt $largerRequirement ]; then | |
echo -e "${RED}==== Update Cmake version ====${NC}" | |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - | |
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' | |
sudo apt update -y | |
sudo apt install cmake -y | |
fi | |
echo "Cmake version " $(cmake --version | head -n1 | cut -d' ' -f3) | |
echo | |
echo | |
# Install whell and west | |
echo -e "${YELLOW}==== Install whell and west ====${NC}" | |
pip3 install wheel | |
pip3 install west | |
echo | |
echo | |
# Install Zephyr SDK | |
echo -e "${YELLOW}==== Install Zephyr SDK ====${NC}" | |
cd ~ | |
west init -m https://github.com/golioth/zephyr-sdk.git --mr main ~/zephyrproject | |
cd zephyrproject/ | |
west update | |
echo | |
echo | |
echo -e "${YELLOW}==== Install the Espressif submodules ====${NC}" | |
west espressif update | |
echo | |
echo | |
echo -e "${YELLOW}==== Tell west to automatically configure CMake ====${NC}" | |
west zephyr-export | |
echo | |
echo | |
echo -e "${YELLOW}==== Install the remaining dependencies: ====${NC}" | |
pip3 install -r ~/zephyrproject/zephyr/scripts/requirements.txt | |
echo | |
echo | |
# Install the Espressif Toolchain | |
echo -e "${YELLOW}==== Install the Espressif Toolchain ====${NC}" | |
west espressif install | |
espressifPath=$(west espressif install | tail -2 | head -n1 | cut -d'"' -f2 | cut -d'.' -f2) | |
export ZEPHYR_TOOLCHAIN_VARIANT="espressif" | |
export ESPRESSIF_TOOLCHAIN_PATH="${HOME}/.$espressifPath" | |
export PATH=$PATH:$ESPRESSIF_TOOLCHAIN_PATH/bin | |
echo | |
echo | |
echo -e "${GREEN}==== ESPRESSIF_TOOLCHAIN_PATH path set to ${HOME}/.$espressifPath ====${NC}" | |
echo | |
echo | |
echo -e "${GREEN}===== Process finished! ====${NC}" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script configures the environment variables and all the necessary folders, it is not necessary to run with sudo, the same will ask for a password if you don't have sudo. 💬
command: 👇
bash install-zephyr-rtos.sh
👈Don't feel shy about asking and reporting bugs! 😄 👍