[clug] Reading a diff

Ben Nizette bn at niasdigital.com
Sun Sep 6 20:28:34 MDT 2009


On Mon, 2009-09-07 at 09:36 +1000, BAXTER,Adam wrote:
> Hi,
> 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, but I have no idea how to make it work with the .30 kernel, or exactly what the diff is doing.

Generally this crude incantation:

grep "^+++" linux_2.6.28-34.10.diff | sed -e 's+/[^/]*$++g'| uniq

gives you a good idea of what the patch is doing.  Lines starting with
"+++" indicate the file being touched, the sed above simply strips off
the filename so you get the directories touched.  In your case:

+++ linux-2.6.28/drivers/staging
+++ linux-2.6.28/drivers/staging/rt3090
+++ linux-2.6.28/drivers/staging/rt3090/common
+++ linux-2.6.28/drivers/staging/rt3090/chips
+++ linux-2.6.28/drivers/staging/rt3090/sta

Adds driver for the rt3090 wireless card

+++ linux-2.6.28/drivers/gpu/drm

Dicks around in graphic drivers (more detail reveals intel drivers
specifically)

+++ linux-2.6.28/ubuntu/lirc/lirc_igorplugusb
+++ linux-2.6.28/debian
+++ linux-2.6.28/debian/abi/2.6.28-34.9/i386
+++ linux-2.6.28/debian/control-scripts
+++ linux-2.6.28/debian/d-i
+++ linux-2.6.28/debian/control.d
+++ linux-2.6.28/debian/commit-templates
+++ linux-2.6.28/debian/config/i386
+++ linux-2.6.28/debian/sub-flavours
+++ linux-2.6.28/debian/stamps
+++ linux-2.6.28/debian/tests
+++ linux-2.6.28/debian/rules.d
+++ linux-2.6.28/debian/scripts
+++ linux-2.6.28/debian/scripts/misc

Craptonne of Debian/Ubuntu specific stuff

+++ linux-2.6.28/sound/pci/hda
+++ linux-2.6.28/sound/core

Touches some sound drivers too.

Because a patch only describes incremental changes from some base
version, your idea of base has to be the same as their idea.  In this
case, it'll apply cleanly to the 2.6.28 kernel with Ubuntu specific
patch -34.10 applied.

When you say "kernel .30" which version of .30?  Vanilla,
non-distributor-munged 2.6.30 or something from the Ubuntu distributors?
I think it might be more effort than it's worth (just downgrade
to .28-34.10 and pester the FitPC guys to rebase to a newer kernel
version) but when I need to do things like this I use the git VCS to
break it down in to more manageable stages:

# Get a copy of Linus' latest kernel.
$: git checkout git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
$: cd linux-2.6

# Create a branch based at 2.6.28, hopefully your
# patch will apply easily here
$: git checkout -b stage v2.6.28

# Apply your patch
$: git apply linux_2.6.28-34.10.diff
< Complaining about mismatched hunks in various files
 at various lines >
< Go through and manually fix the conflicts in the above list,
 most of the time they're simple problems, eg someone's inserted code
 above the target lines changing their line numbers so the patch utility
 can't find them. >
$: git commit -a -m "Added fitpc drivers and some debian munge"

# Now to move your branch from being on top of .28 to being on top of .30
$: git rebase --onto v2.6.30 v2.6.28 stage
< Complaining about mismatched changes between .28 and .30, fix as above >
$: git rebase continue
$: git commit -a -m "We're now on .30!"

# That patch also adds a default configuration for the fitpc, copy that
# in to place and load it up
$: cp debian/config/i386/config.fitpc2 .config && make oldconfig
$: make
# TUDAHH!!

	--Ben.






More information about the linux mailing list