linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: Allow for kernel command line concatenation
@ 2011-04-07  8:17 oskar.andero
  2011-04-07  9:01 ` Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: oskar.andero @ 2011-04-07  8:17 UTC (permalink / raw)
  To: linux
  Cc: nicolas.pitre, will.deacon, eric.y.miao, catalin.marinas,
	linux-arm-kernel, linux-kernel, Victor Boivie, Oskar Andero

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 |    9 ++++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b9f78b..71b35e6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1743,6 +1743,24 @@ 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"
+	default CMDLINE_DEFAULT
+
+config CMDLINE_DEFAULT
+	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"
+	depends on CMDLINE != ""
+	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 != ""
@@ -1751,8 +1769,7 @@ config CMDLINE_FORCE
 	  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..465bc7e 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -673,7 +673,14 @@ __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);
+#ifdef CONFIG_CMDLINE_EXTEND
+	strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
+	strlcat(default_command_line, tag->u.cmdline.cmdline,
+		COMMAND_LINE_SIZE);
+#else
+	strlcpy(default_command_line, tag->u.cmdline.cmdline,
+		COMMAND_LINE_SIZE);
+#endif
 #else
 	pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
 #endif /* CONFIG_CMDLINE_FORCE */
-- 
1.7.4.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07  8:17 [PATCH] ARM: Allow for kernel command line concatenation oskar.andero
@ 2011-04-07  9:01 ` Uwe Kleine-König
  2011-04-07 10:35 ` Paul Bolle
  2011-04-07 13:18 ` Nick Bowler
  2 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2011-04-07  9:01 UTC (permalink / raw)
  To: oskar.andero
  Cc: linux, nicolas.pitre, eric.y.miao, catalin.marinas, will.deacon,
	linux-kernel, linux-arm-kernel, Victor Boivie

On Thu, Apr 07, 2011 at 10:17:16AM +0200, oskar.andero@sonyericsson.com wrote:
> 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 |    9 ++++++++-
>  2 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 5b9f78b..71b35e6 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1743,6 +1743,24 @@ 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"
> +	default CMDLINE_DEFAULT
I'm not sure this works, but maybe use:

	choice
		prompt "Kernel command line type" if CMDLINE != ""
		default CMDLINE_DEFAULT

and then remove the explicit

	depends on CMDLINE != ""

from the options. This might hide the choice from the user if there is
only a single option to choose.

Best regards
Uwe

> +
> +config CMDLINE_DEFAULT
> +	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.
"CMDLINE_DEFAULT" isn't a good name IMHO. It conflicts with

	config CMDLINE
		string "Default kernel command string"

Maybe better use CMDLINE_FROM_BOOTLOADER or similar?

> +
> +config CMDLINE_EXTEND
> +	bool "Extend bootloader kernel arguments"
> +	depends on CMDLINE != ""
> +	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 != ""
> @@ -1751,8 +1769,7 @@ config CMDLINE_FORCE
>  	  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..465bc7e 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -673,7 +673,14 @@ __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);
> +#ifdef CONFIG_CMDLINE_EXTEND
> +	strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
> +	strlcat(default_command_line, tag->u.cmdline.cmdline,
> +		COMMAND_LINE_SIZE);
> +#else
> +	strlcpy(default_command_line, tag->u.cmdline.cmdline,
> +		COMMAND_LINE_SIZE);
> +#endif
>  #else
>  	pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
>  #endif /* CONFIG_CMDLINE_FORCE */
> -- 
> 1.7.4.2
I would prefer

	#ifdef CONFIG_CMDLINE_DEFAULT
		strlcpy(default_command_line, tag->u.cmdline.cmdline,
			COMMAND_LINE_SIZE);
	#elif CONFIG_CMDLINE_EXTEND
		...
	#else /* CMDLINE_FORCE */
		...
	#endif

