Linux Loadable Kernel Module HOWTO
8. About Module Parameters
It is useful to compare parameters that get passed to LKMs and parameters that get passed to modules that are bound into the base kernel, especially since modules often can be run either way.
We've seen above that you pass parameters to an LKM by specifying something like io=0x300 on the insmod command. For a module that is bound into the base kernel, you pass parameters to it via the kernel boot parameters. One common way to specify kernel boot parameters is at a lilo boot prompt. Another is with an append statement in the lilo configuration file.
The kernel initializes an LKM at the time you load it. It initializes a bound-in module at boot time.
Since there is only one string of kernel boot parameters, you need some way within that string to identify which parameters go to which modules. The rule for this is that if there is a module named xyz , then a kernel boot parameter named xyz is for that module. The value of a kernel boot parameter is an arbitrary string that makes sense only to the module.
This is why you sometimes see an LKM whose only parameter is its own name. E.g. you load the Mitsumi CDROM driver with a command like
insmod mcd mcd=0x340
It seems ridiculous to have the parameter named mcd instead of, say, io , but this is done for consistency with the case where you bind mcd into the base kernel, in which case you would select the I/O port address with the characters mcd=0x340 in the kernel boot parameters.
8. About Module Parameters
It is useful to compare parameters that get passed to LKMs and parameters that get passed to modules that are bound into the base kernel, especially since modules often can be run either way.
We've seen above that you pass parameters to an LKM by specifying something like io=0x300 on the insmod command. For a module that is bound into the base kernel, you pass parameters to it via the kernel boot parameters. One common way to specify kernel boot parameters is at a lilo boot prompt. Another is with an append statement in the lilo configuration file.
The kernel initializes an LKM at the time you load it. It initializes a bound-in module at boot time.
Since there is only one string of kernel boot parameters, you need some way within that string to identify which parameters go to which modules. The rule for this is that if there is a module named xyz , then a kernel boot parameter named xyz is for that module. The value of a kernel boot parameter is an arbitrary string that makes sense only to the module.
This is why you sometimes see an LKM whose only parameter is its own name. E.g. you load the Mitsumi CDROM driver with a command like
insmod mcd mcd=0x340
It seems ridiculous to have the parameter named mcd instead of, say, io , but this is done for consistency with the case where you bind mcd into the base kernel, in which case you would select the I/O port address with the characters mcd=0x340 in the kernel boot parameters.
No comments:
Post a Comment