summaryrefslogtreecommitdiff
path: root/docs/patch.html
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2014-07-11 08:53:00 +0000
committerMichał Masłowski <mtjm@mtjm.eu>2014-08-22 19:01:19 +0200
commitcee90ae0fce6d6aee8d78969b60c952c8890abd6 (patch)
tree6cbca259e213f5ffbc3927121e662c0377938cce /docs/patch.html
Libreboot release 6 beta 1.
Diffstat (limited to 'docs/patch.html')
-rw-r--r--docs/patch.html161
1 files changed, 161 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<html>
+<head>
+
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ <style type="text/css">
+ body {
+ background:#fff;
+ color:#000;
+ font-family:sans-serif;
+ font-size:1em;
+ }
+ </style>
+
+ <title>
+ Libreboot documentation: using diff and patch
+ </title>
+
+</head>
+
+<body>
+
+ <header>
+ <h1 id="pagetop">Diff and patch</h1>
+ <aside>This is just a quick guide for reference, use 'man' to know more.</aside>
+ </header>
+
+ <p>
+ <a href="index.html">back to index</a>
+ </p>
+
+<hr/>
+
+ <h1>
+ Apply a patch
+ </h1>
+
+ <p class="important">
+ To apply a patch to a single file, do that in it's directory:<br/>
+ <b>$ patch &lt; foo.patch</b>
+ </p>
+
+ <p>
+ Assuming that the patch is distributed in unified format identifying
+ the file the patch should be applied to, the above will work. Otherwise:<br/>
+ <b>$ patch foo.txt &lt; bar.patch</b>
+ </p>
+
+ <p>
+ You can apply a patch to an entire directory, but note the &quot;p level&quot;.
+ 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:<br/>
+ <b>$ patch -p1 &lt; baz.patch</b>
+ </p>
+
+ <p>
+ 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:<br/>
+ <b>/home/user/do/not/panic/yet.c</b>
+ </p>
+
+ <p>
+ and you are working in a directory that contains panic/yet.c, use:<br/>
+ <b>$ patch -p5 &lt; baz.patch</b>
+ </p>
+
+ <p>
+ 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.
+ </p>
+
+ <p>
+ Removing a patch using the -R flag<br/>
+ <b>$ patch -p5 -R &lt; baz.patch</b>
+ </p>
+
+ <p><a href="#pagetop">Back to top of page.</a></p>
+
+<hr/>
+
+ <h1>
+ Create a patch with diff
+ </h1>
+
+ <p>
+ Diff can create a patch for a single file:<br/>
+ <b>$ diff -u original.c new.c &gt; original.patch</b>
+ </p>
+
+ <p>
+ For diff'ing a source tree:<br/>
+ <b>$ cp -R original new</b>
+ </p>
+
+ <p>
+ Do whatever you want in new/ and then diff it:<br/>
+ <b>$ diff -rupN original/ new/ &gt; original.patch</b>
+ </p>
+
+ <p><a href="#pagetop">Back to top of page.</a></p>
+
+<hr/>
+
+ <h1>
+ git diff
+ </h1>
+
+ <p>
+ git is something special.
+ </p>
+
+ <p>
+ Just make whatever changes you want to a git clone and then:<br/>
+ <b>$ git diff > patch.git</b>
+ </p>
+
+ <p>
+ Note the git revision that you did this with:<br/>
+ <b>$ git log</b>
+ </p>
+
+ <p><a href="#pagetop">Back to top of page.</a></p>
+
+<hr/>
+
+ <h1>
+ git apply
+ </h1>
+
+ <p>it really is.</p>
+
+ <p>
+ Now to apply that patch in the future, just git clone it again and do
+ with the git revision you found from above:<br/>
+ <b>$ git reset --hard REVISIONNUMBER</b>
+ </p>
+
+ <p>
+ Now put patch.git in the git clone directory and do:<br/>
+ <b>$ git apply patch.git</b>
+ </p>
+
+ <p><a href="#pagetop">Back to top of page.</a></p>
+
+<hr/>
+
+ <p>
+ Copyright &copy; 2014 Francis Rowe, All Rights Reserved.<br/>
+ See <a href="license.html">license.html</a> for license conditions.
+ </p>
+
+</body>
+</html>