找回密码
 注册
查看: 767|回复: 7

关于内核编译

[复制链接]
发表于 2004-4-12 16:25:04 | 显示全部楼层 |阅读模式
我是一个新手,有如下问题请教:
在用gcc编译内核中的某个文件(如time.c)时,为什么还会出错(错误很多,就列举了)?如何解决?
由于要写一个内核函数,所以现在这些基本问题把我卡住了,望能得到指教,谢谢!
发表于 2004-4-14 11:18:27 | 显示全部楼层
usually u can not use gcc to compile a c file in kernel directly. u need many flags. so please use make. that is the reason why people make 'make'
回复

使用道具 举报

发表于 2004-4-16 11:08:56 | 显示全部楼层
楼上的大哥,用make怎么编译c文件呀?
回复

使用道具 举报

发表于 2004-4-16 11:58:18 | 显示全部楼层
same as how u use the make to recompile kernel. make read a file , default is Makefile, to know the compile flag. then check which files need to compile, then compile it. of course, make is not limited to compile c program. i always use make to work on latex.
回复

使用道具 举报

 楼主| 发表于 2004-4-17 10:50:55 | 显示全部楼层
那请问,如果我写的一个内核函数仅有一些小错误,甚至只是语法错误,那我岂不是要通过编译整个内核才能发现?
回复

使用道具 举报

发表于 2004-4-17 18:10:47 | 显示全部楼层
二楼的大哥,您说“usually u can not use gcc to compile a c file in kernel directly. u need many flags. so please use make. ”。我的英文不太好,您的意思是说:“通常你不能用GCC去直接编译内核的c文件,你需要一些参数,所以请使用make“吗?如果您说的是这个意思,可是我记得好像编译内核的makefile 文件里也是调用的GCC吧?请指点
回复

使用道具 举报

发表于 2004-4-21 22:18:11 | 显示全部楼层
[quote:d63829f97f="clx0402"]那请问,如果我写的一个内核函数仅有一些小错误,甚至只是语法错误,那我岂不是要通过编译整个内核才能发现?[/quote]

the make system will detect and only compile modified part. so it is very fast.
回复

使用道具 举报

 楼主| 发表于 2004-4-23 10:03:50 | 显示全部楼层
谢谢
回复

使用道具 举报

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

本版积分规则

GMT+8, 2025-2-6 03:56 , Processed in 0.025221 second(s), 15 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

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