2.6下的内核模块编译
时间:2006-07-05 来源:strongzgy
1.一个模快中只有一个文件的编译
Makefile如下:
obj-m := hello.o
运行时:make -C /lib/modules/`uname -r`/build M=`pwd`
2.一个模块中多个文件的编译
Makefile如下:
obj-m := hello.o
hello-objs := hello1.o hello2.o
运行时:make -C /lib/modules/`uname -r`/build M=`pwd`
3.多个文件编译多个模块,模快之间有引用
文件结构: |
------------------------------
| | |
Makefile foo/ bar/
| |
-------- -------
| | | |
Makefile hello1.c Makefile hello2.c
顶极Makefile文件的写法:
obj-y := foo/ bar/
下一级的Makefile文件写法同1和2
在顶极Makefile所在的目录下运行:
make -C /lib/modules/`uname -r`/build M=`pwd`
Makefile如下:
obj-m := hello.o
运行时:make -C /lib/modules/`uname -r`/build M=`pwd`
2.一个模块中多个文件的编译
Makefile如下:
obj-m := hello.o
hello-objs := hello1.o hello2.o
运行时:make -C /lib/modules/`uname -r`/build M=`pwd`
3.多个文件编译多个模块,模快之间有引用
文件结构: |
------------------------------
| | |
Makefile foo/ bar/
| |
-------- -------
| | | |
Makefile hello1.c Makefile hello2.c
顶极Makefile文件的写法:
obj-y := foo/ bar/
下一级的Makefile文件写法同1和2
在顶极Makefile所在的目录下运行:
make -C /lib/modules/`uname -r`/build M=`pwd`
相关阅读 更多 +