URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [scripts/] [patch-kernel] - Rev 1765
Compare with Previous | Blame | View Log
#! /bin/sh# Script to apply kernel patches.# usage: patch-kernel [ sourcedir [ patchdir ] ]# The source directory defaults to /usr/src/linux, and the patch# directory defaults to the current directory.## It determines the current kernel version from the top-level Makefile.# It then looks for patches for the next sublevel in the patch directory.# This is applied using "patch -p1 -s" from within the kernel directory.# A check is then made for "*.rej" files to see if the patch was# successful. If it is, then all of the "*.orig" files are removed.## Nick Holloway <Nick.Holloway@alfie.demon.co.uk>, 2nd January 1995.# Set directories from arguments, or use defaults.sourcedir=${1-/usr/src/linux}patchdir=${2-.}# set current VERSION, PATCHLEVEL, SUBLEVELeval `sed -n 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' $sourcedir/Makefile`if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]thenecho "unable to determine current kernel version" >&2exit 1fiecho "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL"while :doSUBLEVEL=`expr $SUBLEVEL + 1`patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gzif [ ! -r $patchdir/$patch ]thenbreakfiecho -n "Applying $patch... "if gunzip -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedirthenecho "done."elseecho "failed. Clean up yourself."breakfiif [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]thenecho "Aborting. Reject files found."breakfi# Remove backup filesfind $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;done
