一个最简单的linux hello world模块

#include<linux/init.h>
#include<linux/module.h>
//MODULE_LICNESE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT " hello fish!\n");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT " bye fish!\n");
}
module_init(hello_init);
module_exit(hello_exit);

makefile:

path= /lib/modules/$(shell uname -r)/build
PWD= $(shell pwd)
obj-m:=hello.o
default:
        make -C $(path) M=$(PWD) modules

原文地址:https://www.cnblogs.com/fish124423/p/2687398.html