yaffs: Add more messages to the patch-ker.sh script
[yaffs2.git] / patch-ker.sh
index ad92e7c4c36ae073db6f8283d8152201e03d62d5..58940874862e207d9741f801df8985d563d2bd33 100755 (executable)
@@ -22,15 +22,17 @@ VERSION=0
 PATCHLEVEL=0
 SUBLEVEL=0
 COPYORLINK=$1
-LINUXDIR=$2
+MULTIORSINGLE=$2
+LINUXDIR=$3
 
 # To be a Linux directory, it must have a Makefile
 
 
 # Display usage of this script
 usage () {
-       echo "usage:  $0  c/l kernelpath"
+       echo "usage:  $0  c/l m/s kernelpath"
        echo " if c/l is c, then copy. If l then link"
+       echo " if m/s is m, then use multi version code. If s then use single version code"
        exit 1
 }
 
@@ -50,6 +52,23 @@ else
    usage;
 fi
 
+if [ $MULTIORSINGLE = m ]; then
+   VFSGLUE="yaffs_vfs_multi.c"
+elif [ $MULTIORSINGLE = s ]; then
+   VFSGLUE="yaffs_vfs.c"
+   echo ""
+   echo "*** Warning ***"
+   echo "You have chosen to use the single kernel variant of the yaffs VFS glue code"
+   echo "that only works with the latest Linux kernel tree. If you are using an older"
+   echo "version of Linux then you probably wanted to use the multi-version variant by"
+   echo "re-running the patch-ker.sh script using m as a the second argument."
+   echo " ie $0 $COPYORLINK m $LINUXDIR"
+   echo ""
+else
+   echo "unknown multi/single version selection"
+   usage;
+fi
+
 
 # Check if kerneldir contains a Makefile
 if [ ! -f $LINUXDIR/Makefile ]
@@ -112,12 +131,14 @@ YAFFSDIR=$LINUXDIR/fs/yaffs2
 
 if [ -e $YAFFSDIR ]
 then
-   echo "$YAFFSDIR exists, not patching."
-   echo "If you want to replace what is already there then delete $YAFFSDIR"
+   echo "$YAFFSDIR exists, so not patching. If you want to replace what is"
+   echo "already there then delete $YAFFSDIR and re-run this script"
    echo " eg.  \"rm -rf $YAFFSDIR\" "
 else
    mkdir $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
+   rm $LINUXDIR/fs/yaffs2/yaffs_vfs.c $LINUXDIR/fs/yaffs2/yaffs_vfs_multi.c
+   $CPY $PWD/$VFSGLUE $LINUXDIR/fs/yaffs2/yaffs_vfs_glue.c
 fi