LinuxSir.cn,穿越时空的Linuxsir!

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

请教内核patch对应版本问题

[复制链接]
发表于 2009-3-18 09:48:48 | 显示全部楼层 |阅读模式
1、现在最新的2.4内核补丁是patch-2.4.37.bz2,我能不能打到2.4.20内核上?

2、请问2.4的内核patch是不是都能打到其低版本的2.4.X上?那2.6呢?

即我不太清楚,一个内核patch,是为哪一个内核版本定制的
请高手们回答一下,谢谢:-)
发表于 2009-3-18 21:21:32 | 显示全部楼层
如果那部分代码没有改动就可以打上,如果改动了,就打不上了,如果变动不是太大,你自己可以稍微修改,如果改动很大,那么就没有办法,除非你了解可以重新写补丁
回复 支持 反对

使用道具 举报

发表于 2009-3-18 22:51:36 | 显示全部楼层
Post by slackcode;1962544
1、现在最新的2.4内核补丁是patch-2.4.37.bz2,我能不能打到2.4.20内核上?
不能

Post by slackcode
2、请问2.4的内核patch是不是都能打到其低版本的2.4.X上?那2.6呢?

即我不太清楚,一个内核patch,是为哪一个内核版本定制的
请高手们回答一下,谢谢:-)
同樣不能

所謂補丁者,其實是修改過的源碼部份跟原文之間的差異,diff 者也

2.4.20 跟 2.4.37 兩個版本相距甚遠,差異太多了,要逐級補上才行

2.6 內核自 2.6.8 後改為 4 位數,即 2.6.x.y,補丁方式也改了,跟 2.4 的逐級上不同
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-3-19 00:34:32 | 显示全部楼层
嗯,明白了
我一般都会去下载完整版的
但今天看到几百KB的patch,有点不太懂,想知道一下
http://linuxsir.cn/bbs/thread346734.html有From "Linux Kernel in a Nutshell"的一段话
回复 支持 反对

使用道具 举报

发表于 2009-3-19 19:46:38 | 显示全部楼层
这段话在官方网页都有的,除此之外,还有其他开发中的内核补丁的使用方法,想尝鲜的人最合用

现在 2.6.x.y 的补丁方式挺好的,无需每次去下数十 MB 回来解包,建议多采用
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-3-19 22:20:13 | 显示全部楼层
2.6.x.y的补丁方式又是如何的?
回复 支持 反对

使用道具 举报

发表于 2009-3-20 06:25:59 | 显示全部楼层
附图是今天的 www.kernel.org 首页

1. 当前最新稳定的内核版本是 2.6.28.8,第一个 patch 是

http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.28.8.bz2

这个 patch 是供 2.6.28 内核使用的,也就是说先把 2.6.28 这个版的完整大 tarball (这个要几十MB)下回来再把上述补丁打上就行,如果将来出了 2.6.28.9,那麽就把 2.6.28.9 的补丁打到 2.6.28 源码里(不是 2.6.28.8)

即是说 2.6.x.y 的补丁打到 2.6.x 内核源码就行

2. 第二个是 prepatch,开发中的版本,今天的版本是 2.6.29-rc8
使用方法这里记载了:
http://www.kernel.org/patchtypes/pre.html
Linux kernel prepatches
Prepatches are the equivalent to alpha releases for Linux; they live in the testing directories in the archives. They should be applied using the patch(1) utility to the source code of the previous full release with a 3-part version number (for example, the 2.6.12-rc4 prepatch should be applied to the 2.6.11 kernel sources, not, for example, 2.6.11.10.)

The testing/incr directories contain automatically generated patches from one prepatch to another.

Prepatches may be poorly tested, and may in fact not work at all. Use on your own risk; if you use one and run into a problem please see Reporting Linux Kernel Bugs on the front page.

Prepatches with -rc in the name are considered release candidates and may become full versions. It is therefore particularly important that those get tested.


同样地,这个补丁是打到 2.6.x 版的内核源码里的,以上述的例子把
http://www.kernel.org/pub/linux/ ... atch-2.6.29-rc8.bz2

打到 2.6.28 的源码里便会变成 2.6.29-rc8 了

3. 第三个是 snapshot,当前开发版本中的最新镜映-git4,用法记在 http://www.kernel.org/patchtypes/snapshot.html
Linux kernel snapshots
Snapshots are images from the developers repository trees. They are created automatically without any human consideration, and thus they may not work, and may not even compile at any particular time. They live in the snapshots directories in the archives, and should be applied using the patch(1) utility to the source code of the release they are derived from. For example, to get the full source code to snapshot 2.6.1-rc1-git5, get and extract the linux-2.6.0.tar.bz2 archive, then use the patch utility to apply patch-2.6.1-rc1.bz2 followed by patch-2.6.1-rc1-git5.bz2.

If you find a bug in a snapshot release, please see Reporting Linux Kernel Bugs on the front page.

Most of the developer trees are also directly available using the git software. See http://www.kernel.org/git/ for a list of git repositories available on kernel.org.


这是供上述第二个补丁後的内核源码用的,今天最新的是 2.6.29-rc8,也就是先把 2.6.28 -> 2.6.29-rc8 -> 2.6.29-rc8-git

以上两种都是给想尝鲜的用户使用的,当然会存在一些 bug 及不稳定因素了,使用与否,视乎个人对最新最新内核的期望而定

4.  最後一个是 -mm patch,这是内核维护者之一 Andrew Morton 专们开发期间发放的,同样是打到 2.6.x 里的,但这里的一般都非常不稳定及多问题,并不建议一般用户使用

所有内核源码及补丁都能在官方的任何 mirror 里找到,http://www.kernel.org/mirrors/

比如国内的:
http://www.cn.kernel.org/pub/linux/kernel/v2.6/

大概是酱紫了,清楚否?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

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

本版积分规则

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