|
楼主 |
发表于 2006-3-10 11:26:38
|
显示全部楼层
Post by biinn
这一行最前面要有一个 TAB,不能在第一列上,注意,是TAB, 不是空格,
哦~~~这样啊~~谢谢啦~~~
运行 $ sudo make
又有了一大串错误提示:
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c zariphix_modules_001.c
In file included from /usr/include/linux/sched.h:16,
from /usr/include/linux/module.h:9,
from zariphix_modules_001.c:2:
/usr/include/linux/signal.h:2:2: warning: #warning "You should include <signal.h>. This time I will do it for you."
In file included from /usr/include/linux/resource.h:4,
from /usr/include/linux/sched.h:79,
from /usr/include/linux/module.h:9,
from zariphix_modules_001.c:2:
/usr/include/linux/time.h:9: 错误:‘struct timespec’ 重定义
/usr/include/linux/time.h:15: 错误:‘struct timeval’ 重定义
/usr/include/linux/time.h:20: 错误:‘struct timezone’ 重定义
/usr/include/linux/time.h:47: 错误:‘struct itimerval’ 重定义
In file included from zariphix_modules_001.c:2:
/usr/include/linux/module.h:41: 错误:字段 ‘attr’ 的类型不完全
/usr/include/linux/module.h:49: 错误:字段 ‘kobj’ 的类型不完全
zariphix_modules_001.c: 在函数 ‘init_module’ 中:
zariphix_modules_001.c:5: 警告:隐式声明函数 ‘printk’
make: *** [zariphix_modules_001.o] 错误 1
这是怎么回事呢?是我没有在我的.c文件中引入<signal.h>的原故吗?
还有如果把makefile写成
obj-m := zariphix_modules_001.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
这两者有什么不同吗?谢谢回答 |
|