Add basic and chardev modules
This commit is contained in:
commit
e3c9144b8a
10 changed files with 298 additions and 0 deletions
7
01_basic_module/Makefile
Normal file
7
01_basic_module/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
obj-m += test_module.o
|
||||
|
||||
all:
|
||||
make -C $(LINUX_MODULES_FOLDER)/build M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
make -C $(LINUX_MODULES_FOLDER)/build M=$(PWD) clean
|
20
01_basic_module/test_module.c
Normal file
20
01_basic_module/test_module.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
static int __init basic_module_init(void) {
|
||||
printk(KERN_INFO "Bonjour! Le module est chargé.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit basic_module_exit(void) {
|
||||
printk(KERN_INFO "Au revoir! Le module est déchargé.\n");
|
||||
}
|
||||
|
||||
module_init(basic_module_init);
|
||||
module_exit(basic_module_exit);
|
||||
|
||||
MODULE_LICENSE("MIT License");
|
||||
MODULE_AUTHOR("Florian RICHER");
|
||||
MODULE_DESCRIPTION("Un module noyau qui affiche un message");
|
||||
MODULE_VERSION("1.0");
|
Loading…
Add table
Add a link
Reference in a new issue