* [PATCH] x86_64 built-in command line
@ 2006-07-31 17:14 Matt Mackall
2006-07-31 17:46 ` linux-os (Dick Johnson)
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Matt Mackall @ 2006-07-31 17:14 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, ak
Allow setting a command line at build time on x86_64. Compiled but not
tested.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: linux/arch/x86_64/Kconfig
===================================================================
--- linux.orig/arch/x86_64/Kconfig 2006-07-26 18:08:29.000000000 -0500
+++ linux/arch/x86_64/Kconfig 2006-07-27 17:19:50.000000000 -0500
@@ -558,6 +558,20 @@ config K8_NB
def_bool y
depends on AGP_AMD64 || IOMMU || (PCI && NUMA)
+config CMDLINE_BOOL
+ bool "Default bootloader kernel arguments" if EMBEDDED
+
+config CMDLINE
+ string "Initial kernel command string" if EMBEDDED
+ depends on CMDLINE_BOOL
+ default "root=/dev/hda1 ro"
+ help
+ On some systems, there is no way for the boot loader to pass
+ arguments to the kernel. For these platforms, you can supply
+ some command-line options at build time by entering them
+ here. In most cases you will need to specify the root device
+ here.
+
endmenu
#
Index: linux/arch/x86_64/kernel/setup.c
===================================================================
--- linux.orig/arch/x86_64/kernel/setup.c 2006-07-26 18:08:29.000000000 -0500
+++ linux/arch/x86_64/kernel/setup.c 2006-07-27 17:26:51.000000000 -0500
@@ -289,6 +289,10 @@ static __init void parse_cmdline_early (
int len = 0;
int userdef = 0;
+#ifdef CONFIG_CMDLINE_BOOL
+ strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif
+
for (;;) {
if (c != ' ')
goto next_char;
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH] x86_64 built-in command line 2006-07-31 17:14 [PATCH] x86_64 built-in command line Matt Mackall @ 2006-07-31 17:46 ` linux-os (Dick Johnson) 2006-07-31 20:07 ` Andi Kleen 2006-08-01 1:06 ` Deepak Saxena 2 siblings, 0 replies; 18+ messages in thread From: linux-os (Dick Johnson) @ 2006-07-31 17:46 UTC (permalink / raw) To: Matt Mackall; +Cc: linux-kernel, Andrew Morton, ak On Mon, 31 Jul 2006, Matt Mackall wrote: > Allow setting a command line at build time on x86_64. Compiled but not > tested. > > Signed-off-by: Matt Mackall <mpm@selenic.com> > > Index: linux/arch/x86_64/Kconfig > =================================================================== > --- linux.orig/arch/x86_64/Kconfig 2006-07-26 18:08:29.000000000 -0500 > +++ linux/arch/x86_64/Kconfig 2006-07-27 17:19:50.000000000 -0500 > @@ -558,6 +558,20 @@ config K8_NB > def_bool y > depends on AGP_AMD64 || IOMMU || (PCI && NUMA) > > +config CMDLINE_BOOL > + bool "Default bootloader kernel arguments" if EMBEDDED > + > +config CMDLINE > + string "Initial kernel command string" if EMBEDDED > + depends on CMDLINE_BOOL > + default "root=/dev/hda1 ro" > + help > + On some systems, there is no way for the boot loader to pass > + arguments to the kernel. For these platforms, you can supply > + some command-line options at build time by entering them > + here. In most cases you will need to specify the root device > + here. > + > endmenu > > # > Index: linux/arch/x86_64/kernel/setup.c > =================================================================== > --- linux.orig/arch/x86_64/kernel/setup.c 2006-07-26 18:08:29.000000000 -0500 > +++ linux/arch/x86_64/kernel/setup.c 2006-07-27 17:26:51.000000000 -0500 > @@ -289,6 +289,10 @@ static __init void parse_cmdline_early ( > int len = 0; > int userdef = 0; > > +#ifdef CONFIG_CMDLINE_BOOL > + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > +#endif > + > for (;;) { > if (c != ' ') > goto next_char; > > -- > Mathematics is the supreme nostalgia of our time. > - But this just makes it nice for __your__ embedded system. I suggest you use: > + default "root=/dev/root ro" The boot setup code makes a symlink to whatever your specific setup requires. Cheers, Dick Johnson Penguin : Linux version 2.6.16.24 on an i686 machine (5592.62 BogoMips). New book: http://www.AbominableFirebug.com/ _ \x1a\x04 **************************************************************** The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them. Thank you. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-07-31 17:14 [PATCH] x86_64 built-in command line Matt Mackall 2006-07-31 17:46 ` linux-os (Dick Johnson) @ 2006-07-31 20:07 ` Andi Kleen 2006-07-31 20:41 ` H. Peter Anvin 2006-08-01 1:06 ` Deepak Saxena 2 siblings, 1 reply; 18+ messages in thread From: Andi Kleen @ 2006-07-31 20:07 UTC (permalink / raw) To: Matt Mackall; +Cc: linux-kernel, Andrew Morton > +#ifdef CONFIG_CMDLINE_BOOL > + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > +#endif I think I would prefer a strcat. Also you should describe the exact behaviour (override/append) in Kconfig help. -Andi ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-07-31 20:07 ` Andi Kleen @ 2006-07-31 20:41 ` H. Peter Anvin 2006-07-31 22:17 ` Andi Kleen 0 siblings, 1 reply; 18+ messages in thread From: H. Peter Anvin @ 2006-07-31 20:41 UTC (permalink / raw) To: Andi Kleen; +Cc: Matt Mackall, linux-kernel, Andrew Morton Andi Kleen wrote: > >> +#ifdef CONFIG_CMDLINE_BOOL >> + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); >> +#endif > > I think I would prefer a strcat. > > Also you should describe the exact behaviour (override/append) in Kconfig help. > In the i386 thread, Matt described having a firmware bootloader which passes bogus parameters. For that case, it would make sense to have a non-default CONFIG option to have override rather than conjoined (and I maintain that the built-in command line should be prepended.) -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-07-31 20:41 ` H. Peter Anvin @ 2006-07-31 22:17 ` Andi Kleen 2006-08-01 1:43 ` Matt Mackall 0 siblings, 1 reply; 18+ messages in thread From: Andi Kleen @ 2006-07-31 22:17 UTC (permalink / raw) To: H. Peter Anvin; +Cc: Matt Mackall, linux-kernel, Andrew Morton On Monday 31 July 2006 22:41, H. Peter Anvin wrote: > Andi Kleen wrote: > > > >> +#ifdef CONFIG_CMDLINE_BOOL > >> + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > >> +#endif > > > > I think I would prefer a strcat. > > > > Also you should describe the exact behaviour (override/append) in Kconfig help. > > > > In the i386 thread, Matt described having a firmware bootloader which > passes bogus parameters. For that case, it would make sense to have a > non-default CONFIG option to have override rather than conjoined (and I > maintain that the built-in command line should be prepended.) Is that boot loader common? What's its name? If not I would prefer that he keeps the one liner patch to deal with that private. For generic semantics strcat (or possible prepend) is probably better. -Andi ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-07-31 22:17 ` Andi Kleen @ 2006-08-01 1:43 ` Matt Mackall 2006-08-01 2:29 ` H. Peter Anvin ` (3 more replies) 0 siblings, 4 replies; 18+ messages in thread From: Matt Mackall @ 2006-08-01 1:43 UTC (permalink / raw) To: Andi Kleen; +Cc: H. Peter Anvin, linux-kernel, Andrew Morton On Tue, Aug 01, 2006 at 12:17:00AM +0200, Andi Kleen wrote: > On Monday 31 July 2006 22:41, H. Peter Anvin wrote: > > Andi Kleen wrote: > > > > > >> +#ifdef CONFIG_CMDLINE_BOOL > > >> + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > > >> +#endif > > > > > > I think I would prefer a strcat. > > > > > > Also you should describe the exact behaviour (override/append) in Kconfig help. > > > > > > > In the i386 thread, Matt described having a firmware bootloader which > > passes bogus parameters. For that case, it would make sense to have a > > non-default CONFIG option to have override rather than conjoined (and I > > maintain that the built-in command line should be prepended.) > > Is that boot loader common? What's its name? > If not I would prefer that he keeps the one liner patch to deal > with that private. > > For generic semantics strcat (or possible prepend) is probably better. No, it doesn't work for numerous kernel options that can't be negated. -- Mathematics is the supreme nostalgia of our time. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:43 ` Matt Mackall @ 2006-08-01 2:29 ` H. Peter Anvin 2006-08-01 2:33 ` H. Peter Anvin ` (2 subsequent siblings) 3 siblings, 0 replies; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 2:29 UTC (permalink / raw) To: Matt Mackall; +Cc: Andi Kleen, linux-kernel, Andrew Morton Matt Mackall wrote: > On Tue, Aug 01, 2006 at 12:17:00AM +0200, Andi Kleen wrote: >> On Monday 31 July 2006 22:41, H. Peter Anvin wrote: >>> Andi Kleen wrote: >>>> >>>>> +#ifdef CONFIG_CMDLINE_BOOL >>>>> + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); >>>>> +#endif >>>> I think I would prefer a strcat. >>>> >>>> Also you should describe the exact behaviour (override/append) in Kconfig help. >>>> >>> In the i386 thread, Matt described having a firmware bootloader which >>> passes bogus parameters. For that case, it would make sense to have a >>> non-default CONFIG option to have override rather than conjoined (and I >>> maintain that the built-in command line should be prepended.) >> Is that boot loader common? What's its name? >> If not I would prefer that he keeps the one liner patch to deal >> with that private. >> >> For generic semantics strcat (or possible prepend) is probably better. > > No, it doesn't work for numerous kernel options that can't be negated. > How about we fix the real problem, then? -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:43 ` Matt Mackall 2006-08-01 2:29 ` H. Peter Anvin @ 2006-08-01 2:33 ` H. Peter Anvin 2006-08-01 2:38 ` H. Peter Anvin 2006-08-01 2:49 ` Andrew Morton 3 siblings, 0 replies; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 2:33 UTC (permalink / raw) To: Matt Mackall; +Cc: Andi Kleen, linux-kernel, Andrew Morton Matt Mackall wrote: >> >> For generic semantics strcat (or possible prepend) is probably better. > > No, it doesn't work for numerous kernel options that can't be negated. > Anyway, there are four possible behaviours: builtin only, bootloader only, buildin+bootloader, and bootloader+builtin. I believe the last is the most appropriate default, but there really is no reason why this can't be a four-way configuration option. -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:43 ` Matt Mackall 2006-08-01 2:29 ` H. Peter Anvin 2006-08-01 2:33 ` H. Peter Anvin @ 2006-08-01 2:38 ` H. Peter Anvin 2006-08-01 2:41 ` Matt Mackall 2006-08-01 2:49 ` Andrew Morton 3 siblings, 1 reply; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 2:38 UTC (permalink / raw) To: Matt Mackall; +Cc: Andi Kleen, linux-kernel, Andrew Morton Actually, the best thing to do might be to designate a symbol (say &, like in automount) as "insert the boot loader command line here." That way you can specify things in the builtin command line that are both prepended and appended to the boot loader command, and if you wish, you can emit it completely. The default would be just "&". -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 2:38 ` H. Peter Anvin @ 2006-08-01 2:41 ` Matt Mackall 2006-08-01 2:44 ` Andi Kleen 2006-08-01 2:46 ` H. Peter Anvin 0 siblings, 2 replies; 18+ messages in thread From: Matt Mackall @ 2006-08-01 2:41 UTC (permalink / raw) To: H. Peter Anvin; +Cc: Andi Kleen, linux-kernel, Andrew Morton On Mon, Jul 31, 2006 at 07:38:39PM -0700, H. Peter Anvin wrote: > Actually, the best thing to do might be to designate a symbol (say &, > like in automount) as "insert the boot loader command line here." > > That way you can specify things in the builtin command line that are > both prepended and appended to the boot loader command, and if you wish, > you can emit it completely. > > The default would be just "&". That idea doesn't suck. I'll take a look at it. We still have a problem with overriding things like console=tty, for which there's no obvious fix that doesn't break the world. -- Mathematics is the supreme nostalgia of our time. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 2:41 ` Matt Mackall @ 2006-08-01 2:44 ` Andi Kleen 2006-08-01 2:46 ` H. Peter Anvin 2006-08-01 2:46 ` H. Peter Anvin 1 sibling, 1 reply; 18+ messages in thread From: Andi Kleen @ 2006-08-01 2:44 UTC (permalink / raw) To: Matt Mackall; +Cc: H. Peter Anvin, linux-kernel, Andrew Morton On Tuesday 01 August 2006 04:41, Matt Mackall wrote: > On Mon, Jul 31, 2006 at 07:38:39PM -0700, H. Peter Anvin wrote: > > Actually, the best thing to do might be to designate a symbol (say &, > > like in automount) as "insert the boot loader command line here." > > > > That way you can specify things in the builtin command line that are > > both prepended and appended to the boot loader command, and if you wish, > > you can emit it completely. > > > > The default would be just "&". > > That idea doesn't suck. I'll take a look at it. With %s it would be much less code to write. -Andi ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 2:44 ` Andi Kleen @ 2006-08-01 2:46 ` H. Peter Anvin 2006-08-01 2:46 ` Andi Kleen 0 siblings, 1 reply; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 2:46 UTC (permalink / raw) To: Andi Kleen; +Cc: Matt Mackall, linux-kernel, Andrew Morton Andi Kleen wrote: > On Tuesday 01 August 2006 04:41, Matt Mackall wrote: >> On Mon, Jul 31, 2006 at 07:38:39PM -0700, H. Peter Anvin wrote: >>> Actually, the best thing to do might be to designate a symbol (say &, >>> like in automount) as "insert the boot loader command line here." >>> >>> That way you can specify things in the builtin command line that are >>> both prepended and appended to the boot loader command, and if you wish, >>> you can emit it completely. >>> >>> The default would be just "&". >> That idea doesn't suck. I'll take a look at it. > > With %s it would be much less code to write. > True; it would just mean that the buildin command line would have to double %'s, but that's not really a problem. On the other hand, a single-character substitution loop is hardly complex. -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 2:46 ` H. Peter Anvin @ 2006-08-01 2:46 ` Andi Kleen 0 siblings, 0 replies; 18+ messages in thread From: Andi Kleen @ 2006-08-01 2:46 UTC (permalink / raw) To: H. Peter Anvin; +Cc: Matt Mackall, linux-kernel, Andrew Morton > True; it would just mean that the buildin command line would have to > double %'s, but that's not really a problem. Similar for &s -Andi ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 2:41 ` Matt Mackall 2006-08-01 2:44 ` Andi Kleen @ 2006-08-01 2:46 ` H. Peter Anvin 1 sibling, 0 replies; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 2:46 UTC (permalink / raw) To: Matt Mackall; +Cc: Andi Kleen, linux-kernel, Andrew Morton Matt Mackall wrote: > > That idea doesn't suck. I'll take a look at it. > > We still have a problem with overriding things like console=tty, for > which there's no obvious fix that doesn't break the world. > One could define "console=" (empty argument) as a command to reset the list. It probably would be useful. -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:43 ` Matt Mackall ` (2 preceding siblings ...) 2006-08-01 2:38 ` H. Peter Anvin @ 2006-08-01 2:49 ` Andrew Morton 3 siblings, 0 replies; 18+ messages in thread From: Andrew Morton @ 2006-08-01 2:49 UTC (permalink / raw) To: Matt Mackall; +Cc: ak, hpa, linux-kernel On Mon, 31 Jul 2006 20:43:19 -0500 Matt Mackall <mpm@selenic.com> wrote: > On Tue, Aug 01, 2006 at 12:17:00AM +0200, Andi Kleen wrote: > > On Monday 31 July 2006 22:41, H. Peter Anvin wrote: > > > Andi Kleen wrote: > > > > > > > >> +#ifdef CONFIG_CMDLINE_BOOL > > > >> + strlcpy(saved_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > > > >> +#endif > > > > > > > > I think I would prefer a strcat. > > > > > > > > Also you should describe the exact behaviour (override/append) in Kconfig help. > > > > > > > > > > In the i386 thread, Matt described having a firmware bootloader which > > > passes bogus parameters. For that case, it would make sense to have a > > > non-default CONFIG option to have override rather than conjoined (and I > > > maintain that the built-in command line should be prepended.) > > > > Is that boot loader common? What's its name? > > If not I would prefer that he keeps the one liner patch to deal > > with that private. > > > > For generic semantics strcat (or possible prepend) is probably better. > > No, it doesn't work for numerous kernel options that can't be negated. I think what I'm hearing is that we need three options: append, prepend or replace. ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-07-31 17:14 [PATCH] x86_64 built-in command line Matt Mackall 2006-07-31 17:46 ` linux-os (Dick Johnson) 2006-07-31 20:07 ` Andi Kleen @ 2006-08-01 1:06 ` Deepak Saxena 2006-08-01 1:18 ` Andi Kleen 2006-08-01 3:47 ` H. Peter Anvin 2 siblings, 2 replies; 18+ messages in thread From: Deepak Saxena @ 2006-08-01 1:06 UTC (permalink / raw) To: Matt Mackall; +Cc: linux-kernel, Andrew Morton, ak On Jul 31 2006, at 12:14, Matt Mackall was caught saying: > Allow setting a command line at build time on x86_64. Compiled but not > tested. Can we just make this into a generic option and put the relevant strcpy (strcat) in init/main.c. We've supported a default in-kernel command line on ARM for sometime now and I think it would be best to just have a single implementation. ~Deepak -- Deepak Saxena - dsaxena@plexity.net - http://www.plexity.net "An open heart has no possessions, only experiences" - Matt Bibbeau ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:06 ` Deepak Saxena @ 2006-08-01 1:18 ` Andi Kleen 2006-08-01 3:47 ` H. Peter Anvin 1 sibling, 0 replies; 18+ messages in thread From: Andi Kleen @ 2006-08-01 1:18 UTC (permalink / raw) To: dsaxena; +Cc: Matt Mackall, linux-kernel, Andrew Morton On Tuesday 01 August 2006 03:06, Deepak Saxena wrote: > On Jul 31 2006, at 12:14, Matt Mackall was caught saying: > > Allow setting a command line at build time on x86_64. Compiled but not > > tested. > > Can we just make this into a generic option and put the relevant strcpy > (strcat) in init/main.c. We've supported a default in-kernel command line > on ARM for sometime now and I think it would be best to just have a single > implementation. One problem is that some architectures (like i386/x86-64) have early boot arguments that are processed before init/main -Andi ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] x86_64 built-in command line 2006-08-01 1:06 ` Deepak Saxena 2006-08-01 1:18 ` Andi Kleen @ 2006-08-01 3:47 ` H. Peter Anvin 1 sibling, 0 replies; 18+ messages in thread From: H. Peter Anvin @ 2006-08-01 3:47 UTC (permalink / raw) To: dsaxena; +Cc: Matt Mackall, linux-kernel, Andrew Morton, ak Deepak Saxena wrote: > On Jul 31 2006, at 12:14, Matt Mackall was caught saying: >> Allow setting a command line at build time on x86_64. Compiled but not >> tested. > > Can we just make this into a generic option and put the relevant strcpy > (strcat) in init/main.c. We've supported a default in-kernel command line > on ARM for sometime now and I think it would be best to just have a single > implementation. > Yes on the generic option, no on putting it in init/main.c... on a lot of architectures, some parsing of the command line happens *very* early, sometimes even before the C code is invoked. -hpa ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2006-08-01 3:47 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-07-31 17:14 [PATCH] x86_64 built-in command line Matt Mackall 2006-07-31 17:46 ` linux-os (Dick Johnson) 2006-07-31 20:07 ` Andi Kleen 2006-07-31 20:41 ` H. Peter Anvin 2006-07-31 22:17 ` Andi Kleen 2006-08-01 1:43 ` Matt Mackall 2006-08-01 2:29 ` H. Peter Anvin 2006-08-01 2:33 ` H. Peter Anvin 2006-08-01 2:38 ` H. Peter Anvin 2006-08-01 2:41 ` Matt Mackall 2006-08-01 2:44 ` Andi Kleen 2006-08-01 2:46 ` H. Peter Anvin 2006-08-01 2:46 ` Andi Kleen 2006-08-01 2:46 ` H. Peter Anvin 2006-08-01 2:49 ` Andrew Morton 2006-08-01 1:06 ` Deepak Saxena 2006-08-01 1:18 ` Andi Kleen 2006-08-01 3:47 ` H. Peter Anvin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox