Hello all,
I am doing some development for an android 2.1 platform, and have observed some erroneous behavior from yaffs in the process that I was hoping to get assistance with. For our system, we are using yaffs2 to store our rootfs in a OneNAND flash. With the version of yaffs that comes stock with the android kernel, I have been able to mount the OneNAND, write the rootfs to OneNAND, sync, umount, and mount again to verify that byte for byte everything is written and read correctly. When I power cycle my device, however, the rootfs that is loaded from the OneNAND becomes inconsistent with what was written and verified. A hexdump on the differing files (mostly seemingly random binaries) shows that the rootfs loaded out of OneNAND after power cycling contains blocks of size 2k filled with zeros where I expect to see valid data.
After browsing around the archives for this mailing list, I found a few threads that hinted at similar sounding issues that recommended doing a pull on the yaffs git repository and recompiling the kernel with the latest source. I have since done so, and after making some minor edits to the Makefile, was able to get a cleanly compiled kernel image. With this image, I am able to mount my rootfs from the OneNAND without receiving any error messages, but it appears that my rootfs is being erased in the process. When I cd into the OneNAND's mount point, I see only the lost+found directory. If I then revert back to my previous kernel (the one that uses the older version of yaffs that is distributed with android), I am able to mount the OneNAND, but still see only the lost+found directory.
I have attempted to debug this issue as best as I can, but admittedly I am rather inexperienced when it comes to working with yaffs. I have tried setting a few of the trace flags available with /proc/yaffs, but have yet to come across any messages that stand out as being erroneous.
If this is a known issue, or if I can provide any more specific information (output when running with specific trace flags, various snippets of source code, etc), let me know and I will be happy to oblige to the best of my ability.
Thank you in advance,
Jordan Wills
For reference, the modifications I have made to the Makefile is appended below. I apologize for this incredibly crude means of conveying source code, but I am fairly new to communicating via mailing lists and do not yet know of a good means of hosting such files for easy access to all.
Makefile distributed with Android:
>#
># 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_checkptrw.o
>yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o yaffs_qsort.o
>yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o
>yaffs-y += yaffs_mtdif.o yaffs_mtdif1.o yaffs_mtdif2.o
Makefile distributed with latest git clone of yaffs source:
># Main Makefile for out-of-tree yaffs2.ko building
>#
>#
># YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
>#
># Copyright (C) 2002-2010 Aleph One Ltd.
># for Toby Churchill Ltd and Brightstar Engineering
>#
># 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.
>
>
>ifneq ($(KERNELRELEASE),)
> EXTRA_CFLAGS += -DYAFFS_OUT_OF_TREE
>
> obj-m := yaffs2.o
>
> yaffs2-objs := yaffs_mtdif.o yaffs_mtdif2.o
> yaffs2-objs += yaffs_mtdif1.o yaffs_packedtags1.o
> yaffs2-objs += yaffs_ecc.o yaffs_fs.o yaffs_guts.o
> yaffs2-objs += yaffs_packedtags2.o
> yaffs2-objs += yaffs_tagscompat.o yaffs_tagsvalidity.o
> yaffs2-objs += yaffs_checkptrw.o yaffs_nand.o
> yaffs2-objs += yaffs_checkptrw.o yaffs_nand.o yaffs_nameval.o
> yaffs2-objs += yaffs_allocator.o yaffs_bitmap.o
> yaffs2-objs += yaffs_yaffs1.o
> yaffs2-objs += yaffs_yaffs2.o
> yaffs2-objs += yaffs_verify.o
>
>else
> KERNELDIR ?= /lib/modules/$(shell uname -r)/build
> PWD := $(shell pwd)
>
>modules default:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
>
>mi modules_install:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
>
>clean:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
>endif
Makefile used in current systems (trying to compile Android's kernel with the Makefile provided from the yaffs git pull resulted in an inability to mount the OneNAND)
>#
># Makefile for the linux YAFFS filesystem routines.
>#
>
>obj-$(CONFIG_YAFFS_FS) += yaffs.o
>
>yaffs-y := yaffs_mtdif.o yaffs_mtdif2.o
>yaffs-y += yaffs_mtdif1.o yaffs_packedtags1.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_checkptrw.o yaffs_nand.o
>yaffs-y += yaffs_checkptrw.o yaffs_nand.o yaffs_nameval.o
>yaffs-y += yaffs_allocator.o yaffs_bitmap.o
>yaffs-y += yaffs_yaffs1.o
>yaffs-y += yaffs_yaffs2.o
>yaffs-y += yaffs_verify.o