Skip to content

Commit 6acc7d4

Browse files
dmvoralfbaechle
authored andcommitted
MIPS: Fix and enhance built-in kernel command line
Currently, MIPS kernels silently overwrite kernel command-line parameters hardcoded in CONFIG_CMDLINE by the ones received from firmware. Therefore, using firmware remains the only reliable method to transfer the command-line parameters, which is not always desirable or convenient, and the CONFIG_CMDLINE option is thereby effectively rendered useless. This patch fixes the problem described above and introduces a more flexible scheme of handling the kernel command line, in a manner identical to what is currently used for x86. The default behavior, i.e. when CONFIG_CMDLINE_BOOL is not defined, retains the existing semantics, and firmware command-line arguments override the hardcoded ones. [Ralf: I fixed up all the defconfig files so the stay unaffected by this change.] Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com> Cc: linux-mips@linux-mips.org Patchwork: http://patchwork.linux-mips.org/patch/689/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent de4148f commit 6acc7d4

48 files changed

Lines changed: 123 additions & 38 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/mips/Kconfig.debug‎

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,52 @@ config EARLY_PRINTK
2020
doesn't cooperate with an X server. You should normally say N here,
2121
unless you want to debug such a crash.
2222

23+
config CMDLINE_BOOL
24+
bool "Built-in kernel command line"
25+
default n
26+
help
27+
For most systems, it is firmware or second stage bootloader that
28+
by default specifies the kernel command line options. However,
29+
it might be necessary or advantageous to either override the
30+
default kernel command line or add a few extra options to it.
31+
For such cases, this option allows you to hardcode your own
32+
command line options directly into the kernel. For that, you
33+
should choose 'Y' here, and fill in the extra boot arguments
34+
in CONFIG_CMDLINE.
35+
36+
The built-in options will be concatenated to the default command
37+
line if CMDLINE_OVERRIDE is set to 'N'. Otherwise, the default
38+
command line will be ignored and replaced by the built-in string.
39+
40+
Most MIPS systems will normally expect 'N' here and rely upon
41+
the command line from the firmware or the second-stage bootloader.
42+
2343
config CMDLINE
2444
string "Default kernel command string"
45+
depends on CMDLINE_BOOL
2546
default ""
2647
help
2748
On some platforms, there is currently no way for the boot loader to
28-
pass arguments to the kernel. For these platforms, you can supply
29-
some command-line options at build time by entering them here. In
30-
other cases you can specify kernel args so that you don't have
31-
to set them up in board prom initialization routines.
49+
pass arguments to the kernel. For these platforms, and for the cases
50+
when you want to add some extra options to the command line or ignore
51+
the default command line, you can supply some command-line options at
52+
build time by entering them here. In other cases you can specify
53+
kernel args so that you don't have to set them up in board prom
54+
initialization routines.
55+
56+
For more information, see the CMDLINE_BOOL and CMDLINE_OVERRIDE
57+
options.
58+
59+
config CMDLINE_OVERRIDE
60+
bool "Built-in command line overrides firware arguments"
61+
default n
62+
depends on CMDLINE_BOOL
63+
help
64+
By setting this option to 'Y' you will have your kernel ignore
65+
command line arguments from firmware or second stage bootloader.
66+
Instead, the built-in command line will be used exclusively.
67+
68+
Normally, you will choose 'N' here.
3269

3370
config DEBUG_STACK_USAGE
3471
bool "Enable stack utilization instrumentation"

‎arch/mips/configs/ar7_defconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,9 @@ CONFIG_TRACING_SUPPORT=y
10511051
# CONFIG_DYNAMIC_DEBUG is not set
10521052
# CONFIG_SAMPLES is not set
10531053
CONFIG_HAVE_ARCH_KGDB=y
1054+
CONFIG_CMDLINE_BOOL=y
10541055
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
1056+
# CONFIG_CMDLINE_OVERRIDE is not set
10551057

