QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1001|回复: 2

请教自己开发驱动的移植问题,谢谢大家

[复制链接]
发表于 2005-10-26 15:39:21 | 显示全部楼层 |阅读模式
我们在redhat7.2下开发了自己做的pci卡的驱动程序,7.2下编译正常,但重新安装了redhat9.0以后,使用:gcc -O2 -DMODULE -D__KERNEL__ -c -Wall pcimaptest.c

结果错误,具体提示如下,希望大家给点提示,谢谢!

In file included from /usr/include/linux/fs.h:23,
from /usr/include/linux/capability.h:17,
from /usr/include/linux/binfmts.h:5,
from /usr/include/linux/sched.h:9,
from pcimaptest.c:8:
/usr/include/linux/string.h:8:2: warning: #warning Using kernel header in userland!
In file included from /usr/include/linux/sched.h:14,
from pcimaptest.c:8:
/usr/include/linux/timex.h:173: field `time' has incomplete type
In file included from /usr/include/linux/bitops.h:69,
from /usr/include/asm/system.h:7,
from /usr/include/linux/sched.h:16,
from pcimaptest.c:8:
/usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not available on all architectures.
/usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in userspace: atomicity not guaranteed
In file included from /usr/include/linux/signal.h:4,
from /usr/include/linux/sched.h:25,
from pcimaptest.c:8:
/usr/include/asm/signal.h:107: parse error before "sigset_t"
/usr/include/asm/signal.h:110: parse error before '}' token
In file included from /usr/include/linux/sched.h:81,
from pcimaptest.c:8:
/usr/include/linux/timer.h:45: parse error before "spinlock_t"
/usr/include/linux/timer.h:53: parse error before '}' token
/usr/include/linux/timer.h:67: parse error before "tvec_base_t"
/usr/include/linux/timer.h:101: parse error before "tvec_bases"
/usr/include/linux/timer.h: In function `init_timer':
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:106: dereferencing pointer to incomplete type
/usr/include/linux/timer.h: In function `timer_pending':
/usr/include/linux/timer.h:121: dereferencing pointer to incomplete type
In file included from pcimaptest.c:9:
/usr/include/linux/proc_fs.h: At top level:
/usr/include/linux/proc_fs.h:70: parse error before "atomic_t"
/usr/include/linux/proc_fs.h:73: parse error before '}' token
/usr/include/linux/proc_fs.h:203: parse error before "void"
pcimaptest.c:20:25: asm/uaccess.h: No such file or directory
In file included from /usr/include/asm/dma.h:14,
from pcimaptest.c:24:
/usr/include/linux/delay.h:13:23: asm/delay.h: No such file or directory
In file included from pcimaptest.c:24:
/usr/include/asm/dma.h:138: parse error before "dma_spin_lock"
In file included from pcimaptest.c:24:
/usr/include/asm/dma.h:298:2: warning: #warning Using kernel headers in userspace!
pcimaptest.c:51: elements of array `parscurd_pci_tbl' have incomplete type
pcimaptest.c:52: warning: excess elements in struct initializer
pcimaptest.c:52: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:52: warning: excess elements in struct initializer
pcimaptest.c:52: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:53: `PCI_ANY_ID' undeclared here (not in a function)
pcimaptest.c:53: warning: excess elements in struct initializer
pcimaptest.c:53: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:53: `PCI_ANY_ID' undeclared here (not in a function)
pcimaptest.c:53: warning: excess elements in struct initializer
pcimaptest.c:53: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:53: warning: excess elements in struct initializer
pcimaptest.c:53: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:53: warning: excess elements in struct initializer
pcimaptest.c:53: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:53: warning: excess elements in struct initializer
pcimaptest.c:53: warning: (near initialization for `parscurd_pci_tbl[0]')
pcimaptest.c:54: warning: excess elements in struct initializer
pcimaptest.c:54: warning: (near initialization for `parscurd_pci_tbl[1]')
pcimaptest.c:101: warning: `struct file' declared inside parameter list
pcimaptest.c:101: warning: `struct inode' declared inside parameter list
pcimaptest.c: In function `parscurd_open':
pcimaptest.c:103: dereferencing pointer to incomplete type
pcimaptest.c:105: warning: implicit declaration of function `printk'
pcimaptest.c:105: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:105: (Each undeclared identifier is reported only once
pcimaptest.c:105: for each function it appears in.)
pcimaptest.c:105: parse error before string constant
pcimaptest.c:107: dereferencing pointer to incomplete type
pcimaptest.c:110: dereferencing pointer to incomplete type
pcimaptest.c:112: parse error before string constant
pcimaptest.c:115: warning: implicit declaration of function `atomic_inc'
pcimaptest.c:115: union has no member named `usecount'
pcimaptest.c:103: warning: unused variable `major'
pcimaptest.c: At top level:
pcimaptest.c:122: warning: `struct file' declared inside parameter list
pcimaptest.c:122: warning: `struct inode' declared inside parameter list
pcimaptest.c: In function `parscurd_release':
pcimaptest.c:124: dereferencing pointer to incomplete type
pcimaptest.c:125: warning: implicit declaration of function `atomic_dec'
pcimaptest.c:125: union has no member named `usecount'
pcimaptest.c:128: `KERN_ERR' undeclared (first use in this function)
pcimaptest.c:128: parse error before string constant
pcimaptest.c:132: dereferencing pointer to incomplete type
pcimaptest.c: At top level:
pcimaptest.c:139: warning: `struct file' declared inside parameter list
pcimaptest.c:139: warning: `struct inode' declared inside parameter list
pcimaptest.c: In function `parscurd_ioctl':
pcimaptest.c:159: warning: implicit declaration of function `copy_from_user'
pcimaptest.c:164: warning: implicit declaration of function `writel'
pcimaptest.c:174: warning: implicit declaration of function `readl'
pcimaptest.c:226: warning: implicit declaration of function `copy_to_user'
pcimaptest.c: At top level:
pcimaptest.c:296: warning: `struct file' declared inside parameter list
pcimaptest.c: In function `parscurd_read':
pcimaptest.c:307: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:307: parse error before string constant
pcimaptest.c:312: parse error before string constant
pcimaptest.c:315: parse error before string constant
pcimaptest.c:320: `KERN_ERR' undeclared (first use in this function)
pcimaptest.c:320: parse error before string constant
pcimaptest.c: At top level:
pcimaptest.c:329: warning: `struct file' declared inside parameter list
pcimaptest.c: In function `parscurd_write':
pcimaptest.c:340: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:340: parse error before string constant
pcimaptest.c:345: `KERN_ERR' undeclared (first use in this function)
pcimaptest.c:345: parse error before string constant
pcimaptest.c:351: parse error before string constant
pcimaptest.c: At top level:
pcimaptest.c:361: variable `parscurd_fops' has initializer but incomplete type
pcimaptest.c:362: unknown field `owner' specified in initializer
pcimaptest.c:362: warning: excess elements in struct initializer
pcimaptest.c:362: warning: (near initialization for `parscurd_fops')
pcimaptest.c:363: unknown field `read' specified in initializer
pcimaptest.c:363: warning: excess elements in struct initializer
pcimaptest.c:363: warning: (near initialization for `parscurd_fops')
pcimaptest.c:364: unknown field `write' specified in initializer
pcimaptest.c:364: warning: excess elements in struct initializer
pcimaptest.c:364: warning: (near initialization for `parscurd_fops')
pcimaptest.c:365: unknown field `ioctl' specified in initializer
pcimaptest.c:365: warning: excess elements in struct initializer
pcimaptest.c:365: warning: (near initialization for `parscurd_fops')
pcimaptest.c:366: unknown field `open' specified in initializer
pcimaptest.c:366: warning: excess elements in struct initializer
pcimaptest.c:366: warning: (near initialization for `parscurd_fops')
pcimaptest.c:367: unknown field `release' specified in initializer
pcimaptest.c:369: warning: excess elements in struct initializer
pcimaptest.c:369: warning: (near initialization for `parscurd_fops')
pcimaptest.c: In function `parscurd_probe':
pcimaptest.c:383: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:383: parse error before string constant
pcimaptest.c:386: warning: implicit declaration of function `pci_enable_device'
pcimaptest.c:391: warning: implicit declaration of function `pci_resource_start'
pcimaptest.c:392: warning: implicit declaration of function `pci_resource_len'
pcimaptest.c:403: `KERN_ERR' undeclared (first use in this function)
pcimaptest.c:403: parse error before string constant
pcimaptest.c:408: parse error before string constant
pcimaptest.c:413: parse error before string constant
pcimaptest.c:414: parse error before string constant
pcimaptest.c:419: warning: implicit declaration of function `kmalloc'
pcimaptest.c:419: `GFP_KERNEL' undeclared (first use in this function)
pcimaptest.c:422: parse error before string constant
pcimaptest.c:435: warning: implicit declaration of function `ioremap'
pcimaptest.c:435: warning: assignment makes pointer from integer without a cast
pcimaptest.c:436: warning: assignment makes pointer from integer without a cast
pcimaptest.c:437: warning: implicit declaration of function `virt_to_bus'
pcimaptest.c:438: warning: implicit declaration of function `pci_set_drvdata'
pcimaptest.c:440: dereferencing pointer to incomplete type
pcimaptest.c:446: warning: implicit declaration of function `register_chrdev'
pcimaptest.c:455: `__GFP_DMA' undeclared (first use in this function)
pcimaptest.c:458: parse error before string constant
pcimaptest.c:467: parse error before string constant
pcimaptest.c:471: warning: implicit declaration of function `kfree'
pcimaptest.c: In function `parscurd_remove':
pcimaptest.c:486: warning: implicit declaration of function `pci_get_drvdata'
pcimaptest.c:486: warning: initialization makes pointer from integer without a cast
pcimaptest.c:488: warning: implicit declaration of function `BUG'
pcimaptest.c:491: warning: implicit declaration of function `iounmap'
pcimaptest.c:496: warning: implicit declaration of function `unregister_chrdev'
pcimaptest.c:499: warning: implicit declaration of function `pci_disable_device'
pcimaptest.c:501: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:501: parse error before string constant
pcimaptest.c: At top level:
pcimaptest.c:513: variable `parscurd_pci_driver' has initializer but incomplete type
pcimaptest.c:514: unknown field `name' specified in initializer
pcimaptest.c:514: warning: excess elements in struct initializer
pcimaptest.c:514: warning: (near initialization for `parscurd_pci_driver')
pcimaptest.c:515: unknown field `id_table' specified in initializer
pcimaptest.c:515: warning: excess elements in struct initializer
pcimaptest.c:515: warning: (near initialization for `parscurd_pci_driver')
pcimaptest.c:516: unknown field `probe' specified in initializer
pcimaptest.c:516: warning: excess elements in struct initializer
pcimaptest.c:516: warning: (near initialization for `parscurd_pci_driver')
pcimaptest.c:517: unknown field `remove' specified in initializer
pcimaptest.c:517: warning: excess elements in struct initializer
pcimaptest.c:517: warning: (near initialization for `parscurd_pci_driver')
pcimaptest.c: In function `parscurd_init_module':
pcimaptest.c:530: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:530: parse error before string constant
pcimaptest.c:533: warning: implicit declaration of function `pci_module_init'
pcimaptest.c:534: parse error before string constant
pcimaptest.c: In function `parscurd_cleanup_module':
pcimaptest.c:541: warning: implicit declaration of function `pci_unregister_driver'
pcimaptest.c:543: `KERN_INFO' undeclared (first use in this function)
pcimaptest.c:543: parse error before string constant
pcimaptest.c: At top level:
pcimaptest.c:361: storage size of `parscurd_fops' isn't known
pcimaptest.c:513: storage size of `parscurd_pci_driver' isn't known
发表于 2005-10-26 16:09:02 | 显示全部楼层
用内核源码的头文件试试。
回复

使用道具 举报

 楼主| 发表于 2005-10-26 16:37:27 | 显示全部楼层
我知道问题了,原来是编译器的路径指定问题:

gcc -O2 -DMODULE -D__KERNEL__ -I/usr/src/linux-2.4 -c/include -Wall pcimaptest.c
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-11-5 02:04 , Processed in 0.041637 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

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