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
#define __KERNEL__         /* We're part of the kernel */
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License