pxe_utils: Support the SAY command

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

Series-to: u-boot
pxe: Support an automatic localboot
It seems that extlinux expects that boards know how to boot a local OS
from attached media. U-Boot currently assumes that boards define a
"localcmd" environment variable to support this. None does.

Provide an automatic means to find a kernel and ramdisk, using common
filenames. This addresses booting on MAAS, at least.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Simon Glass
2024-12-19 21:01:20 -07:00
parent de881bfad7
commit 7a37413818
3 changed files with 15 additions and 0 deletions

View File

@@ -891,6 +891,7 @@ enum token_type {
T_BACKGROUND,
T_KASLRSEED,
T_FALLBACK,
T_SAY,
T_INVALID
};
@@ -925,6 +926,7 @@ static const struct token keywords[] = {
{"background", T_BACKGROUND,},
{"kaslrseed", T_KASLRSEED,},
{"fallback", T_FALLBACK,},
{"say", T_SAY,},
{NULL, T_INVALID}
};
@@ -1389,6 +1391,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

View File

@@ -1645,6 +1645,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");

View File

@@ -621,6 +621,7 @@ def setup_localboot_image(cons):
script = '''DEFAULT local
LABEL local
SAY Doing local boot...
LOCALBOOT 0
'''
vmlinux = 'vmlinuz'