bootm: Allow updating the bootargs in a buffer

At present we only support updating the 'bootargs' environment
variable. Add another function to update a buffer instead. This will
allow zimage to use this feature.

Also add a lot more tests to cover various cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-11-05 10:33:45 -07:00
committed by Tom Rini
parent b3c01678fd
commit 4448fe8e4e
3 changed files with 134 additions and 18 deletions

View File

@@ -542,6 +542,22 @@ static int fixup_silent_linux(char *buf, int maxlen)
return 0;
}
int bootm_process_cmdline(char *buf, int maxlen, int flags)
{
int ret;
/* Check config first to enable compiler to eliminate code */
if (IS_ENABLED(CONFIG_SILENT_CONSOLE) &&
!IS_ENABLED(CONFIG_SILENT_U_BOOT_ONLY) &&
(flags & BOOTM_CL_SILENT)) {
ret = fixup_silent_linux(buf, maxlen);
if (ret)
return log_msg_ret("silent", ret);
}
return 0;
}
int bootm_process_cmdline_env(int flags)
{
const int maxlen = MAX_CMDLINE_SIZE;
@@ -566,7 +582,7 @@ int bootm_process_cmdline_env(int flags)
strcpy(buf, env);
else
*buf = '\0';
ret = fixup_silent_linux(buf, maxlen);
ret = bootm_process_cmdline(buf, maxlen, flags);
if (!ret) {
ret = env_set("bootargs", buf);