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/inc/hf/boot_flow.h b/inc/hf/boot_flow.h
index 3ecf25f..3307fb0 100644
--- a/inc/hf/boot_flow.h
+++ b/inc/hf/boot_flow.h
@@ -26,5 +26,6 @@
struct mpool *ppool);
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);
diff --git a/inc/hf/cpio.h b/inc/hf/cpio.h
index d67f8d4..aebe1d5 100644
--- a/inc/hf/cpio.h
+++ b/inc/hf/cpio.h
@@ -17,7 +17,6 @@
#pragma once
#include <stdbool.h>
-#include <stddef.h>
#include "hf/memiter.h"
#include "hf/string.h"
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
index 23689d9..3e9f76f 100644
--- a/inc/hf/manifest.h
+++ b/inc/hf/manifest.h
@@ -29,11 +29,17 @@
struct string debug_name;
struct string kernel_filename;
- /* Properties specific to secondary VMs. */
- struct {
- uint64_t mem_size;
- spci_vcpu_count_t vcpu_count;
- } secondary;
+ union {
+ /* Properties specific to the primary VM. */
+ struct {
+ struct string ramdisk_filename;
+ } primary;
+ /* Properties specific to secondary VMs. */
+ struct {
+ uint64_t mem_size;
+ spci_vcpu_count_t vcpu_count;
+ } secondary;
+ };
};
/**
diff --git a/inc/hf/plat/boot_flow.h b/inc/hf/plat/boot_flow.h
index 5a6b02b..b5d8145 100644
--- a/inc/hf/plat/boot_flow.h
+++ b/inc/hf/plat/boot_flow.h
@@ -19,6 +19,7 @@
#include "hf/addr.h"
#include "hf/boot_params.h"
#include "hf/fdt.h"
+#include "hf/manifest.h"
#include "hf/memiter.h"
#include "hf/mm.h"
@@ -27,5 +28,6 @@
bool plat_boot_flow_get_initrd_range(const struct fdt_node *fdt_root,
paddr_t *begin, paddr_t *end);
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);