[PATCH v2 27/31] boot: Update pxe bootmeth to record images

Simon Glass sjg at chromium.org
Sat Oct 19 17:22:07 CEST 2024


Record images loaded by this bootmeth.

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

(no changes since v1)

 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 b2873075ba5..d7b30d1c745 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