且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何编写跨版本/平台的Linux内核模块?

更新时间:2022-12-16 20:39:44

Linux, ying yang . Tangrs 答案是好的;它回答了您的问题.但是,有 linux compat 项目.请参见 backports Wiki .基本上,有一些库为较新的Linux ABI提供 shim 功能,您可以使用它们来链接代码. Eugene 记录的KERNEL_VERSION宏在 compat.h 中进行了检查,并且适当地 compat-2.6.38.h 等,每个版本都有宏和/或库函数来提供 forward API.

Linux, the ying and the yang. Tangrs answer is good; it answers your question. However, there is the linux compat projects. See the backports wiki. Basically, there are libraries that provide shim functionality for newer Linux ABI's which you can use to link your code. The KERNEL_VERSION macro that Eugene notes is inspected in a compat.h, and appropriate compat-2.6.38.h, etc are included where each version has either macros and/or library functions to provide a forward API.

这使Linux Wifi小组可以为出血边缘内核编写代码,同时仍然可以在较旧的内核版本上进行编译.

This lets the Linux Wifi group write code for the bleeding edge kernel, while still making it possible to compile on older kernel versions.

我想这回答了这个问题,

I guess this answers the question,

是否有处理版本控制的标准方法?

if there are any standard ways to deal with versioning?

compat 库不是万能药,但至少它已经存在并且正在开发中.

The compat library is not a panacea, but at least it is there and under development.

开放源代码-有很多突变.他们都有不同的计划.