[Avila] Programming the flash from Linux
gw at lunstad.com
gw at lunstad.com
Thu May 18 19:16:40 EDT 2006
Hi Darrel et al,
I tried the secret formula, but the system failed to mount the blank
partition. I believe that I followed your instructions correctly, but
perhaps someone can spot my error.
Here is how I created the blank partition:
RedBoot> fis create -b 0x00800000 -l 0x60000 config
... Erase from 0x50d00000-0x50d60000: ...
... Program from 0x00800000-0x00860000 at 0x50d00000: ...
... Unlock from 0x50fe0000-0x51000000: .
... Erase from 0x50fe0000-0x51000000: .
... Program from 0x03fe0000-0x04000000 at 0x50fe0000: .
... Lock from 0x50fe0000-0x51000000: .
RedBoot> reset
Here is how I tried to mount it:
<immediately after booting>
# cat /proc/mtd
dev: size erasesize name
mtd0: 00080000 00020000 "RedBoot"
mtd1: 00020000 00020000 "unallocated"
mtd2: 00160000 00020000 "zimage"
mtd3: 00b00000 00020000 "ramdisk"
mtd4: 00060000 00020000 "config"
mtd5: 00280000 00020000 "unallocated"
mtd6: 0001f000 00020000 "FIS directory"
mtd7: 00001000 00020000 "RedBoot config"
# ls /dev/mtd*
/dev/mtd0 /dev/mtd3 /dev/mtdblock1 /dev/mtdblock4 /dev/mtdr2
/dev/mtd1 /dev/mtd4 /dev/mtdblock2 /dev/mtdr0 /dev/mtdr3
/dev/mtd2 /dev/mtdblock0 /dev/mtdblock3 /dev/mtdr1 /dev/mtdr4
# mkdir /mnt/flash
# mount -t jffs2 /dev/mtdblock4 /mnt/flash
jffs2: Too few erase blocks (3)
mount: Mounting /dev/mtdblock4 on /mnt/flash failed: Invalid argument
#
Would it be better if I created a jffs2 filesystem on my development
machine and copied it into memory? Any help would be much appreciated.
Thanks,
Andrew
> 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:
>
> # 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]
> Sent: Thursday, April 13, 2006 9:34 AM
> To: Avila
> Subject: Re: [Avila] Programming the flash from Linux
>
> Hey,
>
> I too will be wanting to do this in the near future. So any feedback is
> appreciated. Thanks.
>
> Travis
>
>
> ----- Original Message -----
> 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
>
>
>
> Hi,
>
> I have a requirement to program the flash from a running Linux system.
> Are
> the flashw or netflash tools suitable for that on the GW2342(8)
> platform?
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avila-unsubscribe at lists.unixstudios.net
> For additional commands, e-mail: avila-help at lists.unixstudios.net
>
>
> ---------------------------------------------------------------------
> 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