blob: ff1cf0eb017810e8486a84e493ab0107569282bd [file] [log] [blame] [view]
David Brazdil0dbb41f2019-09-09 18:03:35 +01001# Hafnium Manifest
2
3## Format
4
5The format of the manifest is a simple DeviceTree overlay:
6
7```
8/dts-v1/;
9/plugin/;
10
11&{/} {
12 hypervisor {
13 vm1 {
14 debug_name = "name";
Andrew Scull72b43c02019-09-18 13:53:45 +010015 kernel_filename = "vmlinuz";
David Brazdil0dbb41f2019-09-09 18:03:35 +010016 };
17
18 vm2 {
19 debug_name = "name";
20 kernel_filename = "filename";
21 vcpu_count = <N>;
22 mem_size = <M>;
23 };
24 ...
25 };
26};
27```
28
29Note: `&{/}` is a syntactic sugar expanded by the DTC compiler. Make sure to
30use the DTC in `prebuilts/` as the version packaged with your OS may not support
31it yet.
32
33## Example
34
Andrew Scull72b43c02019-09-18 13:53:45 +010035The following manifest defines a primary VM with two secondary VMs. The first
36secondary VM has 1MB of memory, 2 CPUs and kernel image called `kernel0`
37(matches filename in Hafnium's [ramdisk](HafniumRamDisk.md)). The second has 2MB
38of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel
39preloaded into memory. The primary VM is given all remaining memory, the same
40number of CPUs as the hardware and a kernel image called `vmlinuz`.
David Brazdil0dbb41f2019-09-09 18:03:35 +010041
42```
43/dts-v1/;
44/plugin/;
45
46&{/} {
47 hypervisor {
48 vm1 {
49 debug_name = "primary VM";
Andrew Scull72b43c02019-09-18 13:53:45 +010050 kernel_filename = "vmlinuz";
David Brazdil0dbb41f2019-09-09 18:03:35 +010051 };
52
53 vm2 {
54 debug_name = "secondary VM 1";
55 kernel_filename = "kernel0";
56 vcpu_count = <2>;
57 mem_size = <0x100000>;
58 };
59
60 vm3 {
61 debug_name = "secondary VM 2";
David Brazdil0dbb41f2019-09-09 18:03:35 +010062 vcpu_count = <4>;
63 mem_size = <0x200000>;
64 };
65 };
66};
67```
68
69## Compiling
70
71Hafnium expects the manifest as part of the board FDT, i.e. DeviceTree in binary
72format (DTB).
73
74First, compile the manifest into a DTBO (binary overlay):
75```shell
76prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtbo <manifest_source_file>
77```
78
79Then overlay it with the DTB of your board:
80```shell
81prebuilts/linux-x64/dtc/fdtoverlay -i <board DTB> -o <output DTB> manifest.dtbo
82```