[PATCH 33/34] bootstd: Update cros bootmeth to record images

Simon Glass sjg at chromium.org
Fri Oct 18 01:24:12 CEST 2024


Record images loaded by this bootmeth.

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

 boot/bootmeth_cros.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c
index 3e60fd5da07..10aefe046ca 100644
--- a/boot/bootmeth_cros.c
+++ b/boot/bootmeth_cros.c
@@ -206,6 +206,7 @@ static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size,
 {
 	struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
 	ulong base, setup, cmdline, kern_base;
+	struct bootflow_img img;
 	ulong num_blks;
 	int ret;
 
@@ -243,8 +244,27 @@ 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);
+
+	img.fname = strdup("setup");
+	if (!img.fname)
+		return log_msg_ret("cri", -ENOMEM);
+	img.type = IH_TYPE_X86_SETUP;
+	img.addr = setup;
+	img.size = 0x3000;
+	if (!alist_add(&bflow->images, img))
+		return log_msg_ret("cri", -ENOMEM);
+
 	bflow->x86_setup = map_sysmem(setup, 0);
 
+	img.fname = strdup("cmdline");
+	if (!img.fname)
+		return log_msg_ret("cri", -ENOMEM);
+	img.type = IH_TYPE_CMDLINE;
+	img.addr = cmdline;
+	img.size = 0x1000;
+	if (!alist_add(&bflow->images, img))
+		return log_msg_ret("cri", -ENOMEM);
+
 	return 0;
 }
 
@@ -263,6 +283,7 @@ static int cros_read_info(struct bootflow *bflow, const char *uuid,
 	struct udevice *blk = bflow->blk;
 	struct blk_desc *desc = dev_get_uclass_plat(blk);
 	ulong offset, size, before_base;
+	struct bootflow_img img;
 	void *buf;
 	int ret;
 
@@ -306,6 +327,15 @@ static int cros_read_info(struct bootflow *bflow, const char *uuid,
 	}
 	priv->info_buf = buf;
 
+	img.fname = strdup("kernel");
+	if (!img.fname)
+		return log_msg_ret("cri", -ENOMEM);
+	img.type = IH_TYPE_KERNEL;
+	img.addr = 0;
+	img.size = priv->body_size;
+	if (!alist_add(&bflow->images, img))
+		return log_msg_ret("cri", -ENOMEM);
+
 	return 0;
 }
 
-- 
2.34.1



More information about the U-Boot mailing list