X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=hello%2Fhello.c;h=3b236b8e85aaf25eb208cfefe7370bc9ba7be687;hb=HEAD;hp=74ace2aaf2f9dd50b45099b518591e0fc33a5b83;hpb=9e37f9f283bb4c910f09b812b858bce3b4de3562;p=my-code%2Fkernel.git diff --git a/hello/hello.c b/hello/hello.c index 74ace2a..3b236b8 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -1,14 +1,22 @@ -/* my first kernel driver :-) */ +/* + * hello world kernel module + * + */ #include -#include +#include +#include -int init_module(void) { - printk(KERN_ALERT "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(KERN_ALERT "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);