本文主要是介绍linux cmdline参数设置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.linux cmdline配置方式
linux cmdline配置有两种方式:1)通过u-boot bootargs 传递;2)通过内核cmdline参数配置。
2.u-boot bootargs配置
3.kernel cmdline参数配置
本文使用的是linux 4.9内核。进入linux内核根目录,执行命令make menuconfig,进入cmdline配置项。配置路径及选项如下所示:
make menuconfig
-> Boot options
-> Kernel command line type (***)
( ) Use bootloader kernel arguments if available
( ) Extend bootloader kernel arguments
(X) Always use the default kernel command string
通过Kconfig文件的help说明,可以知道每个选项的含义:
config CMDLINE
string “Default kernel command string”
default “”
help
On some architectures (EBSA110 and CATS), there is currently no way
for the boot loader to pass arguments to the kernel. For these
architectures, you should supply some command-line options at build
time by entering them here. As a minimum, you should specify the
memory size and the root device (e.g., mem=64M root=/dev/nfs).
choice
prompt “Kernel command line type” if CMDLINE != “”
default CMDLINE_FROM_BOOTLOADER
depends on ATAGS
config CMDLINE_FROM_BOOTLOADER
bool “Use bootloader kernel arguments if available”
help
Uses the command-line options passed by the boot loader. If
the boot loader doesn’t provide any, the default kernel command
string provided in CMDLINE will be used.
config CMDLINE_EXTEND
bool “Extend bootloader kernel arguments”
help
The command-line arguments provided by the boot loader will be
appended to the default kernel command string.
config CMDLINE_FORCE
bool “Always use the default kernel command string”
help
Always use the default kernel command string, even if the boot
loader passes other arguments to the kernel.
This is useful if you cannot or don’t want to change the
command-line options your boot loader passes to the kernel.
endchoice
1) 当要配置使用u-boot 传递的bootargs参数作为cmdline时,配置
(X) Use bootloader kernel arguments if available
2) 当要配置使用内核配置的参数cmdline时,配置
(X) Always use the default kernel command string
这篇关于linux cmdline参数设置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!