Bao Hypervisor Demo Guide

May 18, 2026 ยท View on GitHub

This tutorial provides a step-by-step guide on how to run different demo configurations of the Bao hypervisor featuring multiple guest operating systems and targeting several supported platforms. The available demos are:


NOTE

This tutorial assumes you are running a standard Linux distro (e.g. Debian) and using bash.

If you have any doubts, questions, feedback, or suggestions regarding this guide, please raise an issue in GitHub or contact us via info@bao-project.org.

If you run into any problem while following this guide, we ask you to raise an issue on Github, but first please make sure you are using the same or newer/compatible versions of the tools and software listed in Appendix III (not all are needed for all target platforms).


-1. Install dependencies

sudo apt install build-essential bison flex git libssl-dev ninja-build \
    u-boot-tools pandoc libslirp-dev pkg-config libglib2.0-dev libpixman-1-dev \
    gettext-base curl xterm cmake python3-pip xilinx-bootgen file cpio

pip3 install pykwalify packaging pyelftools

0. Download and setup the toolchain

Download the latest bare-metal cross-compile toolchain for your target architecture:

a) For Armv8 Aarch64, use the aarch64-none-elf- toolchain.

Download it from the Arm Developer's website.

b) For Armv7 or Armv8 Aarch32, use the arm-none-eabi- toolchain.

Download it from the Arm Developer's website.

c) For RISC-V RV64, use the riscv64-unknown-elf- toolchain.

Download it from Bao's Project RISC-V Toolchain repo.

d) For RISC-V RV32, use the riscv32-unknown-elf- toolchain.

Download it from Bao's Project RISC-V Toolchain repo.

e) For RH850, use the v850-elf- toolchain.

Download it from Bao's Project V850 Toolchain repo.

f) For Tricore, use the tricore-elf- toolchain.

Download it from Bao Project's Mirror.

Install the toolchain. Then, set the CROSS_COMPILE environment variable with the reference toolchain prefix path:

export CROSS_COMPILE=/path/to/toolchain/install/dir/bin/your-toolchain-prefix-

For RISC-V, also set:

export OPENSBI_CROSS_COMPILE=/path/to/toolchain/install/dir/bin/riscv64-unknown-linux-gnu-

1. Setup base environment

Clone this repo and cd to it:

git clone https://github.com/bao-project/bao-demos
cd bao-demos

Depending on your target platform and demo, setup the PLATFORM and DEMO environment variables using the IDs in Appendix I. For example, for a system configuration targeting the ZCU102 board and featuring a dual-guest Linux+FreeRTOS demo:

export PLATFORM=zcu102
export DEMO=linux+freertos

Note that not every platform supports every demo. The supported platform/demo combinations are available in Appendix II.

At this point you have two options:

A) Use automated make

Just execute:

make -j$(nproc)

And all the needed source and images will be automatically downloaded and built. The makefiles will also print some instructions for you to carry out when it is not possible to automate a given step for some reason (e.g. download behind authentication wall). It will also print the instructions on how to deploy the images on your target platform. To quiet instructions pass NO_INSTRUCTIONS=1 to make.


WARNING

The makefiles will automatically accept end-user license agreements (EULAs) on your behalf for some of the downloaded firmware. If you wish to be prompted to accept them manually, pass ALWAYS_ASK=1 to make.


If you are targetting an emulator platform like QEMU, after building you can start it with:

make run

In this case, if you don't have qemu for the target architecture installed, it will build it for you.


NOTE

These makefiles are intended ONLY to automate this guide's steps; not to be used as any kind of build system during development.


B) Follow the step-by-step guide

As an alternative, we provide a step-by-step guide that you can follow to build all the necessary software and deploy it to your target platform.

B.1) Setup ARCH manually

Setup the ARCH environment variable manually according to Appendix I. For example, for the ZCU102 platform:

export ARCH=aarch64

B.2) Create working directory

Create the working directories where you'll place the source code and final images:

