<<linux设备驱动程序>>一书中原程序我從網站上剛下下來的可是使用make指令給我一打的錯誤不知為何望高手給與解決十分感謝謝.

book3 2004-08-30 05:35:27
<<linux设备驱动程序>>一书中原程序我從網站上剛下下來的可是使用make指令給我一打的錯誤不知為何望高手給與解決十分感謝謝.
...全文
210 1 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
沙沙的吹 2004-09-02
你下的源代码所使用的Linux版本可能不一样
回复
loveisbug 2004-09-02
别用root做事情。题外话。
回复
lichungen 2004-09-02
make config
make menuconfig
make xconfig
回复
lichungen 2004-09-02
你应该来make kernel以在kernel目录下生成.config文件
回复
book3 2004-08-30
main.c:212: warning: implicit declaration of function `kmalloc'
main.c:212: `GFP_KERNEL' undeclared (first use in this function)
main.c:212: warning: assignment makes pointer from integer without a cast
main.c:213: warning: implicit declaration of function `memset'
main.c: At top level:
main.c:226: warning: `struct file' declared inside parameter list
main.c: In function `scullc_read':
main.c:228: dereferencing pointer to incomplete type
main.c:237: `ERESTARTSYS' undeclared (first use in this function)
main.c:257: warning: implicit declaration of function `copy_to_user'
main.c: At top level:
main.c:274: warning: `struct file' declared inside parameter list
main.c: In function `scullc_write':
main.c:276: dereferencing pointer to incomplete type
main.c:285: `ERESTARTSYS' undeclared (first use in this function)
main.c:295: `GFP_KERNEL' undeclared (first use in this function)
main.c:295: warning: assignment makes pointer from integer without a cast
main.c:303: warning: implicit declaration of function `kmem_cache_alloc'
main.c:303: warning: assignment makes pointer from integer without a cast
main.c:310: warning: implicit declaration of function `copy_from_user'
main.c: At top level:
main.c:332: warning: `struct file' declared inside parameter list
main.c:332: warning: `struct inode' declared inside parameter list
main.c: In function `scullc_ioctl':
main.c:348: warning: implicit declaration of function `access_ok'
main.c:348: `VERIFY_WRITE' undeclared (first use in this function)
main.c:350: `VERIFY_READ' undeclared (first use in this function)
main.c:361: warning: implicit declaration of function `__get_user'
main.c:369: warning: implicit declaration of function `__put_user'
main.c: At top level:
main.c:426: warning: `struct file' declared inside parameter list
main.c: In function `scullc_llseek':
main.c:428: dereferencing pointer to incomplete type
main.c:437: dereferencing pointer to incomplete type
main.c:448: dereferencing pointer to incomplete type
main.c: At top level:
main.c:490: variable `scullc_fops' has initializer but incomplete type
main.c:491: unknown field `llseek' specified in initializer
main.c:491: warning: excess elements in struct initializer
main.c:491: warning: (near initialization for `scullc_fops')
main.c:492: unknown field `read' specified in initializer
main.c:492: warning: excess elements in struct initializer
main.c:492: warning: (near initialization for `scullc_fops')
main.c:493: unknown field `write' specified in initializer
main.c:493: warning: excess elements in struct initializer
main.c:493: warning: (near initialization for `scullc_fops')
main.c:494: unknown field `ioctl' specified in initializer
main.c:494: warning: excess elements in struct initializer
main.c:494: warning: (near initialization for `scullc_fops')
main.c:495: unknown field `open' specified in initializer
main.c:495: warning: excess elements in struct initializer
main.c:495: warning: (near initialization for `scullc_fops')
main.c:496: unknown field `release' specified in initializer
main.c:496: warning: excess elements in struct initializer
main.c:496: warning: (near initialization for `scullc_fops')
main.c: In function `scullc_trim':
main.c:512: warning: implicit declaration of function `kmem_cache_free'
main.c:514: warning: implicit declaration of function `kfree'
main.c: In function `scullc_init':
main.c:542: warning: implicit declaration of function `register_chrdev'
main.c:550: `GFP_KERNEL' undeclared (first use in this function)
main.c:550: warning: assignment makes pointer from integer without a cast
main.c:559: warning: implicit declaration of function `sema_init'
main.c:564: warning: implicit declaration of function `kmem_cache_create'
main.c:565: `SLAB_HWCACHE_ALIGN' undeclared (first use in this function)
main.c:566: warning: assignment makes pointer from integer without a cast
main.c:580: warning: implicit declaration of function `unregister_chrdev'
main.c: In function `scullc_cleanup':
main.c:598: warning: implicit declaration of function `kmem_cache_destroy'
main.c: At top level:
main.c:490: storage size of `scullc_fops' isn't known
make: *** [main.o] Error 1
回复
book3 2004-08-30
[root@arts root]# cd /root/ldd2-samples-1.0.1/scullc
[root@arts scullc]# make
gcc -Wall -D__KERNEL__ -DMODULE -I/usr/src/linux/include -O2 -I.. -c -o main.o main.c
In file included from main.c:34:
/usr/include/linux/malloc.h:3:2: warning: #warning The Use of linux/malloc.h is deprecated, use linux/slab.h
In file included from main.c:38:
/usr/include/linux/proc_fs.h:70: syntax error before "atomic_t"
/usr/include/linux/proc_fs.h:73: syntax error before '}' token
/usr/include/linux/proc_fs.h:203: syntax error before "void"
In file included from /usr/include/linux/bitops.h:69,
from /usr/include/asm/system.h:7,
from main.c:41:
/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/sched.h:14,
from ../sysdep.h:67,
from scullc.h:20,
from main.c:43:
/usr/include/linux/timex.h:173: field `time' has incomplete type
In file included from /usr/include/linux/signal.h:4,
from /usr/include/linux/sched.h:25,
from ../sysdep.h:67,
from scullc.h:20,
from main.c:43:
/usr/include/asm/signal.h:107: syntax error before "sigset_t"
/usr/include/asm/signal.h:110: syntax error before '}' token
In file included from /usr/include/linux/sched.h:81,
from ../sysdep.h:67,
from scullc.h:20,
from main.c:43:
/usr/include/linux/timer.h:45: syntax error before "spinlock_t"
/usr/include/linux/timer.h:53: syntax error before '}' token
/usr/include/linux/timer.h:67: syntax error before "tvec_base_t"
/usr/include/linux/timer.h:101: syntax 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 scullc.h:20,
from main.c:43:
../sysdep.h:243:27: asm/uaccess.h: 沒有此一檔案或目錄
In file included from ../sysdep.h:244,
from scullc.h:20,
from main.c:43:
/usr/include/asm/io.h:4:2: warning: #warning <asm/io.h> is deprecated, use <sys/io.h> instead
In file included from main.c:43:
scullc.h: At top level:
scullc.h:66: field `sem' has incomplete type
main.c:76: syntax error before '*' token
main.c:76: warning: type defaults to `int' in declaration of `scullc_cache'
main.c:76: warning: data definition has no type or storage class
main.c:175: warning: `struct file' declared inside parameter list
main.c:175: warning: `struct inode' declared inside parameter list
main.c: In function `scullc_open':
main.c:177: dereferencing pointer to incomplete type
main.c:185: dereferencing pointer to incomplete type
main.c:186: warning: implicit declaration of function `down_interruptible'
main.c:187: `ERESTARTSYS' undeclared (first use in this function)
main.c:187: (Each undeclared identifier is reported only once
main.c:187: for each function it appears in.)
main.c:189: warning: implicit declaration of function `up'
main.c:193: dereferencing pointer to incomplete type
main.c:195: warning: implicit declaration of function `atomic_inc'
main.c:195: union has no member named `usecount'
main.c: At top level:
main.c:199: warning: `struct file' declared inside parameter list
main.c:199: warning: `struct inode' declared inside parameter list
main.c: In function `scullc_release':
main.c:201: warning: implicit declaration of function `atomic_dec'
main.c:201: union has no member named `usecount'
main.c: In function `scullc_follow':
回复
相关推荐
发帖
Linux_Kernel
创建于2007-08-27

4156

社区成员

Linux/Unix社区 内核源代码研究区
申请成为版主
帖子事件
创建了帖子
2004-08-30 05:35
社区公告
暂无公告