#define CONSOLE_ARG "console="
#define CONSOLE_ARG_LEN (sizeof(CONSOLE_ARG) - 1)
-int bootm_process_cmdline_env(void)
+int bootm_process_cmdline_env(bool do_silent)
{
char *buf;
const char *env_val;
char *cmdline;
int want_silent;
- if (!IS_ENABLED(CONFIG_SILENT_CONSOLE) &&
- !IS_ENABLED(CONFIG_SILENT_U_BOOT_ONLY))
+ /* First check if any action is needed */
+ do_silent = IS_ENABLED(CONFIG_SILENT_CONSOLE) &&
+ !IS_ENABLED(CONFIG_SILENT_U_BOOT_ONLY) && do_silent;
+ if (!do_silent)
return 0;
cmdline = env_get("bootargs");
if (!ret && (states & BOOTM_STATE_OS_BD_T))
ret = boot_fn(BOOTM_STATE_OS_BD_T, argc, argv, images);
if (!ret && (states & BOOTM_STATE_OS_PREP)) {
- if (images->os.os == IH_OS_LINUX) {
- ret = bootm_process_cmdline_env();
- if (ret) {
- printf("Cmdline setup failed (err=%d)\n", ret);
- ret = CMD_RET_FAILURE;
- goto err;
- }
+ ret = bootm_process_cmdline_env(images->os.os == IH_OS_LINUX);
+ if (ret) {
+ printf("Cmdline setup failed (err=%d)\n", ret);
+ ret = CMD_RET_FAILURE;
+ goto err;
}
ret = boot_fn(BOOTM_STATE_OS_PREP, argc, argv, images);
}
* Updates the 'bootargs' envvar as required. This handles making Linux boot
* silently if requested ('silent_linux' envvar)
*
+ * @do_silent: Process bootargs for silent console
* @return 0 if OK, -ENOMEM if out of memory
*/
-int bootm_process_cmdline_env(void);
+int bootm_process_cmdline_env(bool do_silent);
#endif
/* 'silent_linux' not set should do nothing */
env_set("silent_linux", NULL);
env_set("bootargs", CONSOLE_STR);
- ut_assertok(bootm_process_cmdline_env());
+ ut_assertok(bootm_process_cmdline_env(true));
ut_asserteq_str(CONSOLE_STR, env_get("bootargs"));
env_set("bootargs", NULL);
- ut_assertok(bootm_process_cmdline_env());
+ ut_assertok(bootm_process_cmdline_env(true));
ut_assertnull(env_get("bootargs"));
ut_assertok(env_set("silent_linux", "no"));
env_set("bootargs", CONSOLE_STR);
- ut_assertok(bootm_process_cmdline_env());
+ ut_assertok(bootm_process_cmdline_env(true));
ut_asserteq_str(CONSOLE_STR, env_get("bootargs"));
ut_assertok(env_set("silent_linux", "yes"));
env_set("bootargs", CONSOLE_STR);
- ut_assertok(bootm_process_cmdline_env());
+ ut_assertok(bootm_process_cmdline_env(true));
ut_asserteq_str("console=", env_get("bootargs"));
/* Empty buffer should still add the string */
env_set("bootargs", NULL);
- ut_assertok(bootm_process_cmdline_env());
+ ut_assertok(bootm_process_cmdline_env(true));
ut_asserteq_str("console=", env_get("bootargs"));
return 0;