tc1989tc 发表于 2013-03-12 20:22

第一次接触简单的insmod遇到的困难

本帖最后由 tc1989tc 于 2013-03-13 18:52 编辑

自己写了个简单的模块装载测试程序,但是按照linux设备驱动开发的例子写的makefile编译出现如下错误:是怎么回事啊望指导

[@localhost tclll]$ ls
Makefiletest_module.c
[@localhost tclll]$ make
Makefile:8: *** commands commence before first target.Stop.
[@localhost tclll]$



makefile文件如下这么写的:
ifneq ($(KERNELRELEASE),)
        obj-m := test_module.o
else
        KERNELDIR ?= /lib/modules/$(shell uname -r)/bulid
        PWD := $(shell pwd)
        default:
                $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif


ptostrike 发表于 2013-03-13 11:44

TAB问题吧,目标前面不要用tab,命令以tab开头

tc1989tc 发表于 2013-03-13 18:51

回复 2# ptostrike


    现在改了tab开头后,,出现的错误如下
make -C /lib/modules/2.6.32-220.el6.i686/bulid M=/home/tc/tclll modules
make: *** /lib/modules/2.6.32-220.el6.i686/bulid: No such file or directory.Stop.
make: *** Error 2

tc1989tc 发表于 2013-03-13 19:11

回复 3# tc1989tc


    谢谢 知道了写错啦

tc1989tc 发表于 2013-03-13 19:30

回复 2# ptostrike

???
    又出现问题了我insmod的时候,没有报错,但是它没有执行我的module_init里面的初始函数啊??

xmayyang 发表于 2013-03-16 09:34

你的Init函数是干什么的?你是如何判断没有执行init函数的?如果printk的话,可以去/var/log/message里面看看
页: [1]
查看完整版本: 第一次接触简单的insmod遇到的困难