First of all, I have never seen such a horror since I had been writing my
very first program... That mkyaffs2image.c has more than enough bugs to
illustrate a couple of thick books on how NOT to write programs :(( And
another question is what one is supposed to do with that file it sometimes
managed to generate?
OK, I won't start another round, not because I don't want to but purely
because of lack of time.
I'm attaching the patch against the latest CVS yaffs2 tree for
mkyaffs2image. The resulting utility is not complete in any way and it
should be rewritten from scratch but it works. It generates a proper little
endian image on little endian machine that can be put onto a NAND partition
with regular "nandwrite -a -o" command and then mounted using patched CVS
yaffs2 tree (the only file patched is mtdif2.c, i.e. that slightly bent
prong is straitened) in a stock kernel with stock MTD. Big endian conversion
is commented out because it's broken anyway, that is TBD in a proper written
utility. That mtdif2.c patch is also attached in case somebody can't find
it.
This is a quick job, OOB layouts from MTD are simply put into the utility
itself and one can choose a desired layout with a command line option. As of
now there is only one autoplace layout for large page NAND in the stock
MTD/kernel, nand_oob_64 (see drivers/mtd/nand/nand_base.c). It is number 1
in that mkyaffs2image. Number 0 is used for compatibility with the existing
utility. It produces that useless file with no purpose I'm aware of. New
layouts may be added to the utility as they appear, that is just a matter of
adding them to the layout array with simple cut'n'paste from the kernel/MTD
source.
Just in case somebody is not familiar with the procedure:
1. Erase NAND partition with "flash_eraseall _char_mtd_device_name_"
2. Make FS image with "mkyaffs2image 1 _dir_ _img_file_" where '1' is layout
number (as of now 0 for that useless file or 1 for nand_oob_64 that works
with my YAFFS2 patch)
3. Write the image to NAND partition with
"nandwrite -a -o _char_mtd_device_name_ _image_file_name_"
4. Done. You may now mount that partition.
Enjoy.
P.S. It looks like the thing stopped crashing when used as root FS. That's
tremendous progress, now it may be useful for something.
---
******************************************************************
* KSI@home KOI8 Net < > The impossible we do immediately. *
* Las Vegas NV, USA < > Miracles require 24-hour notice. *
******************************************************************