export BAO_DEMOS=$(realpath .)
export BAO_DEMOS_WRKDIR=$BAO_DEMOS/wrkdir
export BAO_DEMOS_WRKDIR_SRC=$BAO_DEMOS_WRKDIR/srcs
export BAO_DEMOS_WRKDIR_BIN=$BAO_DEMOS_WRKDIR/bin
export BAO_DEMOS_WRKDIR_PLAT=$BAO_DEMOS_WRKDIR/imgs/$PLATFORM
export BAO_DEMOS_WRKDIR_IMGS=$BAO_DEMOS_WRKDIR_PLAT/$DEMO
mkdir -p $BAO_DEMOS_WRKDIR
mkdir -p $BAO_DEMOS_WRKDIR_SRC
mkdir -p $BAO_DEMOS_WRKDIR_BIN
mkdir -p $BAO_DEMOS_WRKDIR_IMGS

B.3) Build guests

Build guests according to the target demo:

B.4) Build Bao

Clone Bao's repo to the working directory:

export BAO_DEMOS_BAO=$BAO_DEMOS_WRKDIR_SRC/bao
git clone https://github.com/bao-project/bao-hypervisor $BAO_DEMOS_BAO\
    --branch v2.0.0

Copy your config to the working directory:

mkdir -p $BAO_DEMOS_WRKDIR_IMGS/config
if [ -d "$BAO_DEMOS/demos/$DEMO/configs/$PLATFORM" ]; then
    cp -r "$BAO_DEMOS/demos/$DEMO/configs/$PLATFORM"\
    "$BAO_DEMOS_WRKDIR_IMGS/config/$DEMO"
else
    cp -L "$BAO_DEMOS/demos/$DEMO/configs/$PLATFORM.c"\
        "$BAO_DEMOS_WRKDIR_IMGS/config/$DEMO.c"
fi

Build it:

make -C $BAO_DEMOS_BAO\
    PLATFORM=$PLATFORM\
    CONFIG_REPO=$BAO_DEMOS_WRKDIR_IMGS/config\
    CONFIG=$DEMO\
    CPPFLAGS=-DBAO_DEMOS_WRKDIR_IMGS=$BAO_DEMOS_WRKDIR_IMGS

And copy the resulting binary into the final image directory:

cp $BAO_DEMOS_BAO/bin/$PLATFORM/$DEMO/bao.bin\
    $BAO_DEMOS_WRKDIR_IMGS

B.5) Build Firmware and Deploy

Build the firmware and deploy the system according to the target platform:

AArch64 platforms:

AArch32 platforms:

RISC-V platforms:

RH850 platforms:

Tricore platforms:


Appendix I

PLATFORMARCH
Xilinx ZCU102zcu102aarch64
Xilinx ZCU104zcu104aarch64
NXP i.MX8QMimx8qmaarch64
NXP S32G3s32g3aarch64
Nvidia TX2tx2aarch64
Raspberry 4 Model Brpi4aarch64
QEMU Aarch64 virtqemu-aarch64-virtaarch64
FVP-A AArch64fvp-aaarch64
FVP-R AArch64fvp-raarch64
FVP-A AArch32fvp-a-aarch32aarch32
FVP-R AArch32fvp-r-aarch32aarch32
NXP S32Z270s32z270aarch32
QEMU RV64 virtqemu-riscv64-virtriscv64
QEMU RV32 virtqemu-riscv32-virtriscv32
RH850-U2A16rh850-u2a16rh850
Infineon TC4Dx COMtc4dxtricore
E3650e3650aarch32
iMX8MP Verdinimx8mp-verdinaarch64
DEMO
Baremetal guestbaremetal
Linux+FreeRTOSlinux+freertos
Linux+Zephyrlinux+zephyr
Zephyr+Baremetalzephyr+baremetal
VirtIOvirtio

Appendix II

baremetallinux+freertoslinux+zephyrzephyr+baremetalvirtiotorizonos+freertos
zcu102xxx
zcu104xxx
imx8qmxx
s32g3xx
tx2xx
rpi4xxxx
qemu-aarch64-virtxxxx
fvp-axxxx
fvp-a-aarch32xxxx
fvp-rxxxx
fvp-r-aarch32xx
s32z270xx
qemu-riscv64-virtxxx
qemu-riscv32-virtxx
rh850-u2a16x
tc4dxx
e3650x
imx8mp-verdinxxx

Appendix III

ToolVersion
arm-none-eabi-gcc14.2.1
aarch64-none-elf-gcc14.2.1
riscv64-unknown-elf-gcc13.2.0
v850-elf-gcc14.2.0
tricore-elf-gcc11.3.1
make4.3
dtc1.6.1
gcc11.4.0
mkimage2022.01
cmake3.22.1
ninja1.10.1