- 论坛徽章:
- 0
|
在红旗6下编译ldd一书中的scull字符设备驱动程序,出现如下错误
"make" -C "/lib/modules/`uname -r`/build" M=`pwd` modules
make[1]: Entering directory `/usr/src/linux-2.6.13.1'
CC [M] /root/scull.o
/root/scull.c: In function ‘scull_open’:
/root/scull.c:44: error: dereferencing pointer to incomplete type
/root/scull.c:44: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/root/scull.c:44: warning: initialization from incompatible pointer type
/root/scull.c:44: error: invalid use of undefined type ‘struct scull_dev’
make[2]: *** [/root/scull.o] 错误 1
make[1]: *** [_module_/root] 错误 2
make[1]: Leaving directory `/usr/src/linux-2.6.13.1'
make: *** [all] 错误 2
看了一下代码,应该是在使用container_of宏时,发生了错误,去网上查了一下,好像是缺少了某个头文件。但是程序中的头文件没有缺少啊?
使用的Makefile文件如下:
ifneq ($(KERNELRELEASE),)
obj-m:=scull.o
else
MAKE="make"
KERDIR="/lib/modules/`uname -r`/build"
all:
${MAKE} -C $(KERDIR) M=`pwd` modules
endif
.PHONY:clean
clean:
-rm -rf *.ko *.mod* *.o
已经弄了好几天了,还是没有头绪,请知道的人给予指点,不胜感激啊!!! |
|