Module
- init_module
- module_init(xxx)
- 用xxx取代init_module()
- cleanup_module
- module_exit(xxx)
- 用xxx取代cleanup_module
- THIS_MODULE
- Build Modules
obj-m := module.o
module-objs := file1.o file2.o
- This command causes make to head over to the kernel source to find the top-level makefile; it then moves back to the original directory to build the module of interest.
- Use make M=dir to specify directory of external module to build
- Old syntax make … SUBDIRS=$PWD is still supported
make -C /path/to/source M=$PWD modules
make -C /path/to/source SUBDIRS=$PWD modules
- __KERNEL__
- MODULE
- module.h
- MODULE_LICENSE
- kernel.h
- init.h
- .modinfo section
- EXPORT_SYMBOL
- CONFIG_MODVERSIONS
#define __KERNEL__ /* We're part of the kernel */
- #ifdef __KERNEL__ preprocessor macro, which is used to identify content that has no value whatsoever in user space
- Splitting kernel headers and deprecating __KERNEL__
page revision: 46, last edited: 03 Apr 2012 09:48