[PATCH 5/5] pxe_utils: Support the SAY command

Simon Glass sjg at chromium.org
Fri Dec 20 05:01:20 CET 2024


This shows a message for the user. Implement it to keep the user
informed.

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

 boot/pxe_utils.c         | 13 +++++++++++++
 test/boot/bootflow.c     |  1 +
 test/py/tests/test_ut.py |  1 +
 3 files changed, 15 insertions(+)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 5d52a5965d6..5a8fbbe57ad 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -890,6 +890,7 @@ enum token_type {
 	T_BACKGROUND,
 	T_KASLRSEED,
 	T_FALLBACK,
+	T_SAY,
 	T_INVALID
 };
 
@@ -924,6 +925,7 @@ static const struct token keywords[] = {
 	{"background", T_BACKGROUND,},
 	{"kaslrseed", T_KASLRSEED,},
 	{"fallback", T_FALLBACK,},
+	{"say", T_SAY,},
 	{NULL, T_INVALID}
 };
 
@@ -1388,6 +1390,17 @@ static int parse_label(char **c, struct pxe_menu *cfg)
 		case T_EOL:
 			break;
 
+		case T_SAY: {
+			char *p = strchr(s, '\n');
+
+			if (p) {
+				printf("%.*s\n", (int)(p - *c) - 1, *c + 1);
+
+				*c = p;
+			}
+			break;
+		}
+
 		default:
 			/*
 			 * put the token back! we don't want it - it's the end
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c
index db1af0e5729..7675d632884 100644
--- a/test/boot/bootflow.c
+++ b/test/boot/bootflow.c
@@ -1536,6 +1536,7 @@ static int bootflow_extlinux_localboot(struct unit_test_state *uts)
 
 	/* read all the images, but don't actually boot */
 	ut_assertok(bootflow_read_all(bflow));
+	ut_assert_nextline("Doing local boot...");
 	ut_assert_nextline("1:\tlocal");
 	ut_assert_nextline("missing environment variable: localcmd");
 	ut_assert_nextline("Retrieving file: /vmlinuz");
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index b6b4717c834..89c765c0e6e 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -584,6 +584,7 @@ def setup_localboot_image(cons):
     script = '''DEFAULT local
 
 LABEL local
+  SAY Doing local boot...
   LOCALBOOT 0
 '''
     vmlinux = 'vmlinuz'
-- 
2.34.1



More information about the U-Boot mailing list