Linux知识:在内核树外维护模块
1.先在模块代码所在的目录新建一个Makefile, 内容为:
obj-m := hello.o
这样调用make命令:
make -C /usr/local/src/kernel/linux-2.6.16.20 SUBDIRS=$PWDmodules
2.进化后
obj-m += hello.oall: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
3.再进化后
obj-m := hello.o
hello-objs := file1.o file2.o
KERNELDIR = /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
注:估计KERNELDIR因该赋值为嵌入式内核源码的的位置
相关推荐
tianhuak 2020-11-24
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
applecarelte 2020-10-16
ourtimes 2020-10-16
farwang 2020-11-25
星愿心愿 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20