sh: Allow for kernel command line concatenation.
So far kernel command line arguments could be passed in by a bootloader or defined as CONFIG_CMDLINE, which completely overwriting the first one. This change allows a developer to declare selected kernel parameters in a kernel configuration (eg. project-specific defconfig), retaining possibility of passing others by a bootloader. The obvious examples of the first type are MTD partition or bigphysarea-like region definitions, while "debug" option or network configuration should be given by a bootloader or a JTAG boot script. Signed-off-by: Pawel Moll <pawel.moll@st.com> Signed-off-by: Stuart Menefy <stuart.menefy@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
b46373e0d4
commit
d724a9c9d5
2 changed files with 28 additions and 5 deletions
|
@ -767,12 +767,31 @@ config UBC_WAKEUP
|
||||||
|
|
||||||
If unsure, say N.
|
If unsure, say N.
|
||||||
|
|
||||||
config CMDLINE_BOOL
|
choice
|
||||||
bool "Default bootloader kernel arguments"
|
prompt "Kernel command line"
|
||||||
|
optional
|
||||||
|
default CMDLINE_OVERWRITE
|
||||||
|
help
|
||||||
|
Setting this option allows the kernel command line arguments
|
||||||
|
to be set.
|
||||||
|
|
||||||
|
config CMDLINE_OVERWRITE
|
||||||
|
bool "Overwrite bootloader kernel arguments"
|
||||||
|
help
|
||||||
|
Given string will overwrite any arguments passed in by
|
||||||
|
a bootloader.
|
||||||
|
|
||||||
|
config CMDLINE_EXTEND
|
||||||
|
bool "Extend bootloader kernel arguments"
|
||||||
|
help
|
||||||
|
Given string will be concatenated with arguments passed in
|
||||||
|
by a bootloader.
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
config CMDLINE
|
config CMDLINE
|
||||||
string "Initial kernel command string"
|
string "Kernel command line arguments string"
|
||||||
depends on CMDLINE_BOOL
|
depends on CMDLINE_OVERWRITE || CMDLINE_EXTEND
|
||||||
default "console=ttySC1,115200"
|
default "console=ttySC1,115200"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -404,10 +404,14 @@ void __init setup_arch(char **cmdline_p)
|
||||||
if (!memory_end)
|
if (!memory_end)
|
||||||
memory_end = memory_start + __MEMORY_SIZE;
|
memory_end = memory_start + __MEMORY_SIZE;
|
||||||
|
|
||||||
#ifdef CONFIG_CMDLINE_BOOL
|
#ifdef CONFIG_CMDLINE_OVERWRITE
|
||||||
strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
|
strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
|
||||||
#else
|
#else
|
||||||
strlcpy(command_line, COMMAND_LINE, sizeof(command_line));
|
strlcpy(command_line, COMMAND_LINE, sizeof(command_line));
|
||||||
|
#ifdef CONFIG_CMDLINE_EXTEND
|
||||||
|
strlcat(command_line, " ", sizeof(command_line));
|
||||||
|
strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Save unparsed command line copy for /proc/cmdline */
|
/* Save unparsed command line copy for /proc/cmdline */
|
||||||
|
|
Reference in a new issue