Thank you very much,
Best regards,
Edward
Do you want to do raw read/write accesses or do you want to use a
filesystem ?
If the former: you can an use the read()/write()/lseek() calls in the
same way as, e.g. for a disk device, except that, before you can write
to a portion of flash, you must make sure it is erased. There are
two utilities in the MTD distribution to do the erase (called -what
a surprise- "erase" and "eraseall"). These work through MTD-specific
ioctl() calls.
Example:
# eraseall /dev/mtdXX
# cat data_i_want_to_store >/dev/mtdXX
If the latter: there are two filesystems specifically designed
for use with MTD devices: JFFS and JFFS2. These use the block
MTD devices. If the device is erased, a mount will implicitly
"format" it (i.e. create an empty filesystem structure on it).
Example:
# eraseall /dev/mtdXX
# mount -t jffs2 /dev/mtdblockXX /mnt
# cp data_i_want_to_store /mnt
It is also possible to create an initial filesystem image off-line
(e.g. with mkfs.jffs2) and write that image to the raw device using the
above method.
Example:
# eraseall /dev/mtdXX
# cat jffs2_image_prepared_offline >/dev/mtdXX
# mount -t jffs2 /dev/mtdblockXX /mnt
# ls /mnt
HTH
Rob
--
Robert Kaiser email: rkaiser AT sysgo DOT de
SYSGO AG http://www.elinos.com
Klein-Winternheim / Germany http://www.sysgo.de