summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-11-05 20:33:45 +0300
committerTom Rini <trini@konsulko.com>2020-12-05 00:09:26 +0300
commit4448fe8e4e7cc4dc5336a2d27fa6048057eaf1a6 (patch)
tree4a80588ef8fb03a002a6112b9cd7ed3bf0b5b027 /common
parentb3c01678fdb15c63b231743481b9b77c7c4f8549 (diff)
downloadu-boot-4448fe8e4e7cc4dc5336a2d27fa6048057eaf1a6.tar.xz
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>
Diffstat (limited to 'common')
-rw-r--r--common/bootm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/common/bootm.c b/common/bootm.c
index 912ed906ef..020449db3f 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -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);