diff options
author | Tim Bird <tim.bird@am.sony.com> | 2008-08-12 15:52:36 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-15 10:10:37 -0400 |
commit | 516cbf3730c49739629d66313b20bdc50c98aa2c (patch) | |
tree | 07d481c928cb95e3db5de1cfa6062c572153706a /arch/x86/kernel/setup.c | |
parent | b635acec48bcaa9183fcbf4e3955616b0d4119b5 (diff) |
x86, bootup: add built-in kernel command line for x86 (v2)
Allow x86 to support a built-in kernel command line. The built-in
command line can override the one provided by the boot loader, for
those cases where the boot loader is broken or it is difficult
to change the command line in the the boot loader.
H. Peter Anvin wrote:
> Ingo Molnar wrote:
>> Best would be to make it really apparent in the code that nothing
>> changes if this config option is not set. Preferably there should be
>> no extra code at all in that case.
>>
>
> I would like to see this:
[...Nested ifdefs...]
OK. This version changes absolutely nothing if CONFIG_CMDLINE_BOOL is not
set (the default). Also, no space is appended even when CONFIG_CMDLINE_BOOL
is set, but the builtin string is empty. This is less sloppy all the way
around, IMHO.
Note that I use the same option names as on other arches for
this feature.
[ mingo@elte.hu: build fix ]
Signed-off-by: Tim Bird <tim.bird@am.sony.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 68b48e3fbcbd..2f31cddd27b7 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -223,6 +223,9 @@ unsigned long saved_video_mode; | |||
223 | #define RAMDISK_LOAD_FLAG 0x4000 | 223 | #define RAMDISK_LOAD_FLAG 0x4000 |
224 | 224 | ||
225 | static char __initdata command_line[COMMAND_LINE_SIZE]; | 225 | static char __initdata command_line[COMMAND_LINE_SIZE]; |
226 | #ifdef CONFIG_CMDLINE_BOOL | ||
227 | static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; | ||
228 | #endif | ||
226 | 229 | ||
227 | #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) | 230 | #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) |
228 | struct edd edd; | 231 | struct edd edd; |
@@ -673,6 +676,19 @@ void __init setup_arch(char **cmdline_p) | |||
673 | bss_resource.start = virt_to_phys(&__bss_start); | 676 | bss_resource.start = virt_to_phys(&__bss_start); |
674 | bss_resource.end = virt_to_phys(&__bss_stop)-1; | 677 | bss_resource.end = virt_to_phys(&__bss_stop)-1; |
675 | 678 | ||
679 | #ifdef CONFIG_CMDLINE_BOOL | ||
680 | #ifdef CONFIG_CMDLINE_OVERRIDE | ||
681 | strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); | ||
682 | #else | ||
683 | if (builtin_cmdline[0]) { | ||
684 | /* append boot loader cmdline to builtin */ | ||
685 | strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); | ||
686 | strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); | ||
687 | strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); | ||
688 | } | ||
689 | #endif | ||
690 | #endif | ||
691 | |||
676 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | 692 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); |
677 | *cmdline_p = command_line; | 693 | *cmdline_p = command_line; |
678 | 694 | ||