blob: 37e27db28441107b50c101dce1e825b5707087ba [file] [log] [blame] [view]
Andrew Scull23042042018-08-22 17:44:56 +01001# Hafnium RAM disk
2
3Hafnium expects to find the following files in the root directory of its RAM
4disk:
5
Andrew Walbran6f8fd4c2019-08-05 13:28:17 +01006* `vmlinuz` -- the kernel of the primary VM.
7* `initrd.img` -- the initial ramdisk of the primary VM.
David Brazdil7a462ec2019-08-15 12:27:47 +01008* `manifest.dtb` -- hypervisor configuration file.
9* kernels for the secondary VMs, whose names are described in the manifest.
Andrew Scull23042042018-08-22 17:44:56 +010010
11Follow the [preparing Linux](PreparingLinux.md) instructions to produce
12`vmlinuz` and `initrd.img` for a basic Linux primary VM.
13
David Brazdil7a462ec2019-08-15 12:27:47 +010014## Manifest file
Andrew Walbran6f8fd4c2019-08-05 13:28:17 +010015
David Brazdil7a462ec2019-08-15 12:27:47 +010016The format is currently a simple Device Tree:
Andrew Scull23042042018-08-22 17:44:56 +010017
David Brazdil7a462ec2019-08-15 12:27:47 +010018```
19/dts-v1/;
20
21/ {
22 hypervisor {
23 vm1 {
24 debug_name = "name";
25 };
26
27 vm2 {
28 debug_name = "name";
29 kernel_filename = "filename";
30 vcpu_count = <N>;
31 mem_size = <M>;
32 };
33 ...
34 };
35};
Andrew Scull23042042018-08-22 17:44:56 +010036```
37
38For example, the following defines two secondary VMs, the first one with 1MB of
39memory, 2 CPUs and kernel image called `kernel0`, while the second one has 2MB
Andrew Walbran6f8fd4c2019-08-05 13:28:17 +010040of memory, 4 CPUs and a kernel image called `kernel1`.
Andrew Scull23042042018-08-22 17:44:56 +010041
David Brazdil7a462ec2019-08-15 12:27:47 +010042```
43/dts-v1/;
44
45/ {
46 hypervisor {
47 vm1 {
48 debug_name = "primary VM";
49 };
50
51 vm2 {
52 debug_name = "secondary VM 1";
53 kernel_filename = "kernel0";
54 vcpu_count = <2>;
55 mem_size = <0x100000>;
56 };
57
58 vm3 {
59 debug_name = "secondary VM 2";
60 kernel_filename = "kernel1";
61 vcpu_count = <4>;
62 mem_size = <0x200000>;
63 };
64 };
65};
66```
67
68Hafnium expects the manifest in Device Tree Blob format. Compile it with:
Andrew Walbran6f8fd4c2019-08-05 13:28:17 +010069```shell
David Brazdil7a462ec2019-08-15 12:27:47 +010070dtc -I dts -O dtb --out-version 17 -o manifest.dtb <manifest_source_file>
Andrew Scull23042042018-08-22 17:44:56 +010071```
72
73## Create a RAM disk for Hafnium
74
75Assuming that a subdirectory called `initrd` contains the files listed in the
76previous section, we can build `initrd.img` with the following command:
77
78```shell
79cd initrd; find . | cpio -o > ../initrd.img; cd -
80```