Move manifest to initrd

Supporting the manifest as part of FDT is problematic for testing
under the Android boot flow because it requires compiling and flashing
a different Hafnium image per test suite. Moving it back to the initrd
allows us to run different test suites against the same Hafnium image,
only by swapping the RAM disks.

Hafnium's one_time_init() routine will now expect to find the manifest
under "manifest.dtb".

Change-Id: Ifabffb50b06ffaba786046733d575adc9d43f4ad
diff --git a/src/manifest.c b/src/manifest.c
index d574e55..93560c5 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -306,9 +306,10 @@
  * Parse manifest from FDT.
  */
 enum manifest_return_code manifest_init(struct manifest *manifest,
-					const struct fdt_node *fdt_root)
+					struct memiter *manifest_fdt)
 {
 	char vm_name_buf[VM_NAME_BUF_SIZE];
+	const struct fdt_header *fdt;
 	struct fdt_node hyp_node;
 	struct stringlist_iter compatible_list;
 	size_t i = 0;
@@ -316,8 +317,18 @@
 
 	memset_s(manifest, sizeof(*manifest), 0, sizeof(*manifest));
 
+	fdt = (const struct fdt_header *)memiter_base(manifest_fdt);
+	if (memiter_size(manifest_fdt) != fdt_total_size(fdt)) {
+		return MANIFEST_ERROR_FILE_SIZE;
+	}
+
 	/* Find hypervisor node. */
-	hyp_node = *fdt_root;
+	if (!fdt_root_node(&hyp_node, fdt)) {
+		return MANIFEST_ERROR_NO_ROOT_NODE;
+	}
+	if (!fdt_find_child(&hyp_node, "")) {
+		return MANIFEST_ERROR_NO_ROOT_NODE;
+	}
 	if (!fdt_find_child(&hyp_node, "hypervisor")) {
 		return MANIFEST_ERROR_NO_HYPERVISOR_FDT_NODE;
 	}
@@ -374,6 +385,10 @@
 	switch (ret_code) {
 	case MANIFEST_SUCCESS:
 		return "Success";
+	case MANIFEST_ERROR_FILE_SIZE:
+		return "Total size in header does not match file size";
+	case MANIFEST_ERROR_NO_ROOT_NODE:
+		return "Could not find root node in manifest";
 	case MANIFEST_ERROR_NO_HYPERVISOR_FDT_NODE:
 		return "Could not find \"hypervisor\" node in manifest";
 	case MANIFEST_ERROR_NOT_COMPATIBLE: