}
#define CONSOLE_ARG "console="
-#define CONSOLE_ARG_SIZE sizeof(CONSOLE_ARG)
+#define NULL_CONSOLE (CONSOLE_ARG "ttynull")
+#define CONSOLE_ARG_SIZE sizeof(NULL_CONSOLE)
/**
* fixup_silent_linux() - Handle silencing the linux boot if required
char *end = strchr(start, ' ');
int start_bytes;
- start_bytes = start - cmdline + CONSOLE_ARG_SIZE - 1;
+ start_bytes = start - cmdline;
strncpy(buf, cmdline, start_bytes);
+ strncpy(buf + start_bytes, NULL_CONSOLE, CONSOLE_ARG_SIZE);
if (end)
- strcpy(buf + start_bytes, end);
+ strcpy(buf + start_bytes + CONSOLE_ARG_SIZE - 1, end);
else
- buf[start_bytes] = '\0';
+ buf[start_bytes + CONSOLE_ARG_SIZE] = '\0';
} else {
- sprintf(buf, "%s %s", cmdline, CONSOLE_ARG);
+ sprintf(buf, "%s %s", cmdline, NULL_CONSOLE);
}
if (buf + strlen(buf) >= cmdline)
return -ENOSPC;
} else {
- if (maxlen < sizeof(CONSOLE_ARG))
+ if (maxlen < CONSOLE_ARG_SIZE)
return -ENOSPC;
- strcpy(buf, CONSOLE_ARG);
+ strcpy(buf, NULL_CONSOLE);
}
debug("after silent fix-up: %s\n", buf);
ut_assertok(env_set("silent_linux", "yes"));
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
- ut_asserteq_str("console=", buf);
+ ut_asserteq_str("console=ttynull", buf);
/* Empty buffer should still add the string */
*buf = '\0';
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
- ut_asserteq_str("console=", buf);
+ ut_asserteq_str("console=ttynull", buf);
/* Check nothing happens when do_silent is false */
*buf = '\0';
/* Not enough space */
*buf = '\0';
- ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 8, BOOTM_CL_SILENT));
+ ut_asserteq(-ENOSPC, bootm_process_cmdline(buf, 15, BOOTM_CL_SILENT));
/* Just enough space */
*buf = '\0';
- ut_assertok(bootm_process_cmdline(buf, 9, BOOTM_CL_SILENT));
+ ut_assertok(bootm_process_cmdline(buf, 16, BOOTM_CL_SILENT));
/* add at end */
strcpy(buf, "something");
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
- ut_asserteq_str("something console=", buf);
+ ut_asserteq_str("something console=ttynull", buf);
/* change at start */
strcpy(buf, CONSOLE_STR " something");
ut_assertok(bootm_process_cmdline(buf, BUF_SIZE, BOOTM_CL_SILENT));
- ut_asserteq_str("console= something", buf);
+ ut_asserteq_str("console=ttynull something", buf);
return 0;
}
{
env_set("bootargs", NULL);
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_SILENT));
- ut_asserteq_str("console=", env_get("bootargs"));
+ ut_asserteq_str("console=ttynull", env_get("bootargs"));
ut_assertok(env_set("var", "abc"));
ut_assertok(env_set("bootargs", "some${var}thing"));
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_SILENT));
- ut_asserteq_str("some${var}thing console=", env_get("bootargs"));
+ ut_asserteq_str("some${var}thing console=ttynull", env_get("bootargs"));
return 0;
}
ut_assertok(env_set("silent_linux", "yes"));
env_set("bootargs", NULL);
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_ALL));
- ut_asserteq_str("console=", env_get("bootargs"));
+ ut_asserteq_str("console=ttynull", env_get("bootargs"));
ut_assertok(env_set("bootargs", "some${var}thing " CONSOLE_STR));
ut_assertok(env_set("var", "1234567890"));
ut_assertok(bootm_process_cmdline_env(BOOTM_CL_ALL));
- ut_asserteq_str("some1234567890thing console=", env_get("bootargs"));
+ ut_asserteq_str("some1234567890thing console=ttynull", env_get("bootargs"));
return 0;
}