[PATCH] parse_redboot_partitions not always works correctly

andrzej.mialkowski at inetia.pl andrzej.mialkowski at inetia.pl
Mon Oct 27 10:25:57 EST 2003


Hi,
 I just found that redboot_parse_partitions on my system (IXDP2801) builds 
incorrect list of partitions, base addresses of some partitions are wrong. I 
located a problem in following line in redboot.c:
		buf[i].flash_base &= master->size-1;
This line tries to relocate partition base address to be 0 based, by cutting 
off some high order bits. This expression works correctly if two assumptions 
are true:
 1) master->size should be power of 2
 2) base address must be aligned to map size
Unfortunately on my board both are false: I have 10 flash chips, and base 
address is not aligned to size even after number of chips align to 16 (because 
of banking).

On different platforms I sow different use of flash base address. Some platforms
are using 0 based addresses in redboot some other physical address of flash 
chip (my case). As far as I know base address used for building partition 
entries is not stored.

The most portable method that I found is use "FIS directory" entry for guessing 
value of flash base used during building partitions. Assumption here is simple:
FIS directory is located in known place at MTD level, in last erase block of 
map. Subtracting flash base address stored in this entry with actual location 
at map driver offset level should give base address used during creating 
partition table.
Of course all partition entries must be created with the same flash base 
address.
Did anybody have better idea? Patch attached.
Thanks in advance for comments.

	Andrzej Mialkowski

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mtd-redboot-parse.patch
Url: http://lists.infradead.org/pipermail/linux-mtd/attachments/20031027/1e59a008/attachment.pl 


More information about the linux-mtd mailing list