标签:linux内核 kernel gpl 内核 linux
linux内核模块基本组成
==============="GPL" : 表示你有发布软件的自由
/*************************************************************************
> File Name: hello.c
> Author: 梁惠涌
> Addr:
> Created Time: 2015年05月15日 星期五 20时16分57秒
************************************************************************/
//1 头文件
#include<linux/init.h>
#include<linux/module.h>
//2 模块加载
static int __init hello_init(){
printk(KERN_INFO"hello is module!\n");
return 0;
}
//3 模块卸载
static void __exit hello_exit(){
printk(KERN_INFO"hello is unmod!\n");
}
//4 模块许可声明
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
ifeq ($(KERNELRELEASE),) KERNELDIR =/home/farsight/work/kernel/linux-3.0.8 PWD =$(shell pwd) modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules cp hello.ko /opt/filesystem/s5pv210 modules_install: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install clean: rm -rf *.so *.o *.ko .tmp_versions *.mod.c *.order *.symvers else obj-m :=hello.o endif
标签:linux内核 kernel gpl 内核 linux
原文地址:http://blog.csdn.net/muyang_ren/article/details/45749659