aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/Kconfig45
-rw-r--r--arch/x86/kernel/setup.c16
2 files changed, 61 insertions, 0 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac2fb0641a04..fbcb79bbafd2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1392,6 +1392,51 @@ config COMPAT_VDSO
1392 1392
1393 If unsure, say Y. 1393 If unsure, say Y.
1394 1394
1395config CMDLINE_BOOL
1396 bool "Built-in kernel command line"
1397 default n
1398 help
1399 Allow for specifying boot arguments to the kernel at
1400 build time. On some systems (e.g. embedded ones), it is
1401 necessary or convenient to provide some or all of the
1402 kernel boot arguments with the kernel itself (that is,
1403 to not rely on the boot loader to provide them.)
1404
1405 To compile command line arguments into the kernel,
1406 set this option to 'Y', then fill in the
1407 the boot arguments in CONFIG_CMDLINE.
1408
1409 Systems with fully functional boot loaders (i.e. non-embedded)
1410 should leave this option set to 'N'.
1411
1412config CMDLINE
1413 string "Built-in kernel command string"
1414 depends on CMDLINE_BOOL
1415 default ""
1416 help
1417 Enter arguments here that should be compiled into the kernel
1418 image and used at boot time. If the boot loader provides a
1419 command line at boot time, it is appended to this string to
1420 form the full kernel command line, when the system boots.
1421
1422 However, you can use the CONFIG_CMDLINE_OVERRIDE option to
1423 change this behavior.
1424
1425 In most cases, the command line (whether built-in or provided
1426 by the boot loader) should specify the device for the root
1427 file system.
1428
1429config CMDLINE_OVERRIDE
1430 bool "Built-in command line overrides boot loader arguments"
1431 default n
1432 depends on CMDLINE_BOOL
1433 help
1434 Set this option to 'Y' to have the kernel ignore the boot loader
1435 command line, and use ONLY the built-in command line.
1436
1437 This is used to work around broken boot loaders. This should
1438 be set to 'N' under normal conditions.
1439
1395endmenu 1440endmenu
1396 1441
1397config ARCH_ENABLE_MEMORY_HOTPLUG 1442config ARCH_ENABLE_MEMORY_HOTPLUG
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
225static char __initdata command_line[COMMAND_LINE_SIZE]; 225static char __initdata command_line[COMMAND_LINE_SIZE];
226#ifdef CONFIG_CMDLINE_BOOL
227static 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)
228struct edd edd; 231struct 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