Add first-cut Linux kernel patch-in mechanism
authorcharles <charles>
Wed, 6 Apr 2005 01:03:46 +0000 (01:03 +0000)
committercharles <charles>
Wed, 6 Apr 2005 01:03:46 +0000 (01:03 +0000)
linux-kernel/README
linux-kernel/fs/yaffs/Kconfig [new file with mode: 0644]
linux-kernel/fs/yaffs/Makefile [new file with mode: 0644]
linux-kernel/patch-ker.sh [new file with mode: 0755]

index f259622744cd08611eb3f43f1b3ac2a529d3a33c..7b59e30f7467c799123415cc6dbc60a8f3100a2a 100644 (file)
@@ -1,6 +1,9 @@
 To build YAFFS in the Linux kernel tree you need to run the patch-in-yaffs
 script.
 
-After you've run the script, go back tou your normal kernel making procedure
+After you've run the script, go back to your normal kernel making procedure
 and configure the yaffs settings you want.
 
+Prolems? Contact the yaffs mailing list.
+
+$Id: README,v 1.2 2005-04-06 01:03:46 charles Exp $
\ No newline at end of file
diff --git a/linux-kernel/fs/yaffs/Kconfig b/linux-kernel/fs/yaffs/Kconfig
new file mode 100644 (file)
index 0000000..1a87fd1
--- /dev/null
@@ -0,0 +1,131 @@
+#
+# YAFFS file system configurations
+#
+config YAFFS_FS
+       tristate "Yet Another Flash Filing System(YAFFS) file system support"
+       help
+         YAFFS, for Yet Another Flash Filing System, is a filing system
+         optimised for NAND Flash chips.
+
+         To compile the YAFFS file system support as a module, choose M here:
+         the module will be called yaffs.
+
+         If unsure, say N.
+
+         Further information on YAFFS is available at
+         <http://www.aleph1.co.uk/yaffs/>.
+
+config YAFFS_MTD_ENABLED
+       bool "NAND mtd support"
+       depends on YAFFS_FS
+       help
+         This adds the yaffs file system support for working with a NAND mtd.
+
+         If unsure, say Y.
+
+config YAFFS_RAM_ENABLED
+       bool "yaffsram file system support"
+       depends on YAFFS_FS
+       help
+         This adds the yaffsram file system support. Nice for testing on x86,
+         but uses 2MB of RAM.  Don't enable for NAND-based targets.
+
+         If unsure, say N.
+
+comment "WARNING: mtd and/or yaffsram support should be selected"
+       depends on YAFFS_FS && !YAFFS_MTD_ENABLED && !YAFFS_RAM_ENABLED
+
+config YAFFS_USE_OLD_MTD
+       bool "Old mtd support"
+       depends on YAFFS_FS && 0
+       help
+         Enable this to use the old MTD stuff that did not have yaffs support.
+         You can use this to get around compilation problems, but the best
+         thing to do is to upgrade your MTD support. You will get better speed.
+
+         If unsure, say N.
+
+config YAFFS_USE_NANDECC
+       bool "Use ECC functions of the generic MTD-NAND driver"
+       depends on YAFFS_FS
+       default y
+       help
+         This enables the ECC functions of the generic MTD-NAND driver.
+         This will not work if you are using the old mtd.
+
+         NB Use NAND ECC does not work at present with yaffsram.
+
+         If unsure, say Y.
+
+config YAFFS_ECC_WRONG_ORDER
+       bool "Use the same ecc byte order as Steven Hill's nand_ecc.c"
+       depends on YAFFS_FS
+       help
+         This makes yaffs_ecc.c use the same ecc byte order as
+         Steven Hill's nand_ecc.c. If not set, then you get the
+         same ecc byte order as SmartMedia.
+
+         If unsure, say N.
+
+config YAFFS_USE_GENERIC_RW
+       bool "Use Linux file caching layer"
+       default y
+       depends on YAFFS_FS
+       help
+         Use generic_read/generic_write for reading/writing files. This
+         enables the use of the Linux file caching layer.
+
+         If you disable this, then caching is disabled and file read/write
+         is direct.
+
+         If unsure, say Y.
+
+config YAFFS_USE_HEADER_FILE_SIZE
+       bool "Use object header size"
+       depends on YAFFS_FS
+       help
+         When the flash is scanned, two file sizes are constructed:
+         * The size taken from the object header for the file.
+         * The size figured out by scanning the data chunks.
+         If this option is enabled, then the object header size is used,
+         otherwise the scanned size is used.
+
+         If unsure, say N.
+
+config YAFFS_DISABLE_CHUNK_ERASED_CHECK
+       bool "Turn off debug chunk erase check"
+       depends on YAFFS_FS
+       default y
+       help
+         Enabling this turns off the test that chunks are erased in flash
+         before writing to them.  This is safe, since the write verification
+         will fail.  Suggest enabling the test (ie. say N)
+         during development to help debug things.
+
+         If unsure, say Y.
+
+#config YAFFS_DISABLE_WRITE_VERIFY
+#      bool "Disable write verify (DANGEROUS)"
+#      depends on YAFFS_FS && EXPERIMENTAL
+#      help
+#        I am severely reluctant to provide this config. Disabling the
+#        verification is not a good thing to do since NAND writes can
+#        fail silently.  Disabling the write verification will cause your
+#        teeth to rot, rats to eat your corn and give you split ends.
+#        You have been warned. ie. Don't uncomment the following line.
+#
+#        If unsure, say N.
+#
+
+config YAFFS_SHORT_NAMES_IN_RAM
+       bool "Cache short names in RAM"
+       depends on YAFFS_FS
+       default y
+       help
+         If this config is set, then short names are stored with the
+         yaffs_Object.  This costs an extra 16 bytes of RAM per object,
+         but makes look-ups faster.
+
+         If unsure, say Y.
+
diff --git a/linux-kernel/fs/yaffs/Makefile b/linux-kernel/fs/yaffs/Makefile
new file mode 100644 (file)
index 0000000..7553666
--- /dev/null
@@ -0,0 +1,13 @@
+
+#
+# Makefile for the linux YAFFS filesystem routines.
+#
+
+obj-$(CONFIG_YAFFS_FS) += yaffs.o
+
+yaffs-y := yaffs_ecc.o yaffs_fs.o yaffs_guts.o
+
+yaffs-$(CONFIG_YAFFS_MTD_ENABLED) += yaffs_mtdif.o
+yaffs-$(CONFIG_YAFFS_RAM_ENABLED) += yaffs_ramem.o
+
diff --git a/linux-kernel/patch-ker.sh b/linux-kernel/patch-ker.sh
new file mode 100755 (executable)
index 0000000..0db4cae
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# YAFFS: Yet another FFS. A NAND-flash specific file system.
+#
+# Copyright (C) 2002 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
+#
+#  Somewhat "inspired by" the mtd patchin script
+#
+#  $Id: patch-ker.sh,v 1.1 2005-04-06 01:03:46 charles Exp $
+
+VERSION=0
+PATCHLEVEL=0
+SUBLEVEL=0
+LINUXDIR=$1
+
+# To be a Linux directory, it must have a Makefile
+
+
+# Display usage of this script
+usage () {
+       echo "usage:  $0  kernelpath"
+       exit 1
+}
+
+
+
+if [ -z $LINUXDIR ]
+then
+    usage;
+fi
+
+# Check if kerneldir contains a Makefile
+if [ ! -f $LINUXDIR/Makefile ] 
+then 
+       echo "Directory $LINUXDIR does not exist or is not a kernel source directory";
+       exit 1;
+fi
+
+# Get kernel version
+VERSION=`grep -s VERSION <$LINUXDIR/Makefile | head -n 1 | sed s/'VERSION = '//`
+PATCHLEVEL=`grep -s PATCHLEVEL <$LINUXDIR/Makefile | head -n 1 | sed s/'PATCHLEVEL = '//`
+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 
+       echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x or higher"
+       exit 1;
+fi
+
+
+KCONFIG=$LINUXDIR/fs/Kconfig
+KCONFIGOLD=$LINUXDIR/fs/Kconfig.pre.yaffs
+YAFFS_PATCHED_STRING=`grep -s yaffs <$KCONFIG | head -n 1`
+
+
+if [ ! -z "$YAFFS_PATCHED_STRING" ]
+then
+    YAFFS_PATCHED=0
+    echo "$KCONFIG already mentions YAFFS, so we will not change it"
+else
+   # Change the fs/Kconfig file
+   # Save the old Kconfig
+   # Copy all stuff up to JFFS
+   # Insert some YAFFS stuff
+   # Copy all the rest of the stuff
+
+    YAFFS_PATCHED=1
+    echo "Updating $KCONFIG"
+    mv -f $KCONFIG  $KCONFIGOLD
+    sed -n -e "/JFFS/,99999 ! p" $KCONFIGOLD >$KCONFIG
+    echo "">>$KCONFIG
+    echo "# Patched by YAFFS" >>$KCONFIG
+    echo "source \"fs/yaffs/Kconfig\"">>$KCONFIG
+    echo "">>$KCONFIG
+    sed -n -e "/JFFS/,99999 p" $KCONFIGOLD >>$KCONFIG
+
+fi    
+
+
+YAFFSDIR=$LINUXDIR/fs/yaffs
+
+if [ -e $YAFFSDIR ]
+then
+   echo "$YAFFSDIR exists, not patching"
+else
+    ln -fs `pwd`/fs/yaffs $LINUXDIR/fs/yaffs
+fi
+