firmware problem

Patrick Higgins phiggins at transzap.com
Wed Jul 5 14:18:27 EDT 2000


This is pretty much a big pain in the neck that I also ran into a while
ago (can't remember the cause, though).  Anyway, the only way I found to
recover the flash was to erase the entire thing.  The bad block table
(made when the flash is manufactured) could probably be saved somewhere,
but I never coded it up because I don't know the location or format.  
Anyway, you can use the attached utility (a modified version of
util/erase.c which erases all the flash, not just a single block).  We
should definitely look into adding support for saving the bad block table,
though.

-Patrick


On Tue, 4 Jul 2000, Rodrigo Moya wrote:

> 
> Hi all!
> 
> I am trying to put the firmware in the DOC, using the following command:
> 
> dformat /win:d000 /s:doc123.exb
> 
> and I get the following error message:
> 
> Format failed, Medium not large enough
> 
> Any idea on what's happening?
> 
> Thanks
> 
> 
> 
> To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org
> 

-------------- next part --------------
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <sys/ioctl.h>
#include <sys/mount.h>

#include <linux/mtd/mtd.h>

int main(int argc,char *argv[])
{
  mtd_info_t meminfo;
  int Fd;
  unsigned long Length;
  
  if (1 >= argc)
    {
      fprintf(stderr,"You must specify a device\n");
      return 16;
    }
  
  // Open and size the device
  if ((Fd = open(argv[1],O_RDWR)) < 0)
    {
      fprintf(stderr,"File open error\n");
      return 8;
    }
  
  
   if (ioctl(Fd,MEMGETINFO,&meminfo) == 0)
     {
       erase_info_t erase;
       
       printf("Device information:\n");
       printf("Name: %s\n", meminfo.name);
       printf("Type: %d\n", meminfo.type);
       printf("Flags: %d\n", meminfo.flags);
       printf("Size: %d\n", meminfo.size);
       printf("Erase size: %d\n", meminfo.erasesize);
       printf("OOB block: %d\n", meminfo.oobblock);
       printf("OOB size: %d\n", meminfo.oobsize);
       printf("ECC type: %d\n", meminfo.ecctype);
       printf("ECC size: %d\n", meminfo.eccsize);
       
       erase.length = meminfo.erasesize;
       erase.start = 0;
       
       printf("Erasing...", erase.start);
       while (erase.start < meminfo.size)
	 {
	   fflush(stdout);
	   
	   if (ioctl(Fd,MEMERASE,&erase) != 0)
	     {
	       perror("\nMTD Erase failure");
	       close(Fd);
	       return 8;
	     }
	   erase.start += erase.length;
	 }
       printf("done\n");
     }
   return 0;
}


More information about the linux-mtd mailing list