The PF_RING patch is rather complicated to rebuild. It is somewhat easier after applying this patch to the CVS tree. Suggested usage : $ cd PF_RING $ PATCHLEVEL=4 SUBLEVEL=33 EXTRAVERSION=-ring3 saveorg=no bash mkpatch.sh $ cp workspace/linux-2.4.33-ring3.patch.gz /w/pool/ --- PF_RING/mkpatch.sh.orig 2006-10-30 11:24:07 +0100 +++ PF_RING/mkpatch.sh 2006-10-30 11:58:15 +0100 @@ -19,16 +19,27 @@ fi } +function break_link () +{ + local file + + for file in "$@"; do + if [ -e "$file" ]; then + cp "$file" "$file.unlinked" && mv "$file.unlinked" "$file" + fi + done +} + PATCH=ring3 PREFIX=linux # or #PREFIX=kernel-source # kernel identifiers. -VERSION=2 -PATCHLEVEL=6 -SUBLEVEL=16.1 +VERSION=${VERSION:-2} +PATCHLEVEL=${PATCHLEVEL:-6} +SUBLEVEL=${SUBLEVEL:-16.1} KERNEL_VERSION=$VERSION.$PATCHLEVEL.$SUBLEVEL -EXTRAVERSION=-1-686-smp-$PATCH +EXTRAVERSION=${EXTRAVERSION:--1-686-smp-$PATCH} KERNEL=$PREFIX-$KERNEL_VERSION MYKERNEL=$PREFIX-${KERNEL_VERSION}$EXTRAVERSION @@ -51,7 +62,7 @@ echo "Edit this file (mkpatch.sh) for a different kernel version" # Set it to "yes" if you want to keep a local copy of the original files. -saveorg=yes +saveorg=${saveorg:-yes} # Initialize errors which could accrue as we proceed errors=0 @@ -110,6 +121,7 @@ if [ ! -d $KERNEL ]; then echo "Untarring Linux sources (read-only tree) in "`pwd`"/$KERNEL" tar ${z}xf $SOURCES/$SOURCE + chmod -R u+w $KERNEL else echo "Looks like the source is already extracted here `pwd`/$KERNEL" fi @@ -128,17 +140,12 @@ echo "Ok, $MYKERNEL left in it's current state." fi fi -here=`pwd` -if test $extract -eq 0; then - cd $MYKERNEL +if test $extract -eq 0; then + echo "Cloning Linux sources (read-write tree) in `pwd`" # Need to remove read-write kernel if we created it before - - rm -rf $KERNEL - echo "Untarring Linux sources (read-write tree) in `pwd`" - tar ${z}xf $SOURCES/$SOURCE - mv $KERNEL/* $KERNEL/.[^.]* . - cd $here + rm -rf $MYKERNEL + cp -al $KERNEL $MYKERNEL fi # @@ -348,6 +355,7 @@ patch=`expr $patch + 1` echo -n " ${patch}. Patching file net/netsyms.c ..." if ! grep -q "linux/ring.h" $MYKERNEL/net/netsyms.c; then + break_link $MYKERNEL/net/netsyms.c cat $PATCH/kernel/net/PATCH-to-netsyms.c >> $MYKERNEL/net/netsyms.c echo " done" else