Building Phoenix-RTOS image

To create a Phoenix-RTOS image for the selected target the phoenix-rtos-project repository should be used. This repository aggregates all operating system modules - kernel, standard library, device drivers, filesystems, utilities, and loader. Read more about phoenix-rtos-project submodule repositories here.

This chapter contains instructions on how to build a reference project and how to create the final system image.

Host operating system

Instructions in the Building and Running system on targets chapters have been verified for the Ubuntu Linux distribution, so this is the easiest way to start working with Phoenix-RTOS. There is also the possibility to use MacOS, but it's not described in that detail for now. Using Windows isn't supported, but you can create a virtual machine with Ubuntu or try to use Docker.

Obtaining the sources

The first step of the preparation of the final system image is repository cloning.

To do that and make the next instructions possible, it's recommended to update currently installed packages and, if need be, install git:

sudo apt-get update && \
sudo apt-get upgrade && \
sudo apt-get install git

Then, the repository should be cloned recursively (to get the submodules):

git clone --recursive https://github.com/phoenix-rtos/phoenix-rtos-project.git

Supported target platforms

The Phoenix-RTOS reference project supports the following target platforms:

  • armv7a7-imx6ull-evk
  • armv7a9-zynq7000-qemu
  • armv7a9-zynq7000-zedboard
  • armv7a9-zynq7000-zturn
  • armv7m4-stm32l4x6-nucleo
  • armv7m7-imxrt105x-evk
  • armv7m7-imxrt106x-evk
  • armv7m7-imxrt117x-evk
  • host-generic-pc
  • ia32-generic-pc
  • ia32-generic-qemu
  • riscv64-generic-qemu
  • riscv64-generic-spike

To get the list of valid targets the build.sh script should be launched with an empty TARGET variable, eg:

./phoenix-rtos-build/build.sh

Building using docker

This is the quickest way to start development - all necessary tools are distributed in a docker image.

Firstly, you need to have the docker installed.

How to get docker (Ubuntu 20.04)

  • Install required packages

sudo apt-get update && \ sudo apt-get install curl \ ca-certificates \ gnupg \ lsb-release

  • Make docker packages available

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \ echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

  • Install docker packages

sudo apt-get update && \ sudo apt-get install docker-ce docker-ce-cli containerd.io

  • Check if Docker is properly installed (version can be different):

sudo docker --version

  • To make calling docker command without sudo possible type:

sudo groupadd docker

Even if group docker already exists type then:

sudo usermod -aG docker $USER && \ newgrp docker

  • Check if running docker images without sudo works properly:

docker run hello-world

For more details and other instructions see

docker.com

Then, to build - provide a TARGET via ENV variable and run the build script:

cd phoenix-rtos-project/
TARGET=ia32-generic-qemu ./docker-build.sh all

After the build completes, kernel and disk images will be created and placed in the _boot directory.

You can read more about the building script options here.

Building using the native toolchain

This is the method preferred when you plan to develop Phoenix-RTOS.

Firstly, you need to install some tools required for compiling the toolchain and finally create a Phoenix-RTOS system image. There is a list of commands you can use to get them on the Ubuntu 20.04 host operating system.

sudo apt-get update && \
sudo apt-get upgrade && \
sudo apt-get install build-essential \
mtd-utils \
autoconf \
texinfo \
genext2fs \
libtool \
libhidapi-dev \
python3

Next, you need to compile the toolchains for all required target architectures:

cd phoenix-rtos-project
(cd phoenix-rtos-build/toolchain/ && ./build-toolchain.sh i386-pc-phoenix ~/toolchains/i386-pc-phoenix)
(cd phoenix-rtos-build/toolchain/ && ./build-toolchain.sh arm-phoenix ~/toolchains/arm-phoenix)
(cd phoenix-rtos-build/toolchain/ && ./build-toolchain.sh riscv64-phoenix ~/toolchains/riscv64-phoenix)

Toolchain binaries should be added to the PATH variable:

export PATH=$PATH:~/toolchains/i386-pc-phoenix/i386-pc-phoenix/bin/
export PATH=$PATH:~/toolchains/arm-phoenix/arm-phoenix/bin/
export PATH=$PATH:~/toolchains/riscv64-phoenix/riscv64-phoenix/bin/

Read more about the Phoenix-RTOS toolchain here.

To build a project - provide a TARGET via ENV variable:

TARGET=ia32-generic-qemu ./phoenix-rtos-build/build.sh all

After the build completes, kernel and disk images will be created and placed in the _boot directory.

You can read more about the building script options here.

Launching Phoenix-RTOS

To start the created image on target architecture please see phoenix-rtos-doc/quickstart guide.

See also

  1. Toolchain
  2. Building script
  3. Reference project
  4. Table of Contents