<br><br><div class="gmail_quote">On Fri, Sep 9, 2011 at 11:12 AM, Kai Meyer <span dir="ltr">&lt;<a href="mailto:kai@gnukai.com">kai@gnukai.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  
    
    
  
  <div text="#000000" bgcolor="#ffffff"><div><div></div><div class="h5">
    On 09/09/2011 09:05 AM, Vaibhav Jain wrote:
    </div></div><blockquote type="cite"><div><div></div><div class="h5">Hi,<br>
      <br>
      I am not able to understand how diff between two trees of which
      one is just contains hardlinks to another&#39;s files (cp -al )ing <br>
      works.I am asking this question here because I need to build a
      custom kernel for which I need to generate patch. So the <br>
      documentation suggests to create a hardlink copy of the kernel
      source tree using cp -al and then make changes to <br>
      one of the trees and run a diff.I am wondering that if files are
      hardlinks then changes to one copy will affect another in which
      case <br>
      diff should give no output.<br>
      Also, the patch I created looks a little odd as it contains
      complete modified files instead of just the differences.<br>
      Please help!<br>
      <br>
      Thanks<br>
      Vaibhav Jain<br>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
Kernelnewbies mailing list
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a>
</pre>
    </blockquote>
    Make the hard link copy like normal. Then delete the directory that
    you are making changes to (in the hard link directory), then copy
    the files over with out hard links. That way &quot;most&quot; of the kernel
    tree is hard linked, and just the portion you want to work on is a
    copy. That way the diff will work.<br>
    <br>
    Otherwise, skip the hard link part all together, and just make a
    full copy. Uses lots of disk space and takes longer to diff.<br><font color="#888888">
    <br>
    -Kai Meyer<br>
  </font></div>

</blockquote></div><br><br>Hi Kai,<br>
<br>
Thanks for the reply. I need just one more favour. <br>
Could you please look at this document describing the procedure to build <br>
custom fedora kernel. It mentions the step to create hardlink to generate but doesn&#39;t <br>
talk about deleting anything ?I just need to confirm if the article is not accurate or if there is <br>
any error in my understanding.<br>
Whenever I follow it I get a patch that contains all of the content of the changed files rather than just the changes.<br>
<br>
Here is the relevant portion : <br>
<h3> <span class="mw-headline" id="Copy_the_Source_Tree_and_Generate_a_Patch"> Copy the Source Tree and Generate a Patch </span></h3>

<p>This step is for applying a patch to the kernel source. If a patch is not needed, proceed to &quot;Configure Kernel Options&quot;.
</p>
<p>Copy the source tree to preserve the original tree while making changes to the copy:
</p>

<pre>cp -r ~/rpmbuild/BUILD/kernel-2.6.$ver.$fedver/linux-2.6.$ver.$arch ~/rpmbuild/BUILD/kernel-2.6.$ver$fedver.orig
cp -al ~/rpmbuild/BUILD/kernel-2.6.$ver.$fedver.orig ~/rpmbuild/BUILD/kernel-2.6.$ver.$fedver.new
</pre>
<br>
<div><b> The second <code>cp</code> command hardlinks the <code>.orig</code> and <code>.new</code> trees to make <code>diff</code> run faster.  Most text editors know how to break the hardlink correctly to avoid problems.</b><br>
</div>


<p>Using vim on FC14, it treated the hard link as a hard link and thus 
the above technique failed.  It was necessary to repeat the original 
copy used for the .orig directory for the .new directory.  Note that 
this uses twice the space.
</p>
<p>Make changes directly to the code in the <code>.new</code> source
 tree, or copy in a modified file. This file might come from a developer
 who has requested a test, from the upstream kernel sources, or from a 
different distribution.
</p>
<p>After the <code>.new</code> source tree is modified, generate a patch. To generate the patch, run <code>diff</code> against the entire <code>.new</code> and <code>.orig</code> source trees with the following command:
</p>

<pre>cd ~/rpmbuild/BUILD
diff -uNrp kernel-2.6.$ver.$fedver.orig kernel-2.6.$ver.$fedver.new &gt; ../SOURCES/linux-2.6-my-new-patch.patch
</pre>
<br>
Thanks<br>
Vaibhav<br><br>