-
-
Notifications
You must be signed in to change notification settings - Fork 617
Expand file tree
/
Copy pathhello.c
More file actions
22 lines (18 loc) · 535 Bytes
/
hello.c
File metadata and controls
22 lines (18 loc) · 535 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* https://cirosantilli.com/linux-kernel-module-cheat#qemu-buildroot-setup-getting-started */
#include <linux/module.h>
#include <linux/kernel.h>
static int myinit(void)
{
pr_info("hello init\n");
/* 0 for success, any negative value means failure,
* E* consts if you want to specify failure cause.
* https://www.linux.com/learn/kernel-newbie-corner-loadable-kernel-modules-coming-and-going */
return 0;
}
static void myexit(void)
{
pr_info("hello exit\n");
}
module_init(myinit)
module_exit(myexit)
MODULE_LICENSE("GPL");