diff mbox series

[v3,15/19] bootstd: Update cros bootmeth to record images

Message ID 20241104175110.1048449-16-sjg@chromium.org
State Needs Review / ACK
Delegated to: Tom Rini
Headers show
Series bootstd: Support recording images | expand

Commit Message

Simon Glass Nov. 4, 2024, 5:51 p.m. UTC
Record images loaded by this bootmeth.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Use the helper function

Changes in v2:
- Update to use a new image-type enum in bootflow.h

 boot/bootmeth_cros.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c
index 1825293d93d..c7b862e512a 100644
--- a/boot/bootmeth_cros.c
+++ b/boot/bootmeth_cros.c
@@ -243,8 +243,17 @@  static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size,
 	ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline);
 	if (ret)
 		return log_msg_ret("cmd", ret);
+
+	if (!bootflow_img_add(bflow, "setup",
+			      (enum bootflow_img_t)IH_TYPE_X86_SETUP,
+			      setup, 0x3000))
+		return log_msg_ret("cri", -ENOMEM);
+
 	bflow->x86_setup = map_sysmem(setup, 0);
 
+	if (!bootflow_img_add(bflow, "cmdline", BFI_CMDLINE, cmdline, 0x1000))
+		return log_msg_ret("crc", -ENOMEM);
+
 	return 0;
 }
 
@@ -306,6 +315,11 @@  static int cros_read_info(struct bootflow *bflow, const char *uuid,
 	}
 	priv->info_buf = buf;
 
+	if (!bootflow_img_add(bflow, "kernel",
+			      (enum bootflow_img_t)IH_TYPE_KERNEL, 0,
+			      priv->body_size))
+		return log_msg_ret("crk", -ENOMEM);
+
 	return 0;
 }