Skip to content

Commit

Permalink
MIPS: Fix and enhance built-in kernel command line
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitri Vorobiev authored and Ralf Baechle committed Dec 17, 2009
1 parent de4148f commit 6acc7d4
Show file tree
Hide file tree
Showing 48 changed files with 123 additions and 38 deletions.
45 changes: 41 additions & 4 deletions arch/mips/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,52 @@ config EARLY_PRINTK
doesn't cooperate with an X server. You should normally say N here,
unless you want to debug such a crash.

config CMDLINE_BOOL
bool "Built-in kernel command line"
default n
help
For most systems, it is firmware or second stage bootloader that
by default specifies the kernel command line options. However,
it might be necessary or advantageous to either override the
default kernel command line or add a few extra options to it.
For such cases, this option allows you to hardcode your own
command line options directly into the kernel. For that, you
should choose 'Y' here, and fill in the extra boot arguments
in CONFIG_CMDLINE.

The built-in options will be concatenated to the default command
line if CMDLINE_OVERRIDE is set to 'N'. Otherwise, the default
command line will be ignored and replaced by the built-in string.

Most MIPS systems will normally expect 'N' here and rely upon
the command line from the firmware or the second-stage bootloader.

config CMDLINE
string "Default kernel command string"
depends on CMDLINE_BOOL
default ""
help
On some platforms, there is currently 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
other cases you can specify kernel args so that you don't have
to set them up in board prom initialization routines.
pass arguments to the kernel. For these platforms, and for the cases
when you want to add some extra options to the command line or ignore
the default command line, you can supply some command-line options at
build time by entering them here. In other cases you can specify
kernel args so that you don't have to set them up in board prom
initialization routines.

For more information, see the CMDLINE_BOOL and CMDLINE_OVERRIDE
options.

config CMDLINE_OVERRIDE
bool "Built-in command line overrides firware arguments"
default n
depends on CMDLINE_BOOL
help
By setting this option to 'Y' you will have your kernel ignore
command line arguments from firmware or second stage bootloader.
Instead, the built-in command line will be used exclusively.

Normally, you will choose 'N' here.

config DEBUG_STACK_USAGE
bool "Enable stack utilization instrumentation"
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/ar7_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,9 @@ CONFIG_TRACING_SUPPORT=y
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/bcm47xx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ CONFIG_DEBUG_FS=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_SAMPLES is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/bcm63xx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,9 @@ CONFIG_TRACING_SUPPORT=y
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0,115200"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/bigsur_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ CONFIG_DEBUG_MUTEXES=y
# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_FAULT_INJECTION is not set
# CONFIG_SAMPLES is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_SB1XXX_CORELIS is not set
# CONFIG_RUNTIME_DEBUG is not set
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/capcella_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,9 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/cavium-octeon_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/cobalt_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ CONFIG_FRAME_WARN=1024
# CONFIG_SLUB_STATS is not set
# CONFIG_DEBUG_MEMORY_INIT is not set
# CONFIG_SAMPLES is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/db1000_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/db1100_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/db1200_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,9 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="mem=48M"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/db1500_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/db1550_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/decstation_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ CONFIG_MAGIC_SYSRQ=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/e55_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,9 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/fuloong2e_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ CONFIG_TRACING_SUPPORT=y
# CONFIG_DYNAMIC_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/ip22_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ CONFIG_DEBUG_MEMORY_INIT=y
CONFIG_DYNAMIC_PRINTK_DEBUG=y
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/ip27_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/ip28_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ CONFIG_MAGIC_SYSRQ=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_SAMPLES is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/ip32_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/jazz_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/jmr3927_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/lasat_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ CONFIG_MAGIC_SYSRQ=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/lemote2f_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ CONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/malta_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ CONFIG_FRAME_WARN=1024
# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/markeins_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,9 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS0,115200 mem=192m ip=bootp root=/dev/nfs rw"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/mipssim_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ CONFIG_FORCED_INLINING=y
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
# CONFIG_CMDLINE_OVERRIDE is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set

Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/mpc30x_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,9 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73"
# CONFIG_CMDLINE_OVERRIDE is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/msp71xx_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ CONFIG_FORCED_INLINING=y
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set
# CONFIG_MIPS_UNCACHED is not set
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/mtx1_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,7 @@ CONFIG_MAGIC_SYSRQ=y
# CONFIG_HEADERS_CHECK is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/pb1100_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/pb1500_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/pb1550_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/configs/pnx8335-stb225_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ CONFIG_FRAME_WARN=1024
# CONFIG_DEBUG_KERNEL is not set
# CONFIG_SAMPLES is not set
# CONFIG_KERNEL_TESTS is not set
CONFIG_CMDLINE=""
# CONFIG_CMDLINE_BOOL is not set

#
# Security options
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/pnx8550-jbs_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,9 @@ CONFIG_DEBUG_MUTEXES=y
CONFIG_FORCED_INLINING=y
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
# CONFIG_CMDLINE_OVERRIDE is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set

Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/pnx8550-stb810_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,9 @@ CONFIG_DEBUG_SLAB=y
CONFIG_FORCED_INLINING=y
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
# CONFIG_CMDLINE_OVERRIDE is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set

Expand Down
2 changes: 2 additions & 0 deletions arch/mips/configs/powertv_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,9 @@ CONFIG_BRANCH_PROFILE_NONE=y
CONFIG_HAVE_ARCH_KGDB=y
# CONFIG_KGDB is not set
# CONFIG_KMEMCHECK is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="rw dhash_entries=1024 ihash_entries=1024 ip=10.0.1.3:10.0.1.1:10.0.1.1:255.255.255.0:zeus:eth0: root=/dev/nfs nfsroot=/nfsroot/cramfs,wsize=512,rsize=512,tcp nokgdb console=ttyUSB0,115200 memsize=252M"
# CONFIG_CMDLINE_OVERRIDE is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_RUNTIME_DEBUG is not set

Expand Down
Loading

0 comments on commit 6acc7d4

Please sign in to comment.