Mercurial > yaffs-ecoscentric-gpl
annotate patch-ker.sh @ 379:eeb419b0c959
Add more test info
| author | charles <charles> |
|---|---|
| date | Thu, 11 Mar 2010 02:14:41 +0000 |
| parents | a1bb77a9d76a |
| children | b5309c9b6d7f |
| rev | line source |
|---|---|
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
1 #!/bin/sh |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
2 # |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
3 # YAFFS: Yet another FFS. A NAND-flash specific file system. |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
4 # |
| 168 | 5 # Copyright (C) 2002-2006 Aleph One Ltd. |
|
198
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
6 # |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
7 # Created by Charles Manning <charles@aleph1.co.uk> |
|
198
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
8 # |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
9 # This program is free software; you can redistribute it and/or modify |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
10 # it under the terms of the GNU General Public License version 2 as |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
11 # published by the Free Software Foundation. |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
12 # |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
13 # Patch YAFFS into the kernel |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
14 # |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
15 # args: kpath : Full path to kernel sources to be patched |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
16 # |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
17 # Somewhat "inspired by" the mtd patchin script |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
18 # |
|
252
a1bb77a9d76a
Change kernel patchin script for 2.6.28 friendliness
charles <charles>
parents:
198
diff
changeset
|
19 # $Id: patch-ker.sh,v 1.5 2009-01-22 00:44:46 charles Exp $ |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
20 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
21 VERSION=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
22 PATCHLEVEL=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
23 SUBLEVEL=0 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
24 COPYORLINK=$1 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
25 LINUXDIR=$2 |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
26 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
27 # To be a Linux directory, it must have a Makefile |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
28 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
29 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
30 # Display usage of this script |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
31 usage () { |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
32 echo "usage: $0 c/l kernelpath" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
33 echo " if c/l is c, then copy. If l then link" |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
34 exit 1 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
35 } |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
36 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
37 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
38 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
39 if [ -z $LINUXDIR ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
40 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
41 usage; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
42 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
43 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
44 if [ $COPYORLINK = l ]; then |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
45 CPY="ln -s" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
46 elif [ $COPYORLINK = c ]; then |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
47 CPY="cp" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
48 else |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
49 echo "unknown copy or link type" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
50 usage; |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
51 fi |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
52 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
53 |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
54 # Check if kerneldir contains a Makefile |
|
198
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
55 if [ ! -f $LINUXDIR/Makefile ] |
|
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
56 then |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
57 echo "Directory $LINUXDIR does not exist or is not a kernel source directory"; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
58 exit 1; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
59 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
60 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
61 # Get kernel version |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
62 VERSION=`grep -s VERSION <$LINUXDIR/Makefile | head -n 1 | sed s/'VERSION = '//` |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
63 PATCHLEVEL=`grep -s PATCHLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'PATCHLEVEL = '//` |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
64 SUBLEVEL=`grep -s SUBLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'SUBLEVEL = '//` |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
65 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
66 # Can we handle this version? |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
67 if [ $VERSION -ne 2 -o $PATCHLEVEL -lt 6 ] |
|
198
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
68 then |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
69 echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
70 exit 1; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
71 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
72 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
73 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
74 KCONFIG=$LINUXDIR/fs/Kconfig |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
75 KCONFIGOLD=$LINUXDIR/fs/Kconfig.pre.yaffs |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
76 YAFFS_PATCHED_STRING=`grep -s yaffs <$KCONFIG | head -n 1` |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
77 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
78 MAKEFILE=$LINUXDIR/fs/Makefile |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
79 MAKEFILEOLD=$LINUXDIR/fs/Makefile.pre.yaffs |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
80 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
81 if [ ! -z "$YAFFS_PATCHED_STRING" ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
82 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
83 YAFFS_PATCHED=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
84 echo "$KCONFIG already mentions YAFFS, so we will not change it" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
85 else |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
86 # Change the fs/Kconfig file |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
87 # Save the old Kconfig |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
88 # Copy all stuff up to JFFS |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
89 # Insert some YAFFS stuff |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
90 # Copy all the rest of the stuff |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
91 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
92 YAFFS_PATCHED=1 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
93 echo "Updating $KCONFIG" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
94 mv -f $KCONFIG $KCONFIGOLD |
|
252
a1bb77a9d76a
Change kernel patchin script for 2.6.28 friendliness
charles <charles>
parents:
198
diff
changeset
|
95 sed -n -e "/[Jj][Ff][Ff][Ss]/,99999 ! p" $KCONFIGOLD >$KCONFIG |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
96 echo "">>$KCONFIG |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
97 echo "# Patched by YAFFS" >>$KCONFIG |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
98 echo "source \"fs/yaffs2/Kconfig\"">>$KCONFIG |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
99 echo "">>$KCONFIG |
|
252
a1bb77a9d76a
Change kernel patchin script for 2.6.28 friendliness
charles <charles>
parents:
198
diff
changeset
|
100 sed -n -e "/[Jj][Ff][Ff][Ss]/,99999 p" $KCONFIGOLD >>$KCONFIG |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
101 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
102 # now do fs/Makefile -- simply add the target at the end |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
103 echo "Updating $MAKEFILE" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
104 cp -f $MAKEFILE $MAKEFILEOLD |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
105 echo "">>$MAKEFILE |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
106 echo "# Patched by YAFFS" >>$MAKEFILE |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
107 echo "obj-\$(CONFIG_YAFFS_FS) += yaffs2/" >>$MAKEFILE |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
108 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
109 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
110 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
111 YAFFSDIR=$LINUXDIR/fs/yaffs2 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
112 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
113 if [ -e $YAFFSDIR ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
114 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
115 echo "$YAFFSDIR exists, not patching" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
116 else |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
117 mkdir $LINUXDIR/fs/yaffs2 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
118 $CPY $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
119 $CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
120 $CPY $PWD/*.c $PWD/*.h $LINUXDIR/fs/yaffs2 |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
121 fi |
