mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
fdt: Add support for the CONFIG_CMDLINE_EXTEND option
This commit is contained in:
@@ -915,19 +915,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
|
|||||||
|
|
||||||
/* Retrieve command line */
|
/* Retrieve command line */
|
||||||
p = of_get_flat_dt_prop(node, "bootargs", &l);
|
p = of_get_flat_dt_prop(node, "bootargs", &l);
|
||||||
if (p != NULL && l > 0)
|
|
||||||
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CONFIG_CMDLINE is meant to be a default in case nothing else
|
* CONFIG_CMDLINE is meant to be a default in case nothing else
|
||||||
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
|
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
|
||||||
* is set in which case we override whatever was found earlier.
|
* is set in which case we override whatever was found earlier.
|
||||||
|
*
|
||||||
|
* However, it can be useful to be able to treat the default as
|
||||||
|
* a starting point to be extended using CONFIG_CMDLINE_EXTEND.
|
||||||
*/
|
*/
|
||||||
|
((char *)data)[0] = '\0';
|
||||||
|
|
||||||
#ifdef CONFIG_CMDLINE
|
#ifdef CONFIG_CMDLINE
|
||||||
#ifndef CONFIG_CMDLINE_FORCE
|
strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
|
||||||
if (!((char *)data)[0])
|
|
||||||
|
if (p != NULL && l > 0) {
|
||||||
|
#if defined(CONFIG_CMDLINE_EXTEND)
|
||||||
|
int len = strlen(data);
|
||||||
|
if (len > 0) {
|
||||||
|
strlcat(data, " ", COMMAND_LINE_SIZE);
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
strlcpy((char *)data + len, p, min((int)l, COMMAND_LINE_SIZE - len));
|
||||||
|
#elif defined(CONFIG_CMDLINE_FORCE)
|
||||||
|
pr_warning("Ignoring bootargs property (using the default kernel command line)\n");
|
||||||
|
#else
|
||||||
|
/* Neither extend nor force - just override */
|
||||||
|
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
|
||||||
#endif
|
#endif
|
||||||
strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
|
}
|
||||||
|
#else /* CONFIG_CMDLINE */
|
||||||
|
if (p != NULL && l > 0) {
|
||||||
|
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
|
||||||
#endif /* CONFIG_CMDLINE */
|
#endif /* CONFIG_CMDLINE */
|
||||||
|
|
||||||
pr_debug("Command line is: %s\n", (char*)data);
|
pr_debug("Command line is: %s\n", (char*)data);
|
||||||
|
|||||||
Reference in New Issue
Block a user