aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/applying-patches.txt56
1 files changed, 32 insertions, 24 deletions
diff --git a/Documentation/applying-patches.txt b/Documentation/applying-patches.txt
index 05a08c2c1889..a083ba35d1ad 100644
--- a/Documentation/applying-patches.txt
+++ b/Documentation/applying-patches.txt
@@ -3,8 +3,7 @@
3 ------------------------------------ 3 ------------------------------------
4 4
5 Original by: Jesper Juhl, August 2005 5 Original by: Jesper Juhl, August 2005
6 Last update: 2005-12-02 6 Last update: 2006-01-05
7
8 7
9 8
10A frequently asked question on the Linux Kernel Mailing List is how to apply 9A frequently asked question on the Linux Kernel Mailing List is how to apply
@@ -77,7 +76,7 @@ instead:
77 76
78If you wish to uncompress the patch file by hand first before applying it 77If you wish to uncompress the patch file by hand first before applying it
79(what I assume you've done in the examples below), then you simply run 78(what I assume you've done in the examples below), then you simply run
80gunzip or bunzip2 on the file - like this: 79gunzip or bunzip2 on the file -- like this:
81 gunzip patch-x.y.z.gz 80 gunzip patch-x.y.z.gz
82 bunzip2 patch-x.y.z.bz2 81 bunzip2 patch-x.y.z.bz2
83 82
@@ -95,7 +94,7 @@ Common errors when patching
95--- 94---
96 When patch applies a patch file it attempts to verify the sanity of the 95 When patch applies a patch file it attempts to verify the sanity of the
97file in different ways. 96file in different ways.
98Checking that the file looks like a valid patch file, checking the code 97Checking that the file looks like a valid patch file & checking the code
99around the bits being modified matches the context provided in the patch are 98around the bits being modified matches the context provided in the patch are
100just two of the basic sanity checks patch does. 99just two of the basic sanity checks patch does.
101 100
@@ -122,7 +121,7 @@ outright and leaves a file with a .rej extension (a reject file). You can
122read this file to see exactly what change couldn't be applied, so you can 121read this file to see exactly what change couldn't be applied, so you can
123go fix it up by hand if you wish. 122go fix it up by hand if you wish.
124 123
125If you don't have any third party patches applied to your kernel source, but 124If you don't have any third-party patches applied to your kernel source, but
126only patches from kernel.org and you apply the patches in the correct order, 125only patches from kernel.org and you apply the patches in the correct order,
127and have made no modifications yourself to the source files, then you should 126and have made no modifications yourself to the source files, then you should
128never see a fuzz or reject message from patch. If you do see such messages 127never see a fuzz or reject message from patch. If you do see such messages
@@ -137,7 +136,7 @@ If patch stops and presents a "File to patch:" prompt, then patch could not
137find a file to be patched. Most likely you forgot to specify -p1 or you are 136find a file to be patched. Most likely you forgot to specify -p1 or you are
138in the wrong directory. Less often, you'll find patches that need to be 137in the wrong directory. Less often, you'll find patches that need to be
139applied with -p0 instead of -p1 (reading the patch file should reveal if 138applied with -p0 instead of -p1 (reading the patch file should reveal if
140this is the case - if so, then this is an error by the person who created 139this is the case -- if so, then this is an error by the person who created
141the patch but is not fatal). 140the patch but is not fatal).
142 141
143If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a 142If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a
@@ -168,13 +167,17 @@ the patch will in fact apply it.
168 167
169A message similar to "patch: **** unexpected end of file in patch" or "patch 168A message similar to "patch: **** unexpected end of file in patch" or "patch
170unexpectedly ends in middle of line" means that patch could make no sense of 169unexpectedly ends in middle of line" means that patch could make no sense of
171the file you fed to it. Either your download is broken or you tried to feed 170the file you fed to it. Either your download is broken, you tried to feed
172patch a compressed patch file without uncompressing it first. 171patch a compressed patch file without uncompressing it first, or the patch
172file that you are using has been mangled by a mail client or mail transfer
173agent along the way somewhere, e.g., by splitting a long line into two lines.
174Often these warnings can easily be fixed by joining (concatenating) the
175two lines that had been split.
173 176
174As I already mentioned above, these errors should never happen if you apply 177As I already mentioned above, these errors should never happen if you apply
175a patch from kernel.org to the correct version of an unmodified source tree. 178a patch from kernel.org to the correct version of an unmodified source tree.
176So if you get these errors with kernel.org patches then you should probably 179So if you get these errors with kernel.org patches then you should probably
177assume that either your patch file or your tree is broken and I'd advice you 180assume that either your patch file or your tree is broken and I'd advise you
178to start over with a fresh download of a full kernel tree and the patch you 181to start over with a fresh download of a full kernel tree and the patch you
179wish to apply. 182wish to apply.
180 183
@@ -200,10 +203,10 @@ do the additional steps since interdiff can get things wrong in some cases.
200 Another alternative is `ketchup', which is a python script for automatic 203 Another alternative is `ketchup', which is a python script for automatic
201downloading and applying of patches (http://www.selenic.com/ketchup/). 204downloading and applying of patches (http://www.selenic.com/ketchup/).
202 205
203 Other nice tools are diffstat which shows a summary of changes made by a 206 Other nice tools are diffstat, which shows a summary of changes made by a
204patch, lsdiff which displays a short listing of affected files in a patch 207patch; lsdiff, which displays a short listing of affected files in a patch
205file, along with (optionally) the line numbers of the start of each patch 208file, along with (optionally) the line numbers of the start of each patch;
206and grepdiff which displays a list of the files modified by a patch where 209and grepdiff, which displays a list of the files modified by a patch where
207the patch contains a given regular expression. 210the patch contains a given regular expression.
208 211
209 212
@@ -228,8 +231,8 @@ The -mm kernels live at
228In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a 231In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a
229country code. This way you'll be downloading from a mirror site that's most 232country code. This way you'll be downloading from a mirror site that's most
230likely geographically closer to you, resulting in faster downloads for you, 233likely geographically closer to you, resulting in faster downloads for you,
231less bandwidth used globally and less load on the main kernel.org servers - 234less bandwidth used globally and less load on the main kernel.org servers --
232these are good things, do use mirrors when possible. 235these are good things, so do use mirrors when possible.
233 236
234 237
235The 2.6.x kernels 238The 2.6.x kernels
@@ -237,14 +240,14 @@ The 2.6.x kernels
237 These are the base stable releases released by Linus. The highest numbered 240 These are the base stable releases released by Linus. The highest numbered
238release is the most recent. 241release is the most recent.
239 242
240If regressions or other serious flaws are found then a -stable fix patch 243If regressions or other serious flaws are found, then a -stable fix patch
241will be released (see below) on top of this base. Once a new 2.6.x base 244will be released (see below) on top of this base. Once a new 2.6.x base
242kernel is released, a patch is made available that is a delta between the 245kernel is released, a patch is made available that is a delta between the
243previous 2.6.x kernel and the new one. 246previous 2.6.x kernel and the new one.
244 247
245To apply a patch moving from 2.6.11 to 2.6.12 you'd do the following (note 248To apply a patch moving from 2.6.11 to 2.6.12, you'd do the following (note
246that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the 249that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the
247base 2.6.x kernel - if you need to move from 2.6.x.y to 2.6.x+1 you need to 250base 2.6.x kernel -- if you need to move from 2.6.x.y to 2.6.x+1 you need to
248first revert the 2.6.x.y patch). 251first revert the 2.6.x.y patch).
249 252
250Here are some examples: 253Here are some examples:
@@ -266,7 +269,7 @@ $ mv linux-2.6.11.1 linux-2.6.12 # rename source dir
266 269
267The 2.6.x.y kernels 270The 2.6.x.y kernels
268--- 271---
269 Kernels with 4 digit versions are -stable kernels. They contain small(ish) 272 Kernels with 4-digit versions are -stable kernels. They contain small(ish)
270critical fixes for security problems or significant regressions discovered 273critical fixes for security problems or significant regressions discovered
271in a given 2.6.x kernel. 274in a given 2.6.x kernel.
272 275
@@ -277,9 +280,14 @@ versions.
277If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is 280If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is
278the current stable kernel. 281the current stable kernel.
279 282
283 note: the -stable team usually do make incremental patches available as well
284 as patches against the latest mainline release, but I only cover the
285 non-incremental ones below. The incremental ones can be found at
286 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/incr/
287
280These patches are not incremental, meaning that for example the 2.6.12.3 288These patches are not incremental, meaning that for example the 2.6.12.3
281patch does not apply on top of the 2.6.12.2 kernel source, but rather on top 289patch does not apply on top of the 2.6.12.2 kernel source, but rather on top
282of the base 2.6.12 kernel source. 290of the base 2.6.12 kernel source .
283So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel 291So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel
284source you have to first back out the 2.6.12.2 patch (so you are left with a 292source you have to first back out the 2.6.12.2 patch (so you are left with a
285base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch. 293base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch.
@@ -345,12 +353,12 @@ The -git kernels
345repository, hence the name). 353repository, hence the name).
346 354
347These patches are usually released daily and represent the current state of 355These patches are usually released daily and represent the current state of
348Linus' tree. They are more experimental than -rc kernels since they are 356Linus's tree. They are more experimental than -rc kernels since they are
349generated automatically without even a cursory glance to see if they are 357generated automatically without even a cursory glance to see if they are
350sane. 358sane.
351 359
352-git patches are not incremental and apply either to a base 2.6.x kernel or 360-git patches are not incremental and apply either to a base 2.6.x kernel or
353a base 2.6.x-rc kernel - you can see which from their name. 361a base 2.6.x-rc kernel -- you can see which from their name.
354A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch 362A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch
355named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel. 363named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel.
356 364
@@ -393,12 +401,12 @@ You should generally strive to get your patches into mainline via -mm to
393ensure maximum testing. 401ensure maximum testing.
394 402
395This branch is in constant flux and contains many experimental features, a 403This branch is in constant flux and contains many experimental features, a
396lot of debugging patches not appropriate for mainline etc and is the most 404lot of debugging patches not appropriate for mainline etc., and is the most
397experimental of the branches described in this document. 405experimental of the branches described in this document.
398 406
399These kernels are not appropriate for use on systems that are supposed to be 407These kernels are not appropriate for use on systems that are supposed to be
400stable and they are more risky to run than any of the other branches (make 408stable and they are more risky to run than any of the other branches (make
401sure you have up-to-date backups - that goes for any experimental kernel but 409sure you have up-to-date backups -- that goes for any experimental kernel but
402even more so for -mm kernels). 410even more so for -mm kernels).
403 411
404These kernels in addition to all the other experimental patches they contain 412These kernels in addition to all the other experimental patches they contain