QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5043|回复: 1

ldd3 9章的例子 short.c编译通不过:

[复制链接]
发表于 2010-5-20 02:04:50 | 显示全部楼层 |阅读模式
开始问题是:Fix it to use EXTRA_CFLAGS.  Stop.
改了Makefile 的CFLAGS 为 EXTRA_CFLAGS后可以编译。
但又是config.h找不到 io.h找不到,又改为: 
#include <linux/configfs.h>
#include <linux/io.h>
再编译:
出错:In function ‘short_selfprobe’:
/home/emachines/bbt/driver/examples/short/short.c:516: error: ‘SA_INTERRUPT’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:516: error: (Each undeclared identifier is reported only once
/home/emachines/bbt/driver/examples/short/short.c:516: error: for each function it appears in.)
/home/emachines/bbt/driver/examples/short/short.c:516: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:599:64: error: macro "INIT_WORK" passed 3 arguments, but takes just 2
/home/emachines/bbt/driver/examples/short/short.c: In function ‘short_init’:
/home/emachines/bbt/driver/examples/short/short.c:599: error: ‘INIT_WORK’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:626: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:626: error: ‘SA_INTERRUPT’ undeclared (first use in this function)
/home/emachines/bbt/driver/examples/short/short.c:627: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:640: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
/home/emachines/bbt/driver/examples/short/short.c:660: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:116: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
make[2]: *** [/home/emachines/bbt/driver/examples/short/short.o] Error 1
make[1]: *** [_module_/home/emachines/bbt/driver/examples/short] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'
make: *** [default] Error 2



----------
这下许多macro找不到 也grep不到,不知怎么改了。用的ubuntu /usr/src/linux-headers-2.6.31-14-generic


谁做过?怎么办?
发表于 2010-8-30 12:21:17 | 显示全部楼层
gcc 加参数。。。。。。。。。。
不过首先的是,你确定你机子上有kernel到源代码了?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-24 15:16 , Processed in 0.060280 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表