blob: 4f69076c4fb5502704c2491a10890d269bfc2033 [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 Brazdile6f83222019-09-23 14:47:37 +010016 ramdisk_filename = "initrd.img";
David Brazdil0dbb41f2019-09-09 18:03:35 +010017 };
18
19 vm2 {
20 debug_name = "name";
21 kernel_filename = "filename";
22 vcpu_count = <N>;
23 mem_size = <M>;
24 };
25 ...
26 };
27};
28```
29
30Note: `&{/}` is a syntactic sugar expanded by the DTC compiler. Make sure to
31use the DTC in `prebuilts/` as the version packaged with your OS may not support
32it yet.
33
34## Example
35
Andrew Scull72b43c02019-09-18 13:53:45 +010036The following manifest defines a primary VM with two secondary VMs. The first
37secondary VM has 1MB of memory, 2 CPUs and kernel image called `kernel0`
38(matches filename in Hafnium's [ramdisk](HafniumRamDisk.md)). The second has 2MB
39of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel
40preloaded into memory. The primary VM is given all remaining memory, the same
David Brazdile6f83222019-09-23 14:47:37 +010041number of CPUs as the hardware, a kernel image called `vmlinuz` and a ramdisk
42`initrd.img`. Secondaries cannot have a ramdisk.
David Brazdil0dbb41f2019-09-09 18:03:35 +010043
44```
45/dts-v1/;
46/plugin/;
47
48&{/} {
49 hypervisor {
50 vm1 {
51 debug_name = "primary VM";
Andrew Scull72b43c02019-09-18 13:53:45 +010052 kernel_filename = "vmlinuz";
David Brazdile6f83222019-09-23 14:47:37 +010053 ramdisk_filename = "initrd.img";
David Brazdil0dbb41f2019-09-09 18:03:35 +010054 };
55
56 vm2 {
57 debug_name = "secondary VM 1";
58 kernel_filename = "kernel0";
59 vcpu_count = <2>;
60 mem_size = <0x100000>;
61 };
62
63 vm3 {
64 debug_name = "secondary VM 2";
David Brazdil0dbb41f2019-09-09 18:03:35 +010065 vcpu_count = <4>;
66 mem_size = <0x200000>;
67 };
68 };
69};
70```
71
72## Compiling
73
74Hafnium expects the manifest as part of the board FDT, i.e. DeviceTree in binary
75format (DTB).
76
77First, compile the manifest into a DTBO (binary overlay):
78```shell
79prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtbo <manifest_source_file>
80```
81
82Then overlay it with the DTB of your board:
83```shell
84prebuilts/linux-x64/dtc/fdtoverlay -i <board DTB> -o <output DTB> manifest.dtbo
85```