OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [scripts/] [patch-kernel] - Blame information for rev 1629

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1629 jcastillo
#! /bin/sh
2
# Script to apply kernel patches.
3
#   usage: patch-kernel [ sourcedir [ patchdir ] ]
4
#     The source directory defaults to /usr/src/linux, and the patch
5
#     directory defaults to the current directory.
6
#
7
# It determines the current kernel version from the top-level Makefile.
8
# It then looks for patches for the next sublevel in the patch directory.
9
# This is applied using "patch -p1 -s" from within the kernel directory.
10
# A check is then made for "*.rej" files to see if the patch was
11
# successful.  If it is, then all of the "*.orig" files are removed.
12
#
13
#       Nick Holloway , 2nd January 1995.
14
 
15
# Set directories from arguments, or use defaults.
16
sourcedir=${1-/usr/src/linux}
17
patchdir=${2-.}
18
 
19
# set current VERSION, PATCHLEVEL, SUBLEVEL
20
eval `sed -n 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' $sourcedir/Makefile`
21
if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
22
then
23
    echo "unable to determine current kernel version" >&2
24
    exit 1
25
fi
26
 
27
echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL"
28
 
29
while :
30
do
31
    SUBLEVEL=`expr $SUBLEVEL + 1`
32
    patch=patch-$VERSION.$PATCHLEVEL.$SUBLEVEL.gz
33
    if [ ! -r $patchdir/$patch ]
34
    then
35
        break
36
    fi
37
 
38
    echo -n "Applying $patch... "
39
    if gunzip -dc $patchdir/$patch | patch -p1 -s -N -E -d $sourcedir
40
    then
41
        echo "done."
42
    else
43
        echo "failed.  Clean up yourself."
44
        break
45
    fi
46
    if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ]
47
    then
48
        echo "Aborting.  Reject files found."
49
        break
50
    fi
51
    # Remove backup files
52
    find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \;
53
done

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.