Fix bad-block status during query.
[yaffs2.git] / patch-ker.sh
index 5c67f250cbd20d18471b58d250b279df15a9e6c9..6ffabecd2ff1ca0da1e46ebba09f2552740b879c 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # YAFFS: Yet another FFS. A NAND-flash specific file system.
 #
-# Copyright (C) 2002 Aleph One Ltd.
+# Copyright (C) 2002-2006 Aleph One Ltd.
 # 
 # Created by Charles Manning <charles@aleph1.co.uk>
 # 
 #
 #  Somewhat "inspired by" the mtd patchin script
 #
-#  $Id: patch-ker.sh,v 1.1 2005-07-31 09:04:13 marty Exp $
+#  $Id: patch-ker.sh,v 1.3 2007-07-25 01:04:38 charles Exp $
 
 VERSION=0
 PATCHLEVEL=0
 SUBLEVEL=0
-LINUXDIR=$1
+COPYORLINK=$1
+LINUXDIR=$2
 
 # To be a Linux directory, it must have a Makefile
 
 
 # Display usage of this script
 usage () {
-       echo "usage:  $0  kernelpath"
+       echo "usage:  $0  c/l kernelpath"
+       echo " if c/l is c, then copy. If l then link"
        exit 1
 }
 
@@ -39,6 +41,16 @@ then
     usage;
 fi
 
+if [ $COPYORLINK = l ]; then
+   CPY="ln -s"
+elif [ $COPYORLINK = c ]; then
+   CPY="cp"
+else
+   echo "unknown copy or link type"
+   usage;
+fi
+
+
 # Check if kerneldir contains a Makefile
 if [ ! -f $LINUXDIR/Makefile ] 
 then 
@@ -103,7 +115,7 @@ then
    echo "$YAFFSDIR exists, not patching"
 else
    mkdir $LINUXDIR/fs/yaffs2
-   cp Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile
-   cp Kconfig $LINUXDIR/fs/yaffs2
-   cp *.c *.h  $LINUXDIR/fs/yaffs2
+   $CPY  $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile
+   $CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2
+   $CPY $PWD/*.c $PWD/*.h  $LINUXDIR/fs/yaffs2
 fi