README.rst
1.. _xen_dom0:
2
3Xen Dom0: universal snippet for XEN control domain
4##################################################
5
6Overview
7********
8
9This snippet allows user to build Zephyr as a Xen initial domain (Dom0). The feature
10is implemented as configuration snippet to allow support for any compatible platform.
11
12How to add support of a new board
13*********************************
14
15* add board dts overlay to this snippet which deletes/adds memory and deletes UART nodes;
16* add correct memory and hypervisor nodes, based on regions Xen picked for Domain-0 on your setup.
17
18Programming
19***********
20
21Correct snippet designation for Xen must
22be entered when you invoke ``west build``.
23For example:
24
25.. code-block:: console
26
27 west build -b qemu_cortex_a53 -S xen_dom0 samples/synchronization
28
29QEMU example with Xen
30***********************
31
32Overlay for qemu_cortex_a53 board, that is present in :zephyr_file:`snippets/xen_dom0/boards/`
33directory of this snippet is QEMU Xen control domain example.
34
35To run such setup, you need to:
36
37* fetch and build Xen (e.g. RELEASE-4.17.0) for arm64 platform
38* take and compile sample device tree from :file:`example/` directory
39* build your Zephyr sample/application with ``xen_dom0`` snippet and start it as Xen control domain
40
41For starting you can use QEMU from Zephyr SDK by following command:
42
43.. code-block:: console
44
45 <path to Zephyr SDK>/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-aarch64 -cpu cortex-a53 \
46 -m 6G -nographic -machine virt,gic-version=3,virtualization=true -chardev stdio,id=con,mux=on \
47 -serial chardev:con -mon chardev=con,mode=readline -pidfile qemu.pid \
48 -device loader,file=<path to Zephyr app build>/zephyr.bin,addr=0x40600000 \
49 -dtb <path to DTB>/xen.dtb -kernel <path to Xen build>/xen
50
51This will start you a Xen hypervisor with your application as Xen control domain. To make it usable,
52you can add `zephyr-xenlib`_ by Xen-troops library to your project. It'll provide basic domain
53management functionalities - domain creation and configuration.
54
55.. _zephyr-xenlib: https://github.com/xen-troops/zephyr-xenlib
56