linux 内核源码打 patch

版权声明:©1995-2018 CodingTheFuture, blog. All rights reserved. https://blog.csdn.net/sunqian666888/article/details/85003007

一、下载当前Linux内核对应的增量包

https://www.kernel.org/

我的内核当前版本是 4.9.135

最新的版本是4.9.145,中间有10个增量版本,需要全部下载,增量包不支持跨版本,只能从相邻的版本打patch

增量包下载地址示例:

 

二、对增量包进行重命名

我使用 好压 的批量改名工具

三、对内核打上全部补丁

工具使用方法:

第一个参数:内核源码目录

第二个参数:patch 目录

第三个参数:停止打patch 的版本号

linux-4.9.135$ ./scripts/patch-kernel
usage: patch-kernel [-h] [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ]
  source directory defaults to /usr/src/linux,
  patch directory defaults to the current directory,
  stopversion defaults to <all in patchdir>.

执行效果:

sun@machine:~/share/build/linux-4.9.135$ ./scripts/patch-kernel ./ ../ 4.9.145
Current kernel version is 4.9.135 ( Roaring Lionus)
Applying patch-4.9.136 (xz)... done.
Applying patch-4.9.137 (xz)... done.
Applying patch-4.9.138 (xz)... done.
Applying patch-4.9.139 (xz)... done.
Applying patch-4.9.140 (xz)... done.
Applying patch-4.9.141 (xz)... done.
Applying patch-4.9.142 (xz)... done.
Applying patch-4.9.143 (xz)... done.
Applying patch-4.9.144 (xz)... done.
Applying patch-4.9.145 (xz)... done.
Stopping at 4.9.145 base as requested.

可以看到一次性将10个补丁全部打完。

最后将源码目录重命名

mv linux-4.9.135/ linux-4.9.145

猜你喜欢

转载自blog.csdn.net/sunqian666888/article/details/85003007