我可以找到module_param来发送内核模块的参数(我猜是可加载的模块)。这个module_param是否可用于将参数发送到静态模块(使用kerenel编译)。
请告诉我,静态模块定义和发送参数的方法。 (如有可能,请提供更多细 我很感激你的时间。
答案 0 :(得分:1)
对于内核映像中内置的模块,将模块自定义参数添加到内核引导参数列表中。此列表将(取决于体系结构)由引导加载程序传递或内置到内核中。
看起来像这样:
mymod.fooparam=debug
供参考,请参阅kernel-params documentation。
您可以使用与动态加载模块相同的方式定义模块中的参数。
编辑:来自:arch/arm/Kconfig
您可以通过基于构建选项生成的.config文件设置cmdline。
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
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