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/boot_flow/android.c b/src/boot_flow/android.c
index cf7246e..0221674 100644
--- a/src/boot_flow/android.c
+++ b/src/boot_flow/android.c
@@ -51,10 +51,12 @@
  * Android boot flow does not change based on the updates.
  */
 bool plat_boot_flow_update(struct mm_stage1_locked stage1_locked,
+			   const struct manifest *manifest,
 			   struct boot_params_update *p, struct memiter *cpio,
 			   struct mpool *ppool)
 {
 	(void)stage1_locked;
+	(void)manifest;
 	(void)p;
 	(void)cpio;
 	(void)ppool;
diff --git a/src/boot_flow/common.c b/src/boot_flow/common.c
index 586d3d2..b295824 100644
--- a/src/boot_flow/common.c
+++ b/src/boot_flow/common.c
@@ -87,8 +87,9 @@
  * Takes action on any updates that were generated.
  */
 bool boot_flow_update(struct mm_stage1_locked stage1_locked,
+		      const struct manifest *manifest,
 		      struct boot_params_update *p, struct memiter *cpio,
 		      struct mpool *ppool)
 {
-	return plat_boot_flow_update(stage1_locked, p, cpio, ppool);
+	return plat_boot_flow_update(stage1_locked, manifest, p, cpio, ppool);
 }
diff --git a/src/boot_flow/linux.c b/src/boot_flow/linux.c
index 9d4d886..e1e257c 100644
--- a/src/boot_flow/linux.c
+++ b/src/boot_flow/linux.c
@@ -52,14 +52,19 @@
 }
 
 bool plat_boot_flow_update(struct mm_stage1_locked stage1_locked,
+			   const struct manifest *manifest,
 			   struct boot_params_update *update,
 			   struct memiter *cpio, struct mpool *ppool)
 {
-	static struct string filename = STRING_INIT("initrd.img");
 	struct memiter primary_initrd;
+	const struct string *filename =
+		&manifest->vm[HF_PRIMARY_VM_INDEX].primary.ramdisk_filename;
 
-	if (!cpio_get_file(cpio, &filename, &primary_initrd)) {
-		dlog("Unable to find initrd.img\n");
+	if (string_is_empty(filename)) {
+		memiter_init(&primary_initrd, NULL, 0);
+	} else if (!cpio_get_file(cpio, filename, &primary_initrd)) {
+		dlog("Unable to find primary initrd \"%s\".\n",
+		     string_data(filename));
 		return false;
 	}