It is right!
Just an addendum: before creating the kernel, you know that when you run " make menuconfig " you can set which functions will be built into the kernel image ( y ), which will be included as a loadable module ( m ) and which will not be included ( n ).
if you want to install it for your new function, you can edit the Kconfig file, which you will find in the same folder of the new file. In your case, " linux-xyz/kernel/Kconfig "
This is an example:
config ZERO_STIMULUS_FEATURE tristate "My new feature" default m ---help--- This is my brand new feature Here a multi-line description
Typically, the error is setting " config CONFIG_ZERO_STIMULUS_FEATURE " instead of " config ZERO_STIMULUS_FEATURE ": do not add the prefix " CONFIG_ " here
If your function does not load as a module, you will need to use the <<26> keyword instead of " tristate ". Take a look at the other Kconfig files and you will also see how easy it is to install dependencies.
Regards, / Angel
Angel source share