[PATCH] ARM: Allow for kernel command line concatenation

From: oskar.andero
Date: Fri Apr 08 2011 - 05:36:52 EST

From: Victor Boivie <victor.boivie@xxxxxxxxxxxxxxxx>

This patch allows the provided CONFIG_CMDLINE to be concatenated
with the one provided by the boot loader. This is useful to
merge the static values defined in CONFIG_CMDLINE with the
boot loader's (possibly) more dynamic values, such as startup
reasons and more.

Signed-off-by: Victor Boivie <victor.boivie@xxxxxxxxxxxxxxxx>
Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxxxx>
Signed-off-by: Oskar Andero <oskar.andero@xxxxxxxxxxxxxxxx>
Acked-by: Nicolas Pitre <nicolas.pitre@xxxxxxxxxx>
Acked-by: Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx>
arch/arm/Kconfig | 21 ++++++++++++++++++---
arch/arm/kernel/setup.c | 13 +++++++++----
2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b9f78b..fe34ed7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1743,16 +1743,31 @@ config CMDLINE
time by entering them here. As a minimum, you should specify the
memory size and the root device (e.g., mem=64M root=/dev/nfs).

+ prompt "Kernel command line type" if CMDLINE != ""
+ bool "Use bootloader kernel arguments if available"
+ help
+ Uses the command-line options passed by the boot loader. If
+ the boot loader doesn't provide any, the default kernel command
+ string provided in CMDLINE will be used.
+ bool "Extend bootloader kernel arguments"
+ help
+ The command-line arguments provided by the boot loader will be
+ appended to the default kernel command string.
bool "Always use the default kernel command string"
- depends on CMDLINE != ""
Always use the default kernel command string, even if the boot
loader passes other arguments to the kernel.
This is useful if you cannot or don't want to change the
command-line options your boot loader passes to the kernel.
- If unsure, say N.

bool "Kernel Execute-In-Place from ROM"
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 006c1e8..6dce209 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -672,11 +672,16 @@ __tagtable(ATAG_REVISION, parse_tag_revision);

static int __init parse_tag_cmdline(const struct tag *tag)
- strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
+ strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
+ strlcat(default_command_line, tag->u.cmdline.cmdline,
+#elif defined(CONFIG_CMDLINE_FORCE)
pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
+ strlcpy(default_command_line, tag->u.cmdline.cmdline,
return 0;


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/