Setup Zephyr Development Env on Manjaro Linux and Building Sample Application for X86 Qemu

Install the dependuncies using yaourt:

$ yaourt -S ninja ccache cmake gperf doxygen dfu-util dtc autoconf automake libtool

Clone the zephyr repo and install requirements.

$ cd ~
$ git clone https://github.com/zephyrproject-rtos/zephyr.git
$ cd zephyr/
$ pip3 install --user -r scripts/requirements.txt
$ cd ..

download the zephyr sdk.

$ wget https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/0.9.3/zephyr-sdk-0.9.3-setup.run

After downloading the zephyr sdk installer, run the setup and install the sdk in ~/.zephyr

$ sudo zephyr-sdk-0.9.3-setup.run

This will ask for the path of directory to install zephyr sdk.

Create ~/.zephyrrc and put following data into it.

export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=~/.zephyr/

to use these environment variables,

$ source .zephyrrc

To start zephyr development, go to the zephyr repo that you have just cloned and run zephyr-env.sh

$ cd ~/zephyr
$ source zephyr-env.sh

Once this is done, you can now start building zephyr projects. To build the hello_world for x86_qemu.

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -GNinja -DBOARD=qemu_x86 ..
$ ninja

Now run this using,

$ ninja run
[0/1] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: qemu32,+nx,+pae
qemu-system-i386: warning: Unknown firmware file in legacy mode: genroms/multiboot.bin

***** Booting Zephyr OS zephyr-v1.13.0-954-gd696a56cf *****
Hello World! qemu_x86

To exit from qemu hit ctrl+a and then x.

comments powered by Disqus