Mercurial > yaffs-ecoscentric-gpl
annotate patch-ker.sh @ 410:0e17f61fb076
yaffs: Changes to test scripts
Add mount_cycling script.
Change /proc/yaffs_debug references to /proc/yaffs_stats.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
| author | Charles Manning <cdhmanning@gmail.com> |
|---|---|
| date | Thu, 22 Apr 2010 13:27:28 +1200 |
| parents | b5309c9b6d7f |
| children |
| 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 # |
|
409
b5309c9b6d7f
yaffs Some cleanups.
Charles Manning <cdhmanning@gmail.com>
parents:
252
diff
changeset
|
5 # Copyright (C) 2002-2010 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 # |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
19 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
20 VERSION=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
21 PATCHLEVEL=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
22 SUBLEVEL=0 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
23 COPYORLINK=$1 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
24 LINUXDIR=$2 |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
25 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
26 # 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
|
27 |
|
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 # Display usage of this script |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
30 usage () { |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
31 echo "usage: $0 c/l kernelpath" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
32 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
|
33 exit 1 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
34 } |
|
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 if [ -z $LINUXDIR ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
39 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
40 usage; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
41 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
42 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
43 if [ $COPYORLINK = l ]; then |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
44 CPY="ln -s" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
45 elif [ $COPYORLINK = c ]; then |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
46 CPY="cp" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
47 else |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
48 echo "unknown copy or link type" |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
49 usage; |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
50 fi |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
51 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
52 |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
53 # 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
|
54 if [ ! -f $LINUXDIR/Makefile ] |
|
b7f785925166
Cleanup patch - Remove all trailing whitespace and fix a few typos.
wookey <wookey>
parents:
185
diff
changeset
|
55 then |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
56 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
|
57 exit 1; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
58 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
59 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
60 # Get kernel version |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
65 # Can we handle this version? |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
66 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
|
67 then |
|
50
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
68 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
|
69 exit 1; |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
70 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
71 |
|
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 KCONFIG=$LINUXDIR/fs/Kconfig |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
74 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
|
75 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
|
76 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
77 MAKEFILE=$LINUXDIR/fs/Makefile |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
78 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
|
79 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
80 if [ ! -z "$YAFFS_PATCHED_STRING" ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
81 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
82 YAFFS_PATCHED=0 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
83 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
|
84 else |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
85 # Change the fs/Kconfig file |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
86 # Save the old Kconfig |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
87 # 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
|
88 # Insert some YAFFS stuff |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
89 # 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
|
90 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
91 YAFFS_PATCHED=1 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
92 echo "Updating $KCONFIG" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
93 mv -f $KCONFIG $KCONFIGOLD |
|
252
a1bb77a9d76a
Change kernel patchin script for 2.6.28 friendliness
charles <charles>
parents:
198
diff
changeset
|
94 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
|
95 echo "">>$KCONFIG |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
96 echo "# Patched by YAFFS" >>$KCONFIG |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
97 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
|
98 echo "">>$KCONFIG |
|
252
a1bb77a9d76a
Change kernel patchin script for 2.6.28 friendliness
charles <charles>
parents:
198
diff
changeset
|
99 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
|
100 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
101 # 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
|
102 echo "Updating $MAKEFILE" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
103 cp -f $MAKEFILE $MAKEFILEOLD |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
104 echo "">>$MAKEFILE |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
105 echo "# Patched by YAFFS" >>$MAKEFILE |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
106 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
|
107 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
108 fi |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
109 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
110 YAFFSDIR=$LINUXDIR/fs/yaffs2 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
111 |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
112 if [ -e $YAFFSDIR ] |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
113 then |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
114 echo "$YAFFSDIR exists, not patching" |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
115 else |
|
bcf056049698
Added files that support the ability to "patchin" yaffs2 into the 2.6
marty <marty>
parents:
diff
changeset
|
116 mkdir $LINUXDIR/fs/yaffs2 |
|
185
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
117 $CPY $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
118 $CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2 |
|
61cb2c96f833
Add a symlink option to the patching script
charles <charles>
parents:
168
diff
changeset
|
119 $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
|
120 fi |
