linux 2.6 内核模块的Makefile
Linux 2.6 下内核模块的Makefile
收藏
Linux 2.6 下内核模块的Makefile
# Makefile 2.6
obj-m += hello.o
KDIR:=/lib/modules/$(shell uname -r)/build
# PWD=$(shell pwd)
all:
make -C $(KDIR) M=$(PWD) modules
clean:
make -C $(KDIR) M=$(PWD) clean
obj-m := hello.o表示编译后生成hello.o模块。
$(KDIR) 指定了内核源码的路径,“M=”表示这是个外部模块,M=$(PWD) 指定了该模块文件所在的路径。
注: makefile
预定义了$(PWD)
变量,此处可以不必重复定义。
如果是多个源文件编译出一个模块,假设模块名是test.ko,那么源文件名不能有test.c
obj-m := test.o
test-objs := file1.o file2.o file3.o
KDIR := /lib/modules/$(shell uname -r)/build
#PWD := $(shell pwd)
all:
make -C $(KDIR) M=$(PWD) modules
clean:
一个简单的内核模块示例:hello.c
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");
static int __iinit hello_init(void)
{
printk("hello, world\n");
return 0;
}
static void __exit hello_exit(void)
{
printk("goodbe\n");
}
module_init(hello_init);
module_exit(hello_exit);
相关文档:
Service Discovery Protocol(SDP)提供一种能力,让应用程序有方法发现哪种服务可用以及这种服务的特性。
服务发现协议(SDP或Bluetooth SDP)在蓝牙协议栈中对蓝牙环境中的应用程序有特殊的含意,发现哪个服务是可用的和确定这些可用服务的特征。SDP定义了bluetooth client发现可用bluetooth server服务和它们的特征的方法。 ......
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
At first, GCC is used for GNU C Compiler. At present,it supports JAVA Ada C++ and so on.
GCC编译流程分为:
1.Pre-Processing(预处理)
gcc -E -o hello.i hello.c
选项-E 使得编译器在预处理结束时停止编译
选项-o 指定GCC的输 ......
1,shell export 作用
http://blog.sina.com.cn/s/blog_62945c360100ffvk.html
2,alias ls="ls --color=auto"
安装了archlinux后,发现使用ls命令时,目录和文件并没有以颜色区分开来,觉得很不方便,所以就到网上搜了一下,发现可以使用alias命令:在/etc/profile的末尾加入alias ls="ls ......
Linux下Patch的应用和制作方法介绍 (1)
发布时间:2007.04.19 06:10 来源:赛迪网技术社区 作者:skid
因为在u-boot移植过程中,有几处通用文件要修改,如果每次都要手动修改就太麻烦了。制作补丁可以解决这个问题。
学习资料的收集比较简单, ......