To write a module, you must first declare the following two sentences:
#include <linux/module.h>//This header file contains many definitions of symbols and functions that are more relevant to the loading module
#include <linux/init.h>//This header file contains your module initialization and cleanup functions
In addition, if you need to use parameters to pass the module, then you may want to declare moduleparam.h this header file.
Furthermore, the modules often contain descriptive declarations such as:
Module_license ("GPL"); "GPL" indicates that this is any version of the GNU General Public License
"GPL v2" is the second version that indicates that this is only declared as GPL
"GPL and Addtional"
"Dual BSD/GPL"
"Dual MPL/GPL"
"Proprietary" private
Unless your module explicitly declares an open-source version, the kernel defaults to you as a private module (proprietary).
Module_author//Declaration author
Module_description//A simple description of the module, this description is "human-readable"
Module_version//version of this module
Module_alias//alias of this module
Module_device_table//Tell user space what kind of device does this module support
The Module_ declaration can be written anywhere in the module (but must be outside the function), but the formula is written at the end of the module.
Declarations when writing modules (including Module_license, etc.) (RPM)