[Avila] Programming the flash from Linux

Burns, Darrell dburns1 at ibahn.com
Thu Apr 13 12:31:03 EDT 2006


One way to access the flash is to create a fis file that encompasses the
free space (space not used by redboot, kernel, or ramdisk images).  In
my case, I have two files - flash1 and ipstorage:

   RedBoot> fis lis
   Name              FLASH addr  Mem addr    Length      Entry point
   RedBoot           0x50000000  0x50000000  0x00040000  0x00000000
   RedBoot config    0x50FC0000  0x50FC0000  0x00001000  0x00000000
   FIS directory     0x50FE0000  0x50FE0000  0x00020000  0x00000000
   zimage            0x50040000  0x01600000  0x00100000  0x00800000
   ramdisk           0x50140000  0x00800000  0x00480000  0x00800000
   flash1            0x505C0000  0x00800000  0x00920000  0x00800000
   ipstorage         0x50EE0000  0x00800000  0x000E0000  0x00800000
   RedBoot>

It doesn't matter what you put in those locations, or the Mem addr or
the Entry point.  Just create the partition.

Next, if you have the kernel option "Memory Technology Devices
(MTD)---><*>   RedBoot partition table parsing" selected, then once
Linux is loaded, you can see the redboot partitions in the /proc/mtd
file:
=20
   # cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00040000 00020000 "RedBoot"
   mtd1: 00100000 00020000 "zimage"
   mtd2: 00480000 00020000 "ramdisk"
   mtd3: 00920000 00020000 "flash1"
   mtd4: 000e0000 00020000 "ipstorage"
   mtd5: 00001000 00020000 "RedBoot config"
   mtd6: 00020000 00020000 "FIS directory"

So - once this is done, creating /dev/mtd3 and /dev/mtdblock3 devices
allows access to the flash.  Here are the files created in /dev:

   crw-rw-r--    1 0        0         90,   0 Aug 30  2005 /dev/mtd0
   crw-rw-r--    1 0        0         90,   2 Aug 30  2005 /dev/mtd1
   crw-rw-r--    1 0        0         90,   4 Aug 30  2005 /dev/mtd2
   crw-rw-r--    1 0        0         90,   6 Aug 30  2005 /dev/mtd3
   crw-rw-r--    1 0        0         90,   8 Aug 30  2005 /dev/mtd4
   crw-rw-r--    1 0        0         90,  10 Aug 30  2005 /dev/mtd5
   crw-rw-r--    1 0        0         90,  12 Aug 30  2005 /dev/mtd6
   brw-rw-r--    1 0        0         31,   0 Aug 30  2005
/dev/mtdblock0
   brw-rw-r--    1 0        0         31,   1 Aug 30  2005
/dev/mtdblock1
   brw-rw-r--    1 0        0         31,   2 Aug 30  2005
/dev/mtdblock2
   brw-rw-r--    1 0        0         31,   3 Aug 30  2005
/dev/mtdblock3
   brw-rw-r--    1 0        0         31,   4 Aug 30  2005
/dev/mtdblock4
   brw-rw-r--    1 0        0         31,   5 Aug 30  2005
/dev/mtdblock5
   brw-rw-r--    1 0        0         31,   6 Aug 30  2005
/dev/mtdblock6

In my case, I use jffs2 as a file system on /dev/mtdblock3 (the file
named 'flash1' in redboot):

	mkdir /mnt/flash
	mount -t jffs2 /dev/mtdblock3 /mnt/flash

But you can access the /dev/mtd3 as a character device also.

This method is very useful for updating the kernel or ramdisk (or even
the RedBoot image if the write-protect option isn't selected in the
kernel) from Linux.  For example, I have a ramdisk.img file - I can
actually copy it as follows:

	cp ramdisk.img /dev/mtdblock2

Next time I boot up and load the "ramdisk" file in redboot, it will be
the new ramdisk.img I copied over the top.

Darrell Burns
Sr. Firmware Engineer
iBAHN
10757 S. River Front Parkway, Suite 300
Salt Lake City, UT 84095
801.563.2023 direct

dburns1 at ibahn.com

-----Original Message-----
From: devel [mailto:devel at oberonwireless.com]=20
Sent: Thursday, April 13, 2006 9:34 AM
To: Avila
Subject: Re: [Avila] Programming the flash from Linux
Subject: [Avila] Hey,

I too will be wanting to do this in the near future. So any feedback is=20
appreciated. Thanks.

Travis

----- Original Message -----=20
From: "Tom Houweling" <Tom.Houweling at SkyWare.com>
To: "Avila" <avila at lists.unixstudios.net>
Sent: Wednesday, April 12, 2006 5:09 PM
Subject: [Avila] Programming the flash from Linux
Subject: [Avila] Hi,

I have a requirement to program the flash from a running Linux system.
Are=20
the flashw or netflash tools suitable for that on the GW2342(8)
platform?

Tom=20

---------------------------------------------------------------------
To unsubscribe, e-mail: avila-unsubscribe at lists.unixstudios.net
For additional commands, e-mail: avila-help at lists.unixstudios.net





More information about the Avila mailing list