as it is easier to parse for a human.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07  8:17 [PATCH] ARM: Allow for kernel command line concatenation 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 13:18 ` Nick Bowler
  2 siblings, 1 reply; 15+ messages in thread
From: Paul Bolle @ 2011-04-07 10:35 UTC (permalink / raw)
  To: oskar.andero
  Cc: linux, nicolas.pitre, will.deacon, eric.y.miao, catalin.marinas,
	linux-arm-kernel, linux-kernel, Victor Boivie

On Thu, 2011-04-07 at 10:17 +0200, oskar.andero@sonyericsson.com wrote:
> +config CMDLINE_EXTEND
> +	bool "Extend bootloader kernel arguments"
> +	depends on CMDLINE != ""
> +	help
> +	  The default kernel command string will be concatenated with the
> +	  arguments provided by the boot loader.

This suggests the parameters provided by the boot loader will override
corresponding parameters of the default kernel command string. Is that
correct (for all possible parameters)?

Either way, shouldn't it be documented, perhaps in this help text, what
will happen if a parameter of the default kernel command string and a
parameter provided by the boot loader somehow conflict?


Paul Bolle


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07 10:35 ` Paul Bolle
@ 2011-04-07 10:58   ` Uwe Kleine-König
  2011-04-07 11:38     ` Boivie, Victor
  0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2011-04-07 10:58 UTC (permalink / raw)
  To: Paul Bolle
  Cc: oskar.andero, nicolas.pitre, linux, catalin.marinas, will.deacon,
	linux-kernel, eric.y.miao, linux-arm-kernel, Victor Boivie

On Thu, Apr 07, 2011 at 12:35:01PM +0200, Paul Bolle wrote:
> On Thu, 2011-04-07 at 10:17 +0200, oskar.andero@sonyericsson.com wrote:
> > +config CMDLINE_EXTEND
> > +	bool "Extend bootloader kernel arguments"
> > +	depends on CMDLINE != ""
> > +	help
> > +	  The default kernel command string will be concatenated with the
> > +	  arguments provided by the boot loader.
> 
> This suggests the parameters provided by the boot loader will override
> corresponding parameters of the default kernel command string. Is that
> correct (for all possible parameters)?
> 
> Either way, shouldn't it be documented, perhaps in this help text, what
> will happen if a parameter of the default kernel command string and a
> parameter provided by the boot loader somehow conflict?
Then you will end up with both parameters I guess. What happens depends
on the parameter in question I guess. IMHO the description is fine.
But I wonder if the new mechanism is useful in the end.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07 10:58   ` Uwe Kleine-König
@ 2011-04-07 11:38     ` Boivie, Victor
  0 siblings, 0 replies; 15+ messages in thread
From: Boivie, Victor @ 2011-04-07 11:38 UTC (permalink / raw)
  To: Uwe Kleine-König, Paul Bolle
  Cc: "Anderö, Oskar",
	nicolas.pitre, linux, catalin.marinas, will.deacon, linux-kernel,
	eric.y.miao, linux-arm-kernel

> > This suggests the parameters provided by the boot loader will override
> > corresponding parameters of the default kernel command string. Is that
> > correct (for all possible parameters)?
> >
> > Either way, shouldn't it be documented, perhaps in this help text, what
> > will happen if a parameter of the default kernel command string and a
> > parameter provided by the boot loader somehow conflict?
> Then you will end up with both parameters I guess. What happens depends
> on the parameter in question I guess. IMHO the description is fine.
> But I wonder if the new mechanism is useful in the end.

The way it was intended from my point of view was to only specify (in 
CONFIG_CMDLINE) the parameters that the boot loader doesn't specify. 

We use it to let the boot loader (which is generic and whose config is
rather tricky to change) specify startup reasons and other probed 
information that the kernel can't probe itself, and let the kernel handle
the rest, such as specifying memory regions and console tty's.

Thanks for reviewing, both of you.

Best regards,
Victor Boivie

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07  8:17 [PATCH] ARM: Allow for kernel command line concatenation oskar.andero
  2011-04-07  9:01 ` Uwe Kleine-König
  2011-04-07 10:35 ` Paul Bolle
