David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 1 | # Hafnium Manifest |
| 2 | |
| 3 | ## Format |
| 4 | |
| 5 | The 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 Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame^] | 15 | kernel_filename = "vmlinuz"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 16 | }; |
| 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 | |
| 29 | Note: `&{/}` is a syntactic sugar expanded by the DTC compiler. Make sure to |
| 30 | use the DTC in `prebuilts/` as the version packaged with your OS may not support |
| 31 | it yet. |
| 32 | |
| 33 | ## Example |
| 34 | |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame^] | 35 | The following manifest defines a primary VM with two secondary VMs. The first |
| 36 | secondary 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 |
| 38 | of memory, 4 CPUs and, by omitting the `kernel_filename` property, a kernel |
| 39 | preloaded into memory. The primary VM is given all remaining memory, the same |
| 40 | number of CPUs as the hardware and a kernel image called `vmlinuz`. |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 41 | |
| 42 | ``` |
| 43 | /dts-v1/; |
| 44 | /plugin/; |
| 45 | |
| 46 | &{/} { |
| 47 | hypervisor { |
| 48 | vm1 { |
| 49 | debug_name = "primary VM"; |
Andrew Scull | 72b43c0 | 2019-09-18 13:53:45 +0100 | [diff] [blame^] | 50 | kernel_filename = "vmlinuz"; |
David Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 51 | }; |
| 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 Brazdil | 0dbb41f | 2019-09-09 18:03:35 +0100 | [diff] [blame] | 62 | vcpu_count = <4>; |
| 63 | mem_size = <0x200000>; |
| 64 | }; |
| 65 | }; |
| 66 | }; |
| 67 | ``` |
| 68 | |
| 69 | ## Compiling |
| 70 | |
| 71 | Hafnium expects the manifest as part of the board FDT, i.e. DeviceTree in binary |
| 72 | format (DTB). |
| 73 | |
| 74 | First, compile the manifest into a DTBO (binary overlay): |
| 75 | ```shell |
| 76 | prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtbo <manifest_source_file> |
| 77 | ``` |
| 78 | |
| 79 | Then overlay it with the DTB of your board: |
| 80 | ```shell |
| 81 | prebuilts/linux-x64/dtc/fdtoverlay -i <board DTB> -o <output DTB> manifest.dtbo |
| 82 | ``` |