10561058
#
10571059
# Security options

‎arch/mips/configs/bcm47xx_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ CONFIG_DEBUG_FS=y
18521852
# CONFIG_HEADERS_CHECK is not set
18531853
# CONFIG_DEBUG_KERNEL is not set
18541854
# CONFIG_SAMPLES is not set
1855-
CONFIG_CMDLINE=""
1855+
# CONFIG_CMDLINE_BOOL is not set
18561856

18571857
#
18581858
# Security options

‎arch/mips/configs/bcm63xx_defconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,9 @@ CONFIG_TRACING_SUPPORT=y
941941
# CONFIG_BLK_DEV_IO_TRACE is not set
942942
# CONFIG_SAMPLES is not set
943943
CONFIG_HAVE_ARCH_KGDB=y
944+
CONFIG_CMDLINE_BOOL=y
944945
CONFIG_CMDLINE="console=ttyS0,115200"
946+
# CONFIG_CMDLINE_OVERRIDE is not set
945947

946948
#
947949
# Security options

‎arch/mips/configs/bigsur_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ CONFIG_DEBUG_MUTEXES=y
12361236
# CONFIG_BACKTRACE_SELF_TEST is not set
12371237
# CONFIG_FAULT_INJECTION is not set
12381238
# CONFIG_SAMPLES is not set
1239-
CONFIG_CMDLINE=""
1239+
# CONFIG_CMDLINE_BOOL is not set
12401240
# CONFIG_DEBUG_STACK_USAGE is not set
12411241
# CONFIG_SB1XXX_CORELIS is not set
12421242
# CONFIG_RUNTIME_DEBUG is not set

‎arch/mips/configs/capcella_defconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,9 @@ CONFIG_ENABLE_MUST_CHECK=y
782782
# CONFIG_HEADERS_CHECK is not set
783783
# CONFIG_DEBUG_KERNEL is not set
784784
CONFIG_CROSSCOMPILE=y
785+
CONFIG_CMDLINE_BOOL=y
785786
CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
787+
# CONFIG_CMDLINE_OVERRIDE is not set
786788

787789
#
788790
# Security options

‎arch/mips/configs/cavium-octeon_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
820820
# CONFIG_SAMPLES is not set
821821
CONFIG_HAVE_ARCH_KGDB=y
822822
# CONFIG_KGDB is not set
823-
CONFIG_CMDLINE=""
823+
# CONFIG_CMDLINE_BOOL is not set
824824
# CONFIG_DEBUG_STACK_USAGE is not set
825825
# CONFIG_RUNTIME_DEBUG is not set
826826

‎arch/mips/configs/cobalt_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ CONFIG_FRAME_WARN=1024
11251125
# CONFIG_SLUB_STATS is not set
11261126
# CONFIG_DEBUG_MEMORY_INIT is not set
11271127
# CONFIG_SAMPLES is not set
1128-
CONFIG_CMDLINE=""
1128+
# CONFIG_CMDLINE_BOOL is not set
11291129

11301130
#
11311131
# Security options

‎arch/mips/configs/db1000_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
10891089
# CONFIG_DEBUG_KERNEL is not set
10901090
CONFIG_LOG_BUF_SHIFT=14
10911091
CONFIG_CROSSCOMPILE=y
1092-
CONFIG_CMDLINE=""
1092+
# CONFIG_CMDLINE_BOOL is not set
10931093

10941094
#
10951095
# Security options

‎arch/mips/configs/db1100_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
10891089
# CONFIG_DEBUG_KERNEL is not set
10901090
CONFIG_LOG_BUF_SHIFT=14
10911091
CONFIG_CROSSCOMPILE=y
1092-
CONFIG_CMDLINE=""
1092+
# CONFIG_CMDLINE_BOOL is not set
10931093

10941094
#
10951095
# Security options

0 commit comments

Comments
 (0)