LINUX编译ko文件
makefile
#include <linux/kernel.h>
#include <linux/module.h> //on pc you should use "tail -f /var/log/messages " to see the result static int __init mini6410_hello_module_init(void) { printk("Hello, Mini6410 module is installed !\n"); return 0; } static void __exit mini6410_hello_module_cleanup(void) { printk("Good-bye, Mini6410 module was removed!\n"); } module_init(mini6410_hello_module_init); module_exit(mini6410_hello_module_cleanup); MODULE_LICENSE("GPL");
pc
### the ko name should be the same as the C file
### this is for gcc on PC obj-m:=mykotest.o mymodule-objs:=module KDIR:=/lib/modules/2.6.27.5-117.fc10.i686/build/ MAKE:=make default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm -rf *.o *.~ *.ko Module.* *.mod.* modules.*
arm
### the ko name should be the same as the C file ### this is for arm-linux-gcc on ARM A=ar ARCH=arm CC=arm-linux-gcc obj-m :=mykotest.o mymodule-objs:=module KDIR :=/opt/linux-3.0.8/ PWD :=$(shell pwd) MAKE :=make all: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules clean: rm -rf *.o *~ *.ko *mod*
相关推荐
jiangtie 2020-08-15
杨立峰 2020-07-18
linjava 2020-06-14
secondid 2020-06-06
昭君出塞 2020-06-03
jackadmi 2020-06-03
xushxbigbear微信 2020-05-16
chenchuang 2020-05-10
89467505 2020-05-08
sunln00 2020-05-07
youandme 2020-05-06
playis 2020-05-04
ningningmingming 2020-05-01
LychieFan 2020-04-30
spartmap 2020-04-20
咏月东南 2020-04-20
jeonkc 2020-04-19