Skip to content

Instantly share code, notes, and snippets.

@suxue
Last active August 29, 2015 14:05
Show Gist options
  • Save suxue/cc8ab8e73956c2e5d322 to your computer and use it in GitHub Desktop.
Save suxue/cc8ab8e73956c2e5d322 to your computer and use it in GitHub Desktop.
hello world LKM
.built-in.o.cmd
.hello.ko.cmd
.hello.mod.o.cmd
.hello.o.cmd
.tmp_versions/
Module.symvers
hello.ko
hello.mod.c
modules.order
#include <linux/module.h>
#include <linux/init.h>
static int __init mymodule_init(void)
{
printk ("My module worked!\n");
return 0;
}
static void __exit mymodule_exit(void)
{
printk ("Unloading my module.\n");
return;
}
module_init(mymodule_init);
module_exit(mymodule_exit);
MODULE_LICENSE("GPL");
obj-m += hello.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment