aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-11-05 10:33:47 -0700
committerTom Rini <trini@konsulko.com>2020-12-04 16:10:01 -0500
commit1a62d64c7de7e7de3facf221eb8408ddfb675cb8 (patch)
treec65c0433b09af9dc2fe711112845273d2ed3975e /cmd
parent488d89afb88af5f148c7c7cf97ac382a0537b4f7 (diff)
downloadu-boot-1a62d64c7de7e7de3facf221eb8408ddfb675cb8.zip
u-boot-1a62d64c7de7e7de3facf221eb8408ddfb675cb8.tar.gz
u-boot-1a62d64c7de7e7de3facf221eb8408ddfb675cb8.tar.bz2
cli: Support macro processing with a fixed-size buffer
At present cli_simple_process_macros() requires that the caller provide an output buffer that is exactly CONFIG_SYS_CBSIZE bytes in length. This makes sense since it is designed to be used from the command line. But we also want to use it for bootargs substitution. Update the function to allow the caller to specify the buffer size. Also return an error if the buffer is exhausted. The caller can ignore that if preferred. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/pxe_utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index 235522f..b9d9a57 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -322,7 +322,8 @@ static int label_localboot(struct pxe_label *label)
if (label->append) {
char bootargs[CONFIG_SYS_CBSIZE];
- cli_simple_process_macros(label->append, bootargs);
+ cli_simple_process_macros(label->append, bootargs,
+ sizeof(bootargs));
env_set("bootargs", bootargs);
}
@@ -430,7 +431,8 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
strcat(bootargs, ip_str);
strcat(bootargs, mac_str);
- cli_simple_process_macros(bootargs, finalbootargs);
+ cli_simple_process_macros(bootargs, finalbootargs,
+ sizeof(finalbootargs));
env_set("bootargs", finalbootargs);
printf("append: %s\n", finalbootargs);
}