module_init.c 588 B

123456789101112131415161718192021222324252627
  1. /*
  2. https://stackoverflow.com/questions/3218320/what-is-the-difference-between-module-init-and-init-module-in-a-linux-kernel-mod
  3. Hello world with direct init_module and cleantup_module.
  4. This appears to be an older method that still works but has some drawbacks.
  5. vs module_init and module_exit?
  6. - modprobe only works with the module_init / module_exit. Try "modprobe module_init".
  7. */
  8. #include <linux/module.h>
  9. #include <linux/kernel.h>
  10. int init_module(void)
  11. {
  12. pr_info("init_module\n");
  13. return 0;
  14. }
  15. void cleanup_module(void)
  16. {
  17. pr_info("cleanup_module\n");
  18. }
  19. MODULE_LICENSE("GPL");