Ramdisk in the manifest, simplify initrd generation
We currently support loading a ramdisk for the primary. In fact, all
primaries are required to have one called 'initrd.img'. This makes
the ramdisk optional and specifies its filename in the manifest.
With that, generate_initrd.py loses the last remaining hardcoded
assumption about the structure of the Hafnium ramdisk. Refactor the
script and the build so that generate_initrd.py simply accepts a list of
(name in ramdisk, path on host) pairs.
Bug: 117551352
Change-Id: Iff2d70205940a1740c473d1cac34d5a05d6d6791
diff --git a/src/manifest.c b/src/manifest.c
index 6d8b4ba..222716f 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -209,7 +209,10 @@
TRY(read_string(node, "debug_name", &vm->debug_name));
TRY(read_optional_string(node, "kernel_filename",
&vm->kernel_filename));
- if (vm_id != HF_PRIMARY_VM_ID) {
+ if (vm_id == HF_PRIMARY_VM_ID) {
+ TRY(read_optional_string(node, "ramdisk_filename",
+ &vm->primary.ramdisk_filename));
+ } else {
TRY(read_uint64(node, "mem_size", &vm->secondary.mem_size));
TRY(read_uint16(node, "vcpu_count", &vm->secondary.vcpu_count));
}