linux内核模块构建先决条件
作者:互联网
kernel.org kbuild文档(https://www.kernel.org/doc/Documentation/kbuild/modules.txt)的“如何构建外部模块”部分说:
To build external modules, you must have a prebuilt kernel available
that contains the configuration and header files used in the build.
Also, the kernel must have been built with modules enabled. If you are
using a distribution kernel, there will be a package for the kernel
you are running provided by your distribution.An alternative is to use the “make” target “modules_prepare.”
我的问题是,替代什么?替代
“have a prebuilt kernel available that contains the configuration and
header files”
要么
“the kernel must have been built with modules enabled”
或者是其他东西?
解决方法:
它是“使用分发包”的替代方案,这与“配置和头文件”可用是同义词.
在执行此操作之前,应该包含.config.大多数发行版内核都在/proc/config.gz中提供了这个内容.将其复制到源树的顶部和
gunzip -c config.gz > .config
这仅在源版本为> =正在运行的内核时才有效.请注意,如果您打算将模块与正在运行的内核一起使用,则源版本号应该完全相同.
标签:linux,kernel,kernel-modules 来源: https://codeday.me/bug/20190817/1672802.html