Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
[yaffs2.git] / patch-ker.sh
index 6ffabecd2ff1ca0da1e46ebba09f2552740b879c..ad92e7c4c36ae073db6f8283d8152201e03d62d5 100755 (executable)
@@ -2,21 +2,21 @@
 #
 # YAFFS: Yet another FFS. A NAND-flash specific file system.
 #
-# Copyright (C) 2002-2006 Aleph One Ltd.
-# 
+# Copyright (C) 2002-2010 Aleph One Ltd.
+#
 # Created by Charles Manning <charles@aleph1.co.uk>
-# 
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as
 # published by the Free Software Foundation.
 #
 # Patch YAFFS into the kernel
 #
-#  args:  kpath  : Full path to kernel sources to be patched
+#  args:  l/c : link or copy
+#        kpath  : Full path to kernel sources to be patched
 #
 #  Somewhat "inspired by" the mtd patchin script
 #
-#  $Id: patch-ker.sh,v 1.3 2007-07-25 01:04:38 charles Exp $
 
 VERSION=0
 PATCHLEVEL=0
@@ -52,8 +52,8 @@ fi
 
 
 # Check if kerneldir contains a Makefile
-if [ ! -f $LINUXDIR/Makefile ] 
-then 
+if [ ! -f $LINUXDIR/Makefile ]
+then
        echo "Directory $LINUXDIR does not exist or is not a kernel source directory";
        exit 1;
 fi
@@ -65,7 +65,7 @@ SUBLEVEL=`grep -s SUBLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'SUBLEVEL = '
 
 # Can we handle this version?
 if [ $VERSION -ne 2  -o $PATCHLEVEL -lt 6  ]
-then 
+then
        echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher"
        exit 1;
 fi
@@ -92,12 +92,12 @@ else
     YAFFS_PATCHED=1
     echo "Updating $KCONFIG"
     mv -f $KCONFIG  $KCONFIGOLD
-    sed -n -e "/JFFS/,99999 ! p" $KCONFIGOLD >$KCONFIG
+    sed -n -e "/[Jj][Ff][Ff][Ss]/,99999 ! p" $KCONFIGOLD >$KCONFIG
     echo "">>$KCONFIG
     echo "# Patched by YAFFS" >>$KCONFIG
     echo "source \"fs/yaffs2/Kconfig\"">>$KCONFIG
     echo "">>$KCONFIG
-    sed -n -e "/JFFS/,99999 p" $KCONFIGOLD >>$KCONFIG
+    sed -n -e "/[Jj][Ff][Ff][Ss]/,99999 p" $KCONFIGOLD >>$KCONFIG
 
    # now do fs/Makefile -- simply add the target at the end
     echo "Updating $MAKEFILE"
@@ -112,7 +112,9 @@ YAFFSDIR=$LINUXDIR/fs/yaffs2
 
 if [ -e $YAFFSDIR ]
 then
-   echo "$YAFFSDIR exists, not patching"
+   echo "$YAFFSDIR exists, not patching."
+   echo "If you want to replace what is already there then delete $YAFFSDIR"
+   echo " eg.  \"rm -rf $YAFFSDIR\" "
 else
    mkdir $LINUXDIR/fs/yaffs2
    $CPY  $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile