tshah06
tshah06

Reputation: 2755

Passing parameter to builtin kernel module at compile time

Is there a way to pass parameter to builtin kernel module while compiling the linux kernel? If yes, can you please explain how? I want to pass value for max_bonds to bonding driver which is builtin module in my kernel.

Linux kernel version - 2.6

Upvotes: 5

Views: 4898

Answers (2)

Roland
Roland

Reputation: 6583

You can use two kernel features to accomplish this:

  • You can pass module parameter values to built-in modules via the kernel command line as "modulename.param=value". So in your case you want something like "bonding.max_bonds=50" in the kernel command line.
  • Since 2.6.28 or so (hope your kernel isn't older than that), the kernel supports setting a default command line at compile time via CONFIG_CMDLINE_BOOL ("Built-in kernel command line") and CONFIG_CMDLINE. You set CONFIG_CMDLINE_BOOL=y and then set CONFIG_CMDLINE to whatever you want in your kernel command line (for example, "bonding.max_bonds=50"). Any further command line options that your boot loader passes to the kernel are appended to the default command line you set in the kernel config.

By using those two features, I think you get pretty much exactly what you want, without modifying any kernel source, just tweaking your config file.

Upvotes: 6

user2699113
user2699113

Reputation: 4509

I think it is possible by changing modules source. Each modules parameter has its default value coded in sources - just modify it.

Upvotes: 0

Related Questions