# generate a patch for all the files in linux-xen directories
# (these are files that are identical to linux except for a few small changes)
# run in the main xen directory
LINUXPATH=/home/djm/linux-2.6.13
OUTFILE=/tmp/linux-xen-diffs
wd=$PWD
for i in include/asm-ia64/linux-xen/asm include/asm-ia64/linux-xen/linux arch/ia64/linux-xen
do
echo '#############' $i '#############'
cd $i
ln -s $LINUXPATH xxx
cat README.origin | grep -v '^#' | grep -v '^[ 	]*$' | \
	sed -e 's/[ 	]*-> linux/ xxx/' | \
	sed -e 's/^/diff -Naur /' | bash
rm -f xxx
cd $wd
done > $OUTFILE
echo 'Total lines in patch:' `cat $OUTFILE | grep -v '########' | wc -l`
echo 'Approx. changes in patch:' `cat $OUTFILE | grep -v '########' | \
	grep -- '-#if' | wc -l`
echo 'Total lines added by patch:' `cat $OUTFILE | grep -v '########' | \
	grep -- '^-' | wc -l`
echo 'Total non-conditional-compile lines added by patch:' \
	`cat $OUTFILE | grep -v '########' | grep -- '^-' | \
	egrep -v '^-#if|^-#else|^-#endif' | wc -l`