@ 2011-04-07 13:18 ` Nick Bowler
  2011-04-07 13:22   ` Boivie, Victor
  2 siblings, 1 reply; 15+ messages in thread
From: Nick Bowler @ 2011-04-07 13:18 UTC (permalink / raw)
  To: oskar.andero
  Cc: linux, nicolas.pitre, will.deacon, eric.y.miao, catalin.marinas,
	linux-arm-kernel, linux-kernel, Victor Boivie

On 2011-04-07 10:17 +0200, oskar.andero@sonyericsson.com wrote:
> 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.

This sounds very useful!  One comment below.

> 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 |    9 ++++++++-
>  2 files changed, 27 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
[...]
> +config CMDLINE_EXTEND
> +	bool "Extend bootloader kernel arguments"
> +	depends on CMDLINE != ""
> +	help
> +	  The default kernel command string will be concatenated with the
> +	  arguments provided by the boot loader.

Since concatenation is not commutative, this help text should describe
exactly the order in which the arguments are concatenated.  How about
this instead:

  The command-line arguments provided by the boot loader will be
  appended to the default kernel command string.

-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07 13:18 ` Nick Bowler
@ 2011-04-07 13:22   ` Boivie, Victor
  0 siblings, 0 replies; 15+ messages in thread
From: Boivie, Victor @ 2011-04-07 13:22 UTC (permalink / raw)
  To: Nick Bowler, "Anderö, Oskar"
  Cc: linux, nicolas.pitre, will.deacon, eric.y.miao, catalin.marinas,
	linux-arm-kernel, linux-kernel

> > +config CMDLINE_EXTEND
> > +	bool "Extend bootloader kernel arguments"
> > +	depends on CMDLINE != ""
> > +	help
> > +	  The default kernel command string will be concatenated with the
> > +	  arguments provided by the boot loader.
> 
> Since concatenation is not commutative, this help text should describe
> exactly the order in which the arguments are concatenated.  How about
> this instead:
> 
>   The command-line arguments provided by the boot loader will be
>   appended to the default kernel command string.

I completely agree. New patch upcoming. Thanks.

Best regards,
Victor Boivie,
Sony Ericsson Mobile Communications AB

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-05-04 15:11   ` Uwe Kleine-König
@ 2011-05-04 16:10     ` oskar.andero
  0 siblings, 0 replies; 15+ messages in thread
From: oskar.andero @ 2011-05-04 16:10 UTC (permalink / raw)
  To: Uwe Kleine-K?nig
  Cc: nicolas.pitre, linux, linux-kernel, linux-arm-kernel, Boivie, Victor

On 17:11 Wed 04 May     , Uwe Kleine-K?nig wrote:
> Hello Oskar,
> 
> On Wed, May 04, 2011 at 05:03:52PM +0200, oskar.andero@sonyericsson.com wrote:
> > Ping.
> > 
> > On 11:36 Fri 08 Apr, oskar.andero@sonyericsson.com wrote:
> > > 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>
> > > Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> > > Acked-by: Uwe Kleine-K??nig <u.kleine-koenig@pengutronix.de>
> > > ---
> It can probably go to Russell's patch system[1].
Thanks! That one was new to me!

