| From: Daniel Walker <danielwa@cisco.com> |
| Subject: drivers: of: generic command line support |
| |
| This adds support for the generic command line implementation into the |
| device tree code. This allows some platforms to use the original |
| CONFIG_CMDLINE implementation, but powerpc platforms can used the newer |
| generic command line code. As platforms support the generic command line |
| code they can simply add "select GENERIC_CMDLINE" and delete their |
| Kconfig options for the current CMDLINE. |
| |
| Link: http://lkml.kernel.org/r/20190319232448.45964-3-danielwa@cisco.com |
| Signed-off-by: Daniel Walker <danielwa@cisco.com> |
| Cc: Christophe Leroy <christophe.leroy@c-s.fr> |
| Cc: Michael Ellerman <mpe@ellerman.id.au> |
| Cc: Frank Rowand <frowand.list@gmail.com> |
| Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
| Cc: Daniel Walker <dwalker@fifo99.com> |
| Cc: Maksym Kokhan <maksym.kokhan@globallogic.com> |
| Cc: Paul Mackerras <paulus@samba.org> |
| Cc: Rob Herring <robh+dt@kernel.org> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| |
| --- a/drivers/of/fdt.c~drivers-of-generic-command-line-support |
| +++ a/drivers/of/fdt.c |
| @@ -24,6 +24,7 @@ |
| #include <linux/debugfs.h> |
| #include <linux/serial_core.h> |
| #include <linux/sysfs.h> |
| +#include <linux/cmdline.h> |
| |
| #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ |
| #include <asm/page.h> |
| @@ -1098,7 +1099,7 @@ int __init early_init_dt_scan_chosen(uns |
| * managed to set the command line, unless CONFIG_CMDLINE_FORCE |
| * is set in which case we override whatever was found earlier. |
| */ |
| -#ifdef CONFIG_CMDLINE |
| +#if defined(CONFIG_CMDLINE) && !defined(CONFIG_GENERIC_CMDLINE) |
| #if defined(CONFIG_CMDLINE_EXTEND) |
| strlcat(data, " ", COMMAND_LINE_SIZE); |
| strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); |
| @@ -1109,7 +1110,12 @@ int __init early_init_dt_scan_chosen(uns |
| if (!((char *)data)[0]) |
| strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); |
| #endif |
| -#endif /* CONFIG_CMDLINE */ |
| +#endif /* CONFIG_CMDLINE && !CONFIG_GENERIC_CMDLINE */ |
| + |
| + /* append and prepend any arguments built into the kernel via |
| + * generic cmdline. |
| + */ |
| + cmdline_add_builtin(data, NULL, COMMAND_LINE_SIZE); |
| |
| pr_debug("Command line is: %s\n", (char*)data); |
| |
| _ |