From: marty Date: Sun, 31 Jul 2005 09:04:13 +0000 (+0000) Subject: Added files that support the ability to "patchin" yaffs2 into the 2.6 X-Git-Tag: pre-name-change~437 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=c898fad8c0b581688b4ebd9d7952c909379d6df7 Added files that support the ability to "patchin" yaffs2 into the 2.6 kernel tree so that it can be compiled there. Makefile.kernel and patch-ker.sh will need to be edited when the source tree is reorganized. --- diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..65958cf --- /dev/null +++ b/Kconfig @@ -0,0 +1,78 @@ +# +# YAFFS file system configurations +# + +config YAFFS_FS + tristate "YAFFS2 file system support" + help + YAFFS2, or Yet Another Flash Filing System, is a filing system + optimised for NAND Flash chips. + + To compile the YAFFS2 file system support as a module, choose M here: + the module will be called yaffs2. + + If unsure, say N. + + Further information on YAFFS2 is available at + . + +config YAFFS_YAFFS1 + bool "512 byte / page devices" + depends on YAFFS_FS + help + Enable YAFFS1 support -- yaffs for 512 byte / page devices + + If unsure, say Y. + +config YAFFS_YAFFS2 + bool "2048 byte (or larger) / page devices" + depends on YAFFS_FS + help + Enable YAFFS2 support -- yaffs for >= 2048 byte / page larger devices + + If unsure, say Y. + +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 && !YAFFS_USE_NANDECC + 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_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_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/Makefile.kernel b/Makefile.kernel new file mode 100644 index 0000000..cf8508c --- /dev/null +++ b/Makefile.kernel @@ -0,0 +1,10 @@ +# +# 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-y += yaffs_packedtags2.o +yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o +yaffs-y += yaffs_mtdif.o yaffs_mtdif2.o diff --git a/patch-ker.sh b/patch-ker.sh new file mode 100755 index 0000000..5c67f25 --- /dev/null +++ b/patch-ker.sh @@ -0,0 +1,109 @@ +#!/bin/sh +# +# YAFFS: Yet another FFS. A NAND-flash specific file system. +# +# Copyright (C) 2002 Aleph One Ltd. +# +# Created by Charles Manning +# +# 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-07-31 09:04:13 marty 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` + +MAKEFILE=$LINUXDIR/fs/Makefile +MAKEFILEOLD=$LINUXDIR/fs/Makefile.pre.yaffs + +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/yaffs2/Kconfig\"">>$KCONFIG + echo "">>$KCONFIG + sed -n -e "/JFFS/,99999 p" $KCONFIGOLD >>$KCONFIG + + # now do fs/Makefile -- simply add the target at the end + echo "Updating $MAKEFILE" + cp -f $MAKEFILE $MAKEFILEOLD + echo "">>$MAKEFILE + echo "# Patched by YAFFS" >>$MAKEFILE + echo "obj-\$(CONFIG_YAFFS_FS) += yaffs2/" >>$MAKEFILE + +fi + +YAFFSDIR=$LINUXDIR/fs/yaffs2 + +if [ -e $YAFFSDIR ] +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 +fi