小议Linux staging tree
2011-03-08 23:14 wwang 阅读(11313) 评论(0) 编辑 收藏 举报2.6.28版本起,内核代码的drivers下增加了一个staging目录,这个目录也是用来存放驱动程序,只是这里的驱动和上层目录的不同,加载的时候内核log会打印如下的语句:
MODULE_NAME: module is from the staging directory, the quality is unknown, you have been warned.
drivers/staging究竟所谓何物,需要从Linux staging tree说起。
Greg KH于2008年6月10号在Linux内核邮件列表里发出一封信,宣布建立了另外一棵kernel tree,这就是Linux staging tree。Greg解释到,staging tree建立之目的是用来放置一些未充分测试或者因为一些其他原因未能进入内核的新增驱动程序和新增文件系统。在信中,Greg罗列了开发者把代码提交到staging tree应该遵循哪些规则,以及哪些行为是在staging tree不受欢迎的:
The rules of what can be included here is as follows: - the code must be released under a Linux kernel-compatible license - the goal of the developers must be to merge this code into the main kernel tree in the near future, but not for the next kernel release. - the code must build properly on the x86 platform - this is not a tree for bugfixes or rewrites of existing kernel code, this should be for new features, drivers, and filesystems. - the patches included must detail exactly what is needed to be completed in order for them to be included into the main kernel tree. - there must be some email address associated with the patch that can be used for bug reporting and questions about cleanups and testing the code. What this tree is not: - it is not a place to dump features that are being actively developed by a community of people (reiserfs4 for example.) - it is not a place to dump code and then run away, hoping that someone else will do the cleanup work for you. While there are developers available to do this kind of work, you need to get someone to agree to "babysit" the code.
但是,也有人对staging tree建立的必要性有些疑问的,毕竟,在此之前我们已经有了linux-next tree。Greg对这些疑问解释到,staging tree只是收留新增的驱动程序和文件系统,并不接收对已有代码的修改补丁。因此可以说,Greg的staging tree在很大程度上分担了Stephen Rothwell身上的压力,但并不意味着linux-next tree的角色定位发生了变化。
到这里,我们似乎应该比较了然了,对于新增的驱动我们提交的对象就是staging tree。但Greg在2009年3月18号发表的一篇博文带来了一些变故。
在文章中,Greg提到在数月前的Linux内核开发者的会议上,经过讨论Linux-staging tree的定位发生了变化,但还是很多人对staging tree究竟是什么有些疑惑。因此,Greg在这篇文章里重申了staging tree究竟是什么和不是什么(大概意思和上面引用的那封信里的内容类似)。并且,staging tree里的代码也已经被合并到了Linux内核代码里,位置正是本文开始提到的drivers/staging。也就是说,自2.6.28内核开始,我们如果要测试staging tree里的驱动程序或者文件系统,并不需要clone一个staging tree再合并到mainline内核里,mainline本身就已经包含了staging tree的代码了。对于Linux驱动开发者来说,我们也可以clone linux-next tree并以它为基础来提交驱动程序。
那这样是不是意味着Greg的linux staging tree已经没用了呢?我在提交驱动的时候也有这样的疑问,因此特意写信向Greg求证。Greg的回复说,如果我们要把新增的driver提交给他本人处理,还是可以继续基于linux staging tree来做patch;如果我们的工作不止是开发staging driver,比如还在为其他内核代码开发补丁,那么基于linux-next tree来制作patch也是可以的。
附:
Linux-next tree:
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
http://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Linux-staging tree:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6.git
http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6.git
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6.git
这里需要注意的是,git协议的端口号是9418,因为很多公司的防火墙只会开放80端口,所以clone代码仓库时如果git协议超时,不妨试试http协议。
作者:wwang
出处:http://www.cnblogs.com/wwang
本文采用知识共享署名-非商业性使用-相同方式共享 2.5 中国大陆许可协议进行许可,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
--------懒人评论(请勿重复点击)--------