Re: how to make kernel patches

Elliot Lee (sopwith@redhat.com)
Mon, 9 Jun 1997 17:36:54 -0400 (EDT)


On Mon, 9 Jun 1997, Jeremy A. Gilbert wrote:

> Can someone tell me if there is a good trick for making
> compilations of kernel diffs? Just a command which compares two kernel
> trees and only includes the neccesary files to patch from one to another.
> It seems there should be some sort of utility for doing it, (knowing to
> ignore *.o and .config and .depend, etc) but i haven't been able to find
> one. diff(1) -r doesn't seem to be working too well for this. Thanks,

The gendiff script following my .sig is a standard part of rpm, but is
useful in other situations as well :-)

Basically, whenever you want to make a patch to a file, you save the
original with your special extension - i.e. I save the originals of files
I modify with a '.sopwith' extension ('cp filename.c filename.c.sopwith').

Then when you want to get The Patch for, say, /usr/src/linux, just run:
cd /usr/src
gendiff linux .sopwith > /tmp/mycoolkernel.patch

Hope this helps,
-- Elliot http://www.redhat.com/
How do you explain school to a higher intelligence?
-- Elliot, "E.T."

#!/bin/bash

[ -z "$1" -o -z "$2" ] && {
# usage
echo "usage: $0 <directory> <diff-extension>" 1>&2
exit 1
}

find $1 \( -name "*$2" -o -name ".*$2" \) -print |
while read f; do
diff -u $f ${f%%$2}
done