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