aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass2021-10-14 12:48:03 -0600
committerTom Rini2021-11-11 19:02:27 -0500
commit9e62e7ca543ea94a46f30053262f67202e2435f4 (patch)
tree9488e089c17fb5836b8a3157e8fee5dbe26cb097 /boot
parent929860bfbb3bb3d1bed1f5cbb8af8fbe8e5460a7 (diff)
pxe: Move common parsing coding into pxe_util
Both the syslinux and pxe commands use essentially the same code to parse and run extlinux.conf files. Move this into a common function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'boot')
-rw-r--r--boot/pxe_utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 6ecd15ceada..f40ad2b161e 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -1505,3 +1505,23 @@ void pxe_setup_ctx(struct pxe_context *ctx, struct cmd_tbl *cmdtp,
ctx->userdata = userdata;
ctx->allow_abs_path = allow_abs_path;
}
+
+int pxe_process(struct pxe_context *ctx, ulong pxefile_addr_r, bool prompt)
+{
+ struct pxe_menu *cfg;
+
+ cfg = parse_pxefile(ctx, pxefile_addr_r);
+ if (!cfg) {
+ printf("Error parsing config file\n");
+ return 1;
+ }
+
+ if (prompt)
+ cfg->prompt = 1;
+
+ handle_pxe_menu(ctx, cfg);
+
+ destroy_pxe_menu(cfg);
+
+ return 0;
+}