linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <oskar.andero@sonyericsson.com>
To: <u.kleine-koenig@pengutronix.de>, <pebolle@tiscali.nl>
Cc: <nicolas.pitre@linaro.org>, <linux@arm.linux.org.uk>,
	<catalin.marinas@arm.com>, <will.deacon@arm.com>,
	<linux-kernel@vger.kernel.org>, <eric.y.miao@gmail.com>,
	<linux-arm-kernel@lists.infradead.org>,
	Victor Boivie <victor.boivie@sonyericsson.com>,
	Oskar Andero <oskar.andero@sonyericsson.com>
Subject: [PATCH] ARM: Allow for kernel command line concatenation
Date: Thu, 7 Apr 2011 13:47:36 +0200	[thread overview]
Message-ID: <1302176856-16265-1-git-send-email-oskar.andero@sonyericsson.com> (raw)

From: Victor Boivie <victor.boivie@sonyericsson.com>

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>
---
 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..704b73c 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).
 
+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 default kernel command string will be concatenated with the
+	  arguments provided by the boot loader.
+
 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"
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)
 {
-#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;
 }
 
-- 
1.7.4.2


             reply	other threads:[~2011-04-07 11:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-07 11:47 oskar.andero [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-08  9:36 [PATCH] ARM: Allow for kernel command line concatenation oskar.andero
2011-05-04 15:03 ` oskar.andero
2011-05-04 15:11   ` Uwe Kleine-König
2011-05-04 16:10     ` oskar.andero
2011-04-07 13:29 oskar.andero
2011-04-07 18:50 ` Nicolas Pitre
2011-04-07 19:15 ` Uwe Kleine-König
2011-04-07  8:17 oskar.andero
2011-04-07  9:01 ` Uwe Kleine-König
2011-04-07 10:35 ` Paul Bolle
2011-04-07 10:58   ` Uwe Kleine-König
2011-04-07 11:38     ` Boivie, Victor
2011-04-07 13:18 ` Nick Bowler
2011-04-07 13:22   ` Boivie, Victor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302176856-16265-1-git-send-email-oskar.andero@sonyericsson.com \
    --to=oskar.andero@sonyericsson.com \
    --cc=catalin.marinas@arm.com \
    --cc=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --cc=pebolle@tiscali.nl \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=victor.boivie@sonyericsson.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).