怎么把写好的驱动程序编译成目标程序?

chsal 2004-02-14 08:31:48
是不是只用gcc -O2 -DMODULE -D__KERNEL__ -c XX.c -o XX.o不行啊
我试着编译了一下/usr/src/linux-2.4.20-8/drivers/char 里面的busmouse.c
我的Linux版本时Redhat9.0
结果报了好多错误啊,我在书上抄的也一样,好多错误
具体那个busmouse.c的错误如下,很大很大,我分页给出:

[root@Grey char]# gcc -O2 -DMODULE -D_KERNEL_ -c busmouse.c -o busmuose.o
In file included from /usr/include/linux/sched.h:14,
from busmouse.c:13:
/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 busmouse.c:13:
/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 busmouse.c:13:
/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 busmouse.c:13:
/usr/include/linux/timer.h:32: field `vec' has incomplete type
/usr/include/linux/timer.h:37: field `vec' has incomplete type
/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:63: field `list' has incomplete type
/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 /usr/include/linux/pagemap.h:15,
from /usr/include/linux/locks.h:8,
from /usr/include/linux/devfs_fs_kernel.h:6,
from /usr/include/linux/miscdevice.h:4,
from busmouse.c:19:
/usr/include/asm/pgtable.h:17:24: asm/fixmap.h: 没有那个文件或目录
In file included from /usr/include/linux/pagemap.h:15,
from /usr/include/linux/locks.h:8,
from /usr/include/linux/devfs_fs_kernel.h:6,
from /usr/include/linux/miscdevice.h:4,
from busmouse.c:19:
/usr/include/asm/pgtable.h: At top level:
/usr/include/asm/pgtable.h:24: parse error before "swapper_pg_dir"
In file included from /usr/include/asm/pgtable.h:115,
from /usr/include/linux/pagemap.h:15,
from /usr/include/linux/locks.h:8,
from /usr/include/linux/devfs_fs_kernel.h:6,
from /usr/include/linux/miscdevice.h:4,
from busmouse.c:19:
...全文
61 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
[14本经典Android开发教程]-11-Android系统移植技术详解 -------------------------------------------------- (1)安装如下软件包 sudo apt-get install git-core sudo apt-get install gnupg sudo apt-get install sun-java5-jdk sudo apt-get install flex sudo apt-get install bison sudo apt-get install gperf sudo apt-get install libsdl-dev sudo apt-get install libesd0-dev sudo apt-get install build-essential sudo apt-get install zip sudo apt-get install curl sudo apt-get install libncurses5-dev sudo apt-get install zlib1g-dev .... -------------------------------------------------- 已上传9本: [14本经典Android开发教程]-1-Android开发从入门到精通 http://download.csdn.net/detail/cleopard/8355245 [14本经典Android开发教程]-2-Android开发手册—API函数详解 http://download.csdn.net/detail/cleopard/8374487 [14本经典Android开发教程]-3-Android SDK 中文开发文档 http://download.csdn.net/detail/cleopard/8380429 [14本经典Android开发教程]-4-Android应用程序开发36技 http://download.csdn.net/detail/cleopard/8380495 [14本经典Android开发教程]-5-linux Android基础知识总结 http://download.csdn.net/detail/cleopard/8380529 [14本经典Android开发教程]-6-Android驱动开发入门及手机案例开发分析教程 http://download.csdn.net/detail/cleopard/8388019 ....... 剩余3本稍后上传!@或直接从这里寻找@ http://download.csdn.net/user/cleopard/album @更多@ http://cleopard.download.csdn.net/ 福利 http://xuemeilaile.com 17份软件测试文档 http://download.csdn.net/album/detail/1425 13份WPF经典开发教程 http://download.csdn.net/album/detail/1115 C#资料合辑二[C#桌面编程入门篇] http://download.csdn.net/album/detail/957 C#资料合辑一[C#入门篇] http://download.csdn.net/album/detail/669 [Csharp高级编程(第6版)](共8压缩卷) http://download.csdn.net/album/detail/667 10个[精品资源]Java学习资料合辑[一] http://download.csdn.net/album/detail/663 10个C#Socket编程代码示例 http://download.csdn.net/album/detail/631 6份GDI+程序设计资源整合[全零分] http://download.csdn.net/album/detail/625 2014年移动游戏行业数据分析 http://download.csdn.net/detail/cleopard/8340331 一文读懂2014年全球互联网广告新生态 http://download.csdn.net/detail/cleopard/8340303

4,468

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