First of all, thanks for your answer.
To clarify a point:
Mikrotik is using the yaffs code in two different places: in the
routerOS kernel (which is a heavily patched 2.4 linux kernel) and in the
bootloader.
The source code for the kernel patches is available under the GPL (you
can download it from somewhere on
www.routerboard.com). There have been
some complaints about it not being up to date with what they are
actually shipping in routerOS, but it's mainly about drivers, so yaffs
shouldn't be affected.
On the other hand, we know nothing about the bootloader. I suppose they
bought a commercial license, but AFAIK nobody ever asked them about it.
Anyway, the two implementations are clearly working together, so they
must share the same oob layout. We can get that from the kernel patches,
and it is the the exact same yaffs_oob_layout you posted above.
> You could try using the yaffs_oobinfo as your default in MTD.
I replaced (in nand_base.c)
static struct nand_ecclayout nand_oob_16 = {
.eccbytes = 6,
.eccpos = {0, 1, 2, 3, 6, 7},
.oobfree = {
{.offset = 8,
. length = 8}}
};
with
static struct nand_ecclayout nand_oob_16 = {
.eccbytes = 6,
.eccpos = {8, 9, 10, 13, 14, 15},
.oobfree = {}
};
Now, when mounting the partition I dumped before I get:
block 1 is bad
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
yaffs tragedy: existing chunk < 0 in scan
I guess the .oobfree part is totally wrong, but I don't know which bytes
are "free" (for what?) in the old layout.
> One could take the page data (512 bytes) and compute the 6 ECC bytes,
> then look for them in this sample -- this could reveal the answer.
I can try that as soon as I have some more spare time (which won't be
before the weekend).
I'd also be really grateful if you could point me to some up-to-date
documentation about the linux mtd implementation.
Andrea