Zephyr: 物联网操作系统, v1.12.0
官方网站: www.zephyrproject.org
安装平台: Ubuntu v14.04
官方原文: http://docs.zephyrproject.org/getting_started/installation_linux.html
牛人的 Zephyr 中文文档: https://zephyr-doc.readthedocs.io/zh_CN/latest/getting_started/installation_linux.html
1. 克隆 Zephyr 源码
cd ~
git clone https://github.com/zephyrproject-rtos/zephyr.git
2. 更新 Ubuntu 操作系统软件源
sudo apt-get update
sudo apt-get upgrade
3. 安装依赖软件包
sudo apt-get install --no-install-recommends git cmake ninja-build gperf \
ccache doxygen dfu-util device-tree-compiler \
python3-ply python3-pip python3-setuptools python3-wheel xz-utils file \
make gcc-multilib autoconf automake libtool librsvg2-bin \
texlive-latex-base texlive-latex-extra latexmk texlive-fonts-recommended
4. 安装必须的python3依赖工具
cd ~/zephyr # or to your directory where zephyr is cloned
pip3 install --user -r scripts/requirements.txt
5. 安装 cmake 3.8.2 或以上版本
mkdir $HOME/cmake && cd $HOME/cmake
wget https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.sh
yes | sh cmake-3.8.2-Linux-x86_64.sh | cat
echo "export PATH=$PWD/cmake-3.8.2-Linux-x86_64/bin:\$PATH" >> $HOME/.zephyrrc
source <zephyr git clone location>/zephyr-env.sh
cmake --version
6. 安装 Zephyr Software Development Kit (SDK)
wget https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/0.9.3/zephyr-sdk-0.9.3-setup.run
cd <sdk download directory>
sh zephyr-sdk-0.9.3-setup.run
注: 默认安装路径是 /opt/zephyr-sdk/, 默认安装需要 root 权限; 推荐安装到用户自定义目录下;
7. 设置环境变量
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
注: 有的 linux 操作系统有默认的 CFLAGS,CXXFLAGS 环境变量, 需注销;
unset CFLAGS CXXFLAGS
8. 将上面设置添加到文件 $HOME/.zephyrrc
中,以备新对话环境使用该工具链
cat <<EOF > ~/.zephyrrc
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
EOF
注: 有的 linux 操作系统有默认的 CFLAGS,CXXFLAGS 环境变量, 需注销;
cat <<EOF >> ~/.zephyrrc
unset CFLAGS CXXFLAGS
EOF