Hopefully these fixes can be useful.
The subject line is a slight misnomer. I'm actually building mkyaffsimage
on a Redhat 9.0 system (thus Linux 2.4.x) to run on Redhat 9.0. I'm
building mkyaffs on Redhat 9.0 to run on Linux 2.6.10. We will be
building on all the host systems that MontaVista supports, so I will
send additional fixes if we encounter issues on the other hosts.
If putting all the patches in one tar is inconvenient I can break them
out to one patch per email -- just let me know.
Feedback, comments, questions are all welcome.
Thanks!
-Frank
--
Frank Rowand <
frank_rowand@mvista.com>
MontaVista Software, Inc
This is a list of the patches that I used to get the YAFFS userland
programs (host: mkyaffsimage, target: mkyaffs) working for Linux 2.6.10.
These changes have not checked for compatibility with Linux 2.4, but I tried
to be compatible.
Some of these fixes have been sent to this email list before, but I am
including them in this set so that I have everything I've done grouped
together in an easily found set.
yaffs_userland_01_base.patch
The userland related files, as of Oct 27, 2004, from
http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs/
"Download tarball" link
I won't send this patch to the email list, since the files can be
retrieved from the web sit.
The files are:
devextras.h
nand_ecc.c
yaffs_guts.h
yportenv.h
utils/Makefile
utils/mkyaffs.c
utils/mkyaffsimage.c
yaffs_userland_02_fixup_rh9.patch
Changes needed to allow compilation of host program on Redhat 9.0.
- /usr/include/bits/stat.h defines st_atime, st_mtime, st_ctime, thus
these strings can not be used as field names in a yaffs data
structure.
- This possible fix has been discussed on the email list, but no final
resolution exists yet.
yaffs_userland_03_mkyaffs_oobinfo.patch
Changes needed to allow compilation of target program.
- Declarations needed for mtd ioctls moved from the Linux 2.4 location of
/usr/include/linux/mtd/mtd.h to the kernel header file mtd/mtd-user.h
- Fix #include in util/mkyaffs.c.
- Add eccbytes field to initialization of yaffs_oobinfo if Linux 2.6.
- It is really bad to include kernel header files into userland
programs, but I included <linux/version.h> so that Linux 2.4 vs
Linux 2.6 could be checked.
yaffs_userland_04_fix_warnings.patch
Make host and target program compile warnings go away.... I like my newly
introduced errors to be more obvious.
yaffs_userland_05_64bit.patch
struct yaffs_ObjectHeader describes an object that resides in the YAFFS
filesystem, in the flash. The size of the structure and offsets within
the structure must be the same, whether on a 32 bit system or a 64 bit
system.
- Fix the data types used in the structure.
- Not tested on a 64 bit system.
yaffs_userland_06_mkyaffs_damaged_count.patch
mkyaffs writes a YAFFS filesystem image into flash, skipping damaged
blocks in the flash. mkyaffs checks to make sure that the image is
not larger than the flash before beginning to write the image.
- The image size is compared against the size of the flash, not the
number of undamaged blocks. Add a check to detect if the size of
the undamaged blocks was sufficient to contain the image.
yaffs_userland_07_mkyaffs_printf.patch
mkyaffs has an incorrect format specifier in printf().
- Fix it.
yaffs_userland_08_mkyaffsimage_argc.patch
mkyaffsimage incorrectly implements check of value of argc.
- Fix it.
yaffs_userland_09_mkyaffsimage_error_handling.patch
mkyaffsimage error handling done slightly incorrectly and inconsistently.
- Fix it.
yaffs_userland_10_mkyaffsimage_buf_overflow.patch
Possible buffer overflow in mkyaffsimage, if path of source filesystem
tree is too long.
- Change sprintf() to snprintf() to prevent overflow.