From cee90ae0fce6d6aee8d78969b60c952c8890abd6 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Fri, 11 Jul 2014 04:53:00 -0400 Subject: Libreboot release 6 beta 1. --- (limited to 'docs/patch.html') diff --git a/docs/patch.html b/docs/patch.html new file mode 100644 index 0000000..7b219cf --- /dev/null +++ b/docs/patch.html @@ -0,0 +1,161 @@ + + + + + + + + + + + Libreboot documentation: using diff and patch + + + + + + +
+

Diff and patch

+ +
+ +

+ back to index +

+ +
+ +

+ Apply a patch +

+ +

+ To apply a patch to a single file, do that in it's directory:
+ $ patch < foo.patch +

+ +

+ Assuming that the patch is distributed in unified format identifying + the file the patch should be applied to, the above will work. Otherwise:
+ $ patch foo.txt < bar.patch +

+ +

+ You can apply a patch to an entire directory, but note the "p level". + What this means is that inside patch files will be the files that you + intend to patch, identified by path names that might be different + when the files ane located on your own computer instead of on the computer + where the patch was created. 'p' level instructs the 'patch' utility to + ignore parts of the path name to identify the files correctly. Usually a + p level of 1 will work, so you would use:
+ $ patch -p1 < baz.patch +

+ +

+ Change to the top level directory before running this. If a patch level + of 1 cannot identify the files to patch, then inspect the patch file for file names. + For example:
+ /home/user/do/not/panic/yet.c +

+ +

+ and you are working in a directory that contains panic/yet.c, use:
+ $ patch -p5 < baz.patch +

+ +

+ You usually count one up for each path separator (forward slash) + removed from the beginning of the path, until you are left with a path + that exists in the current working directory. The count is the p level. +

+ +

+ Removing a patch using the -R flag
+ $ patch -p5 -R < baz.patch +

+ +

Back to top of page.

+ +
+ +

+ Create a patch with diff +

+ +

+ Diff can create a patch for a single file:
+ $ diff -u original.c new.c > original.patch +

+ +

+ For diff'ing a source tree:
+ $ cp -R original new +

+ +

+ Do whatever you want in new/ and then diff it:
+ $ diff -rupN original/ new/ > original.patch +

+ +

Back to top of page.

+ +
+ +

+ git diff +

+ +

+ git is something special. +

+ +

+ Just make whatever changes you want to a git clone and then:
+ $ git diff > patch.git +

+ +

+ Note the git revision that you did this with:
+ $ git log +

+ +

Back to top of page.

+ +
+ +

+ git apply +

+ +

it really is.

+ +

+ Now to apply that patch in the future, just git clone it again and do + with the git revision you found from above:
+ $ git reset --hard REVISIONNUMBER +

+ +

+ Now put patch.git in the git clone directory and do:
+ $ git apply patch.git +

+ +

Back to top of page.

+ +
+ +

+ Copyright © 2014 Francis Rowe, All Rights Reserved.
+ See license.html for license conditions. +

+ + + -- cgit v0.9.1