[PATCH 30/34] boot: Update pxe bootmeth to record images

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


Record images loaded by this bootmeth.

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

 boot/bootmeth_pxe.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c
index 0643d280f21..3e5008ab317 100644
--- a/boot/bootmeth_pxe.c
+++ b/boot/bootmeth_pxe.c
@@ -118,7 +118,8 @@ static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow,
 {
 	char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
 	struct pxe_context *ctx = dev_get_priv(dev);
-	char file_addr[17];
+	char file_addr[17], *fname;
+	struct bootflow_img *img;
 	ulong size;
 	int ret;
 
@@ -135,6 +136,17 @@ static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow,
 		return log_msg_ret("spc", -ENOSPC);
 	*sizep = size;
 
+	fname = strdup(file_path);
+	if (!fname)
+		return log_msg_ret("pxf", -ENOMEM);
+	img = alist_add_placeholder(&bflow->images);
+	if (!img)
+		return log_msg_ret("pxi", -ENOMEM);
+	img->fname = fname;
+	img->type = type;
+	img->addr = addr;
+	img->size = size;
+
 	return 0;
 }
 
-- 
2.34.1



More information about the U-Boot mailing list