-Oskar

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-05-04 15:03 ` oskar.andero
@ 2011-05-04 15:11   ` Uwe Kleine-König
  2011-05-04 16:10     ` oskar.andero
  0 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2011-05-04 15:11 UTC (permalink / raw)
  To: oskar.andero
  Cc: nicolas.pitre, linux, linux-kernel, linux-arm-kernel, Boivie, Victor

Hello Oskar,

On Wed, May 04, 2011 at 05:03:52PM +0200, oskar.andero@sonyericsson.com wrote:
> Ping.
> 
> On 11:36 Fri 08 Apr, oskar.andero@sonyericsson.com wrote:
> > 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>
> > Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> > Acked-by: Uwe Kleine-K??nig <u.kleine-koenig@pengutronix.de>
> > ---
It can probably go to Russell's patch system[1].

Best regards
Uwe

[1] http://www.arm.linux.org.uk/developer/patches/

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-08  9:36 oskar.andero
@ 2011-05-04 15:03 ` oskar.andero
  2011-05-04 15:11   ` Uwe Kleine-König
  0 siblings, 1 reply; 15+ messages in thread
From: oskar.andero @ 2011-05-04 15:03 UTC (permalink / raw)
  To: u.kleine-koenig
  Cc: linux, linux-kernel, linux-arm-kernel, Boivie, Victor, nicolas.pitre

Ping.

On 11:36 Fri 08 Apr, oskar.andero@sonyericsson.com wrote:
> 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>
> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
> Acked-by: Uwe Kleine-K??nig <u.kleine-koenig@pengutronix.de>
> ---
Uwe, would you consider merging this patch to your tree or would you
prefer it to go through another maintainer?

Thanks,
-Oskar


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] ARM: Allow for kernel command line concatenation
@ 2011-04-08  9:36 oskar.andero
  2011-05-04 15:03 ` oskar.andero
  0 siblings, 1 reply; 15+ messages in thread
From: oskar.andero @ 2011-04-08  9:36 UTC (permalink / raw)
  To: u.kleine-koenig, nicolas.pitre
  Cc: nbowler, pebolle, linux, catalin.marinas, will.deacon,
	linux-kernel, eric.y.miao, linux-arm-kernel, Victor Boivie,
	Oskar Andero

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>
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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).
 
+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"
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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07 13:29 oskar.andero
  2011-04-07 18:50 ` Nicolas Pitre
@ 2011-04-07 19:15 ` Uwe Kleine-König
  1 sibling, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2011-04-07 19:15 UTC (permalink / raw)
  To: oskar.andero
  Cc: nbowler, pebolle, nicolas.pitre, linux, catalin.marinas,
	will.deacon, linux-kernel, eric.y.miao, linux-arm-kernel,
	Victor Boivie

Hello,

On Thu, Apr 07, 2011 at 03:29:28PM +0200, oskar.andero@sonyericsson.com wrote:
> 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>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] ARM: Allow for kernel command line concatenation
  2011-04-07 13:29 oskar.andero
@ 2011-04-07 18:50 ` Nicolas Pitre
  2011-04-07 19:15 ` Uwe Kleine-König
  1 sibling, 0 replies; 15+ messages in thread
From: Nicolas Pitre @ 2011-04-07 18:50 UTC (permalink / raw)
  To: Oskar Andero
  Cc: nbowler, u.kleine-koenig, pebolle, linux, catalin.marinas,
	will.deacon, linux-kernel, eric.y.miao, linux-arm-kernel,
	Victor Boivie

On Thu, 7 Apr 2011, oskar.andero@sonyericsson.com wrote:

> 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>

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

> ---
>  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).
>  
> +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"
> 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
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] ARM: Allow for kernel command line concatenation
@ 2011-04-07 13:29 oskar.andero
  2011-04-07 18:50 ` Nicolas Pitre
  2011-04-07 19:15 ` Uwe Kleine-König
  0 siblings, 2 replies; 15+ messages in thread
From: oskar.andero @ 2011-04-07 13:29 UTC (permalink / raw)
  To: nbowler, u.kleine-koenig, pebolle
  Cc: nicolas.pitre, linux, catalin.marinas, will.deacon, linux-kernel,
	eric.y.miao, linux-arm-kernel, Victor Boivie, Oskar Andero

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..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).
 
+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"
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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] ARM: Allow for kernel command line concatenation
@ 2011-04-07 11:47 oskar.andero
  0 siblings, 0 replies; 15+ messages in thread
From: oskar.andero @ 2011-04-07 11:47 UTC (permalink / raw)
  To: u.kleine-koenig, pebolle
  Cc: nicolas.pitre, linux, catalin.marinas, will.deacon, linux-kernel,
	eric.y.miao, linux-arm-kernel, Victor Boivie, Oskar Andero

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-05-04 16:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-07  8:17 [PATCH] ARM: Allow for kernel command line concatenation 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
2011-04-07 11:47 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-08  9:36 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

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).