5

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

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
tshah06
  • 2,625
  • 3
  • 19
  • 23

2 Answers2

6

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.

Roland
  • 6,227
  • 23
  • 29
0

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

user2699113
  • 4,262
  • 3
  • 25
  • 43
  • I am not planning to change the code as far as possible. Hence checking the possibility of passing parameter while compiling the kernel. – tshah06 Feb 26 '14 at 08:15