Install Linux Host Dependencies¶
Documentation is available for these Linux distributions:
- Clear Linux
- Arch Linux
For distributions that are not based on rolling releases, some of the requirements and dependencies may not be met by your package manager. In that case please follow the additional instructions that are provided to find software from sources other than the package manager.
If you’re working behind a corporate firewall, you’ll likely
need to configure a proxy for accessing the internet, if you haven’t
done so already. While some tools use the environment variables
https_proxy to get their proxy settings, some
use their own configuration files, most notably
Update Your Operating System¶
Ensure your host system is up to date.
Install Requirements and Dependencies¶
Note that both Ninja and Make are installed with these instructions; you only need one.
CMake version 3.13.1 or higher is required. Check what version you have by
cmake --version. If you have an older version, there are several ways
of obtaining a more recent one:
On Ubuntu, you can follow the instructions for adding the kitware third-party apt repository to get an updated version of cmake using apt.
Download and install a packaged cmake from the CMake project site. (Note this won’t uninstall the previous version of cmake.)
cd ~ wget https://github.com/Kitware/CMake/releases/download/v3.15.3/cmake-3.15.3-Linux-x86_64.sh chmod +x cmake-3.15.3-Linux-x86_64.sh sudo ./cmake-3.15.3-Linux-x86_64.sh --skip-license --prefix=/usr/local hash -r
hash -rcommand may be necessary if the installation script put cmake into a new location on your PATH.
Download and install from the pre-built binaries provided by the CMake project itself in the CMake Downloads page. For example, to install version 3.13.1 in
mkdir $HOME/bin/cmake && cd $HOME/bin/cmake wget https://github.com/Kitware/CMake/releases/download/v3.13.1/cmake-3.13.1-Linux-x86_64.sh yes | sh cmake-3.13.1-Linux-x86_64.sh | cat echo "export PATH=$PWD/cmake-3.13.1-Linux-x86_64/bin:\$PATH" >> $HOME/.zephyrrc
pip3 install --user cmake
Note this won’t uninstall the previous version of cmake and will install the new cmake into your ~/.local/bin folder so you’ll need to add ~/.local/bin to your PATH. (See Python and pip for details.)
Check your distribution’s beta or unstable release package library for an update.
On Ubuntu you can also use snap to get the latest version available:
sudo snap install cmake
After updating cmake, verify that the newly installed cmake is found
You might also want to uninstall the CMake provided by your package manager to
avoid conflicts. (Use
whereis cmake to find other installed
DTC (Device Tree Compiler)¶
A recent DTC version (1.4.6 or higher) is required. Check what version you
have by using
dtc --version. If you have an older version, either install a
more recent one by building from source, or use the one that is bundled in
the Zephyr SDK by installing it and setting the
ZEPHYR_SDK_INSTALL_DIR environment variable.
Install the Zephyr Software Development Kit (SDK)¶
Use of the Zephyr SDK is optional, but recommended. Some of the dependencies installed above are only needed for installing the SDK.
Zephyr’s SDK contains all necessary tools to build Zephyr on all supported architectures. Additionally, it includes host tools such as custom QEMU binaries and a host compiler. The SDK supports the following target architectures:
- Nios II
Follow these steps to install the Zephyr SDK:
Download the latest SDK as a self-extracting installation binary:
(You can change 0.10.3 to another version if needed; the Zephyr Downloads page contains all available SDK releases.)
Run the installation binary, installing the SDK at
cd <sdk download directory> chmod +x zephyr-sdk-0.10.3-setup.run ./zephyr-sdk-0.10.3-setup.run -- -d ~/zephyr-sdk-0.10.3
You can pick another directory if you want. If this fails, make sure Zephyr’s dependencies were installed as described in Install Requirements and Dependencies.
Set these environment variables:
$HOME/zephyr-sdk-0.10.3(or wherever you chose to install the SDK)
If you ever want to uninstall the SDK, just remove the directory where you installed it and unset these environment variables.
Building on Linux without the Zephyr SDK¶
The Zephyr SDK is provided for convenience and ease of use. It provides toolchains for all Zephyr target architectures, and does not require any extra flags when building applications or running tests. In addition to cross-compilers, the Zephyr SDK also provides prebuilt host tools. It is, however, possible to build without the SDK’s toolchain by using another toolchain as as described in the main Getting Started Guide document.
As already noted above, the SDK also includes prebuilt host tools. To use the
SDK’s prebuilt host tools with a toolchain from another source, keep the
ZEPHYR_SDK_INSTALL_DIR environment variable set to the Zephyr SDK
installation directory. To build without the Zephyr SDK’s prebuilt host tools,
ZEPHYR_SDK_INSTALL_DIR environment variable must be unset before
source zephyr-env.sh later on in the Getting Started Guide.
To make sure this variable is unset, run: