ARM: 6893/1: Allow for kernel command line concatenation
authorVictor Boivie <victor.boivie@sonyericsson.com>
Wed, 4 May 2011 16:07:55 +0000 (17:07 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 12 May 2011 09:13:22 +0000 (10:13 +0100)
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@sonyericsson.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@sonyericsson.com>
Signed-off-by: Oskar Andero <oskar.andero@sonyericsson.com>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/Kconfig
arch/arm/kernel/setup.c

index 3f3faaa55d81e1a1639a0c7cdfd9f127213c76b1..7fd33a337130d696b5cf71d00b2044a861a2968a 100644 (file)
@@ -1747,16 +1747,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).
 
+choice
+       prompt "Kernel command line type" if CMDLINE != ""
+       default CMDLINE_FROM_BOOTLOADER
+
+config CMDLINE_FROM_BOOTLOADER
+       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.
+
+config CMDLINE_EXTEND
+       bool "Extend bootloader kernel arguments"
+       help
+         The command-line arguments provided by the boot loader will be
+         appended to the default kernel command string.
+
 config CMDLINE_FORCE
        bool "Always use the default kernel command string"
-       depends on CMDLINE != ""
        help
          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.
+endchoice
 
 config XIP_KERNEL
        bool "Kernel Execute-In-Place from ROM"
index 006c1e884eafedbbfab80caf6a53f3c24fc47a10..6dce209a623b2a0bee4fc3665c1f1ca8dd559d5a 100644 (file)
@@ -672,11 +672,16 @@ __tagtable(ATAG_REVISION, parse_tag_revision);
 
 static int __init parse_tag_cmdline(const struct tag *tag)
 {
-#ifndef CONFIG_CMDLINE_FORCE
-       strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
-#else
+#if defined(CONFIG_CMDLINE_EXTEND)
+       strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
+       strlcat(default_command_line, tag->u.cmdline.cmdline,
+               COMMAND_LINE_SIZE);
+#elif defined(CONFIG_CMDLINE_FORCE)
        pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
-#endif /* CONFIG_CMDLINE_FORCE */
+#else
+       strlcpy(default_command_line, tag->u.cmdline.cmdline,
+               COMMAND_LINE_SIZE);
+#endif
        return 0;
 }