Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 1 | # Hafnium RAM disk |
| 2 | |
| 3 | Hafnium expects to find the following files in the root directory of its RAM |
| 4 | disk: |
| 5 | |
Andrew Walbran | 6f8fd4c | 2019-08-05 13:28:17 +0100 | [diff] [blame^] | 6 | * `vmlinuz` -- the kernel of the primary VM. |
| 7 | * `initrd.img` -- the initial ramdisk of the primary VM. |
| 8 | * `vms.txt` -- optionally describes the secondary VMs. |
| 9 | * kernels for the secondary VMs, whose names are described in `vms.txt`. |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 10 | |
| 11 | Follow the [preparing Linux](PreparingLinux.md) instructions to produce |
| 12 | `vmlinuz` and `initrd.img` for a basic Linux primary VM. |
| 13 | |
| 14 | ## Format of `vms.txt` file |
Andrew Walbran | 6f8fd4c | 2019-08-05 13:28:17 +0100 | [diff] [blame^] | 15 | |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 16 | The format is currently one line per secondary VM, with the following format: |
| 17 | |
Andrew Walbran | 6f8fd4c | 2019-08-05 13:28:17 +0100 | [diff] [blame^] | 18 | ```shell |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 19 | <memory-size-in-bytes> <number-of-cpus> <kernel-filename> |
| 20 | ``` |
| 21 | |
| 22 | For example, the following defines two secondary VMs, the first one with 1MB of |
| 23 | memory, 2 CPUs and kernel image called `kernel0`, while the second one has 2MB |
Andrew Walbran | 6f8fd4c | 2019-08-05 13:28:17 +0100 | [diff] [blame^] | 24 | of memory, 4 CPUs and a kernel image called `kernel1`. |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 25 | |
Andrew Walbran | 6f8fd4c | 2019-08-05 13:28:17 +0100 | [diff] [blame^] | 26 | ```shell |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 27 | 1048576 2 kernel0 |
| 28 | 2097152 4 kernel1 |
| 29 | ``` |
| 30 | |
| 31 | ## Create a RAM disk for Hafnium |
| 32 | |
| 33 | Assuming that a subdirectory called `initrd` contains the files listed in the |
| 34 | previous section, we can build `initrd.img` with the following command: |
| 35 | |
| 36 | ```shell |
| 37 | cd initrd; find . | cpio -o > ../initrd.img; cd - |
| 38 | ``` |