我是 linux 的新手。我必须编译一个设备驱动程序示例代码。
我尝试从 synaptic 安装 linux-source-2.6.38,然后它显示了下面引用的消息:
This package provides the source code for the Linux kernel version 2.6.38.
This package is mainly meant for other packages to use, in order to build custom flavours.
If you wish to use this package to create a custom Linux kernel, then it is suggested that you investigate the package kernel-package, which has been designed to ease the task of creating kernel image packages.
If you are simply trying to build third-party modules for your kernel, you do not want this package. Install the appropriate linux-headers package instead.
所以感到困惑:
1) 我的设备驱动程序代码编译是否需要 linux 源代码?
2) 如果我安装了新内核,我该如何使用新内核?
最佳答案
您可能需要像 linux-headers-2.6-amd64
和 linux-kbuild-2.6
这样的软件包。使用 apt-cache search linux headers
和 apt-cache search linux kbuild
来准确找到包的名称。
您可以使用 apt-cache search linux headers
和 apt-cache search linux kbuild
来获取包的确切名称。
如果您正在制作一个模块(一个可动态加载的内核模块*.ko
),您不需要构建一个新内核。使用 insmod
或 modprobe
加载它。
关于linux - 设备驱动程序代码编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9208833/