[clug] Reading a diff

Daniel Pittman daniel at rimspace.net
Sun Sep 6 18:08:05 MDT 2009


Robert Edwards <bob at cs.anu.edu.au> writes:
> BAXTER,Adam wrote:

>> Can someone point me in the direction of some instructions on how to read a diff like
>> http://fit-pc2.com/download/ubuntu/dists/jaunty/source/linux_2.6.28-34.10.diff.gz
>>
>> As far as I know it's adding drivers to the kernel

Well, the diff itself adds a bunch of files to a kernel source tree, which you
can then configure and compile to produce additional drivers.  The difference
is that "configure and compile" covers a *lot* of ground, which is why I
mention it, against the unlikely case you were not aware of that already.

>> but I have no idea how to make it work with the .30 kernel

If you have to ask the question you probably can't.  While kernel development
and building isn't nearly as hard as it sounds, it isn't trivial, and there is
a lot of background to cover to port a driver from 2.6.28 to 2.6.30.

(as an aside, this is why using devices with an upstream supported driver is
 much nicer, but you already know that right now ;)

>> or exactly what the diff is doing.

--- linux-2.6.28.orig/drivers/staging/Makefile
+++ linux-2.6.28/drivers/staging/Makefile

These tell you the files that were compared, from, and to.

@@ -19,6 +19,7 @@

This tells you which lines were effected.

Then, the lines prefixed with ' ' are "context", "+" are added and "-" are
deleted from the files referenced in the locations described.

[...]

> Basically, diffs are really meant to be read by the "patch" command

Heh.  Kids these days.  You tell them that diff shipped in 1974, and patch in
1985, and they don't believe you.  Initially diff generated scripts that could
be piped to ed(1), "the standard editor", to make changes to your software.

Context, and then unified diff formats (which the later is the format used by
the RaLink patch referenced) came much later, although they still predate the
patch program a little.

> with some developers able to eye-ball a diff to get an idea of whether or
> not it might break something, but you would need to be quite familiar with
> the source tree to be able to do that.
>
> Which part of the .diff are you mainly interested in?

I bet it is the bit which adds a driver for a wireless network card that
doesn't have an upstream driver in 2.6.30: an RT3090 based card.

Regards,
        Daniel

-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons
   Looking for work?  Love Perl?  In Melbourne, Australia?  We are hiring.


More information about the linux mailing list