diff options
author | Dmitri Vorobiev <dmitri.vorobiev@movial.com> | 2009-11-21 15:34:41 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:35 -0500 |
commit | 6acc7d485c24c00e111c61b2e6dff9180faebcae (patch) | |
tree | 7c7519153775b20a87ff1a4745d16b0f1369861a /arch/mips/kernel/setup.c | |
parent | de4148f3ef54b644a181ad75a6fb4b373f2b01f0 (diff) |
MIPS: Fix and enhance built-in kernel command line
Currently, MIPS kernels silently overwrite kernel command-line parameters
hardcoded in CONFIG_CMDLINE by the ones received from firmware. Therefore,
using firmware remains the only reliable method to transfer the
command-line parameters, which is not always desirable or convenient, and
the CONFIG_CMDLINE option is thereby effectively rendered useless.
This patch fixes the problem described above and introduces a more flexible
scheme of handling the kernel command line, in a manner identical to what is
currently used for x86. The default behavior, i.e. when CONFIG_CMDLINE_BOOL
is not defined, retains the existing semantics, and firmware command-line
arguments override the hardcoded ones.
[Ralf: I fixed up all the defconfig files so the stay unaffected by this
change.]
Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/689/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r-- | arch/mips/kernel/setup.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index bd55f71055ba..f9513f9e61d3 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -58,8 +58,12 @@ EXPORT_SYMBOL(mips_machtype); | |||
58 | 58 | ||
59 | struct boot_mem_map boot_mem_map; | 59 | struct boot_mem_map boot_mem_map; |
60 | 60 | ||
61 | static char command_line[COMMAND_LINE_SIZE]; | 61 | static char __initdata command_line[COMMAND_LINE_SIZE]; |
62 | char arcs_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; | 62 | char __initdata arcs_cmdline[COMMAND_LINE_SIZE]; |
63 | |||
64 | #ifdef CONFIG_CMDLINE_BOOL | ||
65 | static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; | ||
66 | #endif | ||
63 | 67 | ||
64 | /* | 68 | /* |
65 | * mips_io_port_base is the begin of the address space to which x86 style | 69 | * mips_io_port_base is the begin of the address space to which x86 style |
@@ -458,8 +462,20 @@ static void __init arch_mem_init(char **cmdline_p) | |||
458 | pr_info("Determined physical RAM map:\n"); | 462 | pr_info("Determined physical RAM map:\n"); |
459 | print_memory_map(); | 463 | print_memory_map(); |
460 | 464 | ||
461 | strlcpy(command_line, arcs_cmdline, sizeof(command_line)); | 465 | #ifdef CONFIG_CMDLINE_BOOL |
462 | strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | 466 | #ifdef CONFIG_CMDLINE_OVERRIDE |
467 | strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); | ||
468 | #else | ||
469 | if (builtin_cmdline[0]) { | ||
470 | strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); | ||
471 | strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE); | ||
472 | } | ||
473 | strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); | ||
474 | #endif | ||
475 | #else | ||
476 | strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); | ||
477 | #endif | ||
478 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | ||
463 | 479 | ||
464 | *cmdline_p = command_line; | 480 | *cmdline_p = command_line; |
465 | 481 | ||