X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=hello%2Fhello.c;h=3b236b8e85aaf25eb208cfefe7370bc9ba7be687;hb=HEAD;hp=48bcb33093506b829322a39604e8066e431abec4;hpb=395fd5f8ac9b98dac953183fa3d8ccb38c3a86c1;p=my-code%2Fkernel.git diff --git a/hello/hello.c b/hello/hello.c index 48bcb33..3b236b8 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -1,14 +1,22 @@ -/* my first kernel driver :-) */ +/* + * hello world kernel module + * + */ -#define MODULE #include +#include +#include -int init_module(void) { - printk("<1>hi hackbard, here is your kernel speaking! :)\n"); - return 0; +//MODULE_LICENSE("GPL"); + +static int __init name_of_initialization_routine(void) { + printk(KERN_INFO "hello world, this is your kernel speaking\n"); + return 0; } -void cleanup_module(void) { - printk("<1>bye hackbard ...\n"); +static void __exit name_of_cleanup_routine(void) { + printk(KERN_INFO "good bye world!\n"); } +module_init(name_of_initialization_routine); +module_exit(name_of_cleanup_routine);