Zephyr v1.12.0 於 Ubuntu v14.04 開發環境搭建

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章