LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1427|回复: 12

debian的kernel源码在那个文件下面?

[复制链接]
发表于 2006-11-16 17:38:22 | 显示全部楼层 |阅读模式
这几天装声卡驱动,可是下载的是一个适合FC4的版本,现在想移植到debian下面,可是在编译的时候链接不到debian的内核,原因是其默认的内核位置和debian的不同,但是我现在貌似没有找到debian的内核位置,哪位同仁给提供一下?
发表于 2006-11-16 21:37:55 | 显示全部楼层
Post by windrain
这几天装声卡驱动,可是下载的是一个适合FC4的版本,现在想移植到debian下面
以前我不相信,也没试过 FC 的内核包,原来在某些情况下,别的发行版的内核是能够用的,比如 Debian 下用 LFS 系统的内核
可是在编译的时候链接不到debian的内核,原因是其默认的内核位置和debian的不同,但是我现在貌似没有找到debian的内核位置,哪位同仁给提供一下?
什麽意思?编译内核要找现在内核的位置吗?
回复 支持 反对

使用道具 举报

发表于 2006-11-16 23:09:56 | 显示全部楼层
你安装的系统的是什么类型?(stable、testing、sid)

aptitude search kernel-image|grep ^i
或者
aptitude search linux-image|grep ^i
由此可以知道你的系统中安装的是哪个内核,知道了内核后,就可以安装相应的内核头文件。
通常情况下,编译内核模块的时候,是不需要源码的,只要有头文件就可以了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-16 23:15:00 | 显示全部楼层
多谢,我再找找看。
现在装的stable版,
声卡驱动类型为adi ad1986a,安装的是alsa的驱动
执行./congfigure时,提示下面的错误:
dcs-debian:~/Audio/alsa-driver-1.0.10rc3# ./configure
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking whether time.h and sys/time.h may both be included... yes
checking whether gcc needs -traditional... no
checking for current directory... /root/Audio/alsa-driver-1.0.10rc3
checking cross compile...
checking for directory with kernel source... /lib/modules/2.6.8-3-386/source
checking for directory with kernel build... /lib/modules/2.6.8-3-386/build
checking for kernel linux/version.h... no
The file /lib/modules/2.6.8-3-386/source/include/linux/version.h does not exist.Please install the package with full kernel sources for your distribution
or use --with-kernel=dir option to specify another directory with kernel
sources (default is /lib/modules/2.6.8-3-386/source).
帮我分析分析看是什么原因?
回复 支持 反对

使用道具 举报

发表于 2006-11-17 07:01:48 | 显示全部楼层
Post by springwind426
你安装的系统的是什么类型?(stable、testing、sid)

aptitude search kernel-image|grep ^i
或者
aptitude search linux-image|grep ^i
由此可以知道你的系统中安装的是哪个内核,知道了内核后,就可以安装相应的内核头文件。
通常情况下,编译内核模块的时候,是不需要源码的,只要有头文件就可以了。
似乎普遍人都有一个误区,内核要对应相应的内核头文件。其实不然,系统真正要对应的头文件是系统编译 Glibc 那个时候的头文件。

引自 LFS 手册第 8 章编译内核的部份
http://www.linuxfromscratch.org/ ... apter08/kernel.html
Warning

Some kernel documentation recommends creating a symlink from /usr/src/linux pointing to the kernel source directory. This is specific to kernels prior to the 2.6 series and must not be created on an LFS system as it can cause problems for packages you may wish to build once your base LFS system is complete.

Also, the headers in the system's include directory should always be the ones against which Glibc was compiled, that is, the ones from the Linux-Libc-Headers package, and therefore, should never be replaced by the kernel headers.

以下是引自 CLFS x86_64 multilib 手册编译内核的部份,分别在 header 文件,Debian 仍采用 Linux-Libc-Headers,但 Linux-Libc-Headers project 其实已寿终正寝了!
http://cross-lfs.org/view/svn/x86_64/bootable/kernel.html
Warning

Some kernel documentation recommends creating a symlink from /usr/src/linux pointing to the kernel source directory. This is specific to kernels prior to the 2.6 series and must not be created on a CLFS system as it can cause problems for packages you may wish to build once your base CLFS system is complete.

Also, the headers in the system's include directory should always be the ones against which Glibc was compiled (from the Linux-Headers package) and should never be replaced by the kernel headers.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-17 10:39:54 | 显示全部楼层
Post by windrain

checking cross compile...
checking for directory with kernel source... /lib/modules/2.6.8-3-386/source
checking for directory with kernel build... /lib/modules/2.6.8-3-386/build
checking for kernel linux/version.h... no
The file /lib/modules/2.6.8-3-386/source/include/linux/version.h does not exist.Please install the package with full kernel sources for your distribution
or use --with-kernel=dir option to specify another directory with kernel
sources (default is /lib/modules/2.6.8-3-386/source).

在执行交叉编译的时候找不到kernel source,kernel build,kernel linux/version.h,提示我kernel源码的目录错误。但是相同的alsa驱动在slackware上面安装是正常的,感觉很奇怪,莫非debian还没有什么过人之处?敬请高人指教!
回复 支持 反对

使用道具 举报

发表于 2006-11-17 12:50:13 | 显示全部楼层
加装 linux-kernel-headers 看看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-17 13:49:43 | 显示全部楼层
Post by d00m3d
加装 linux-kernel-headers 看看


我装的已经是最新的 linux-kernel-headers 了,貌似不是这个的问题,给我的感觉是 default is /lib/modules/2.6.8-3-386/source 这个有问题,因为source是一个链接,而这个链接是在tmp文件夹下,是一个无效的链接,有点不明白?
回复 支持 反对

使用道具 举报

发表于 2006-11-17 16:10:44 | 显示全部楼层
linux-headers-`uname -r` ?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-17 16:26:31 | 显示全部楼层
Post by eieng
linux-headers-`uname -r` ?


能不能说清楚一点?
我在网上查了一下,比较可靠的原因是没有装内核头文件,要重装内核头文件。
缺少内核头文件
不知道你用什么版本内核
把相应版本的内核头文件装上就好了
嫌麻烦的话把整个内核源代码解压到/usr/src下
然后做个到linux的链接 ln -s /usr/src/linux-version /usr/src/linux

不知道我具体怎么做,我的内核版本是2.6.8-3-386。
高手指点一下!
回复 支持 反对

使用道具 举报

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

本版积分规则

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