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"; |
| 15 | }; |
| 16 | |
| 17 | vm2 { |
| 18 | debug_name = "name"; |
| 19 | kernel_filename = "filename"; |
| 20 | vcpu_count = <N>; |
| 21 | mem_size = <M>; |
| 22 | }; |
| 23 | ... |
| 24 | }; |
| 25 | }; |
| 26 | ``` |
| 27 | |
| 28 | Note: `&{/}` is a syntactic sugar expanded by the DTC compiler. Make sure to |
| 29 | use the DTC in `prebuilts/` as the version packaged with your OS may not support |
| 30 | it yet. |
| 31 | |
| 32 | ## Example |
| 33 | |
| 34 | The following manifest defines two secondary VMs, the first one with 1MB of |
| 35 | memory, 2 CPUs and kernel image called `kernel0` (matches filename in Hafnium's |
| 36 | [ramdisk](HafniumRamDisk.md)), while the second one has 2MB of memory, 4 CPUs |
| 37 | and a kernel image called `kernel1`. |
| 38 | |
| 39 | ``` |
| 40 | /dts-v1/; |
| 41 | /plugin/; |
| 42 | |
| 43 | &{/} { |
| 44 | hypervisor { |
| 45 | vm1 { |
| 46 | debug_name = "primary VM"; |
| 47 | }; |
| 48 | |
| 49 | vm2 { |
| 50 | debug_name = "secondary VM 1"; |
| 51 | kernel_filename = "kernel0"; |
| 52 | vcpu_count = <2>; |
| 53 | mem_size = <0x100000>; |
| 54 | }; |
| 55 | |
| 56 | vm3 { |
| 57 | debug_name = "secondary VM 2"; |
| 58 | kernel_filename = "kernel1"; |
| 59 | vcpu_count = <4>; |
| 60 | mem_size = <0x200000>; |
| 61 | }; |
| 62 | }; |
| 63 | }; |
| 64 | ``` |
| 65 | |
| 66 | ## Compiling |
| 67 | |
| 68 | Hafnium expects the manifest as part of the board FDT, i.e. DeviceTree in binary |
| 69 | format (DTB). |
| 70 | |
| 71 | First, compile the manifest into a DTBO (binary overlay): |
| 72 | ```shell |
| 73 | prebuilts/linux-x64/dtc/dtc -I dts -O dtb --out-version 17 -o manifest.dtbo <manifest_source_file> |
| 74 | ``` |
| 75 | |
| 76 | Then overlay it with the DTB of your board: |
| 77 | ```shell |
| 78 | prebuilts/linux-x64/dtc/fdtoverlay -i <board DTB> -o <output DTB> manifest.dtbo |
| 79 | ``` |