
On Wed, 3 Sep 2008, Markus Klotzbücher wrote:
Dear Guennadi,
On Tue, Sep 02, 2008 at 07:05:29PM +0200, Guennadi Liakhovetski wrote:
+static int flash_flag_obsolete (int dev, int fd, off_t offset) +{
- struct mtd_info_user mtdinfo;
- int rc;
- rc = ioctl (fd, MEMGETINFO, &mtdinfo);
- if (rc < 0) {
perror ("Cannot get MTD information");
return -1;
- }
- if (mtdinfo.type == MTD_NANDFLASH) {
/*
* No luck on NAND - we could save the erase, but have to write
* a whole erase block anyway
*/
rc = __flash_write_buf (dev, fd, &obsolete_flag,
sizeof (obsolete_flag), offset,
&mtdinfo);
Hmmm, what exactly are you doing here? IIRC environment in NAND was implemented slightly differently than NOR in that it reused the obsolete flag as a serial number. This number is incremented for every write so the env with the higher number is always the current one (besides the corner case where the number overflows, see env_nand.c). This way the obsoleting can be completly avoided.
I can't see this in your patch?
No, it is not there, because I had no idea about it:-( Thanks for pointing out - will implement in the next version.
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D.
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de