- 积分
- 15
贡献60
飞刀13 FD
注册时间2020-3-24
在线时间2 小时
|
从网上找了一个hello的驱动
#include <linux/init.h>
#include <linux/module.h>
int __init hello_init(void)
{
printk("Hello World enter ++\n");
return 0;
}
void __exit hello_exit(void)
{
printk("Hello world exit --\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("https://blog.csdn.net/qq_30155503");
MODULE_LICENSE("GPL v2");
Makefile内容如下:
obj-m := hello.o
KERNELDIR := /usr/src/linux-headers-3.2.0-23-generic-pae/
default:
make -C $(KERNELDIR) M=$(shell pwd) modules
install:
insmod hello.ko
uninstall:
rmmod hello.ko
clean:
make -C $(KERNELDIR) M=$(shell pwd) clean
执行make后,也生成了hello.ko
把hello.ko放到板子上后,执行insmod hello.ko失败
root@freescale /opt/QT4.8.6/apps$ insmod hello.ko
[16981.708507] hello: disagrees about version of symbol module_layout
insmod: can't insert 'hello.ko': invalid module format
这是什么问题? |
|