;1.编译错误(其实这个问题和 Makefile有很大关系) 2.Invalid module format 错误 3.insmod: error inserting "./hello.ko": -1 File exists 开发环境 内核版本:2.6.22(我下载的最新版本) gcc:gcc (GCC) 4.1.2 Makefile gcc -D__KERNEL__ -DMODULE -DLINUX -I /usr/local/src/linux2.4/include -c -o hello.o hello.c 上面这种写法适合 2.4 版本的内核,在2.6下用这种写法很可能导致许多编译错误,即使编译通过也会产生 Invalid module format 错误 。2.6下正确的 Makefie 如下: # Makefile2.6ifneq ($(KERNELRELEASE),)#kbuild syntax. dependency relationshsip of files and target modules are listed here.mymodule-objs := hello.oobj-m := hello.o elsePWD := $(shell pwd)KVER ?= $(shell uname -r)KDIR := /lib/modules/$(KVER)/buildall:$(MAKE) -C $(KDIR) M=$(PWD)clean:rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versionsendif使用上面的 Makefie 同时也解决了 Invalid module format 错误 insmod: error inserting "./hello.ko": -1 File exists 错误解决 第一次insmod ./hello.ko 没有输出表示你的模块被正常载入了,后来的错误是你重复载入这个模块导致的 用命令 lsmod | grep hello 看看是不是有这个模块? 用命令 tail /var/log/messages 有 hello,world module程序正常执行 。
- 下载: 来自硬件官方Vista驱动程序大全
- 修复和更新驱动程序 全部自己来手动
- Intel RAID Vista驱动存在重大缺陷
- 驱动人生软件好用吗 驱动人生软件介绍
- 驱动精灵如何备份与还原?备份还原过程步骤解析
- ATI 和 NVIDIA Vista 驱动大对比
- nForce 4/5/6 Vista WHQL驱动发布
- 实战宝典:如何双引导Vista和Linux
- 下载:S3 Chrome显卡Vista正式驱动
- 体验精彩Vista 多款相关显卡驱动全面更新
