[U-Boot] [U-BOOT] operate on a udisk with fat32 fs, and 2048 block size will cause system to restart

I have a udisk(My MP3), which is fat32 format, and the fs block size is 4096(report by u-boot).
enable USB and FAT support for u-boot.
do "usb start" cause the system to restart. after looking into the u-boot code, I find that the "DEFAULT_SECTOR_SIZE" in disk/part_dos.h is too small(512) to fit a fat sector, so system run into a "out of range" trouble when it go into usb_storage.c/usb_stor_read() function.
and I also need to change the "FS_BLOCK_SIZE" in include/fat.h to 4096, otherwise, the "fatinfo/fatls/fatread" would run into the same trouble.
These is also check in u-boot-2010.06 code.
The FAT doc say the number of bytes per sector will be one of 512 , 1024, 2048, 4096, so i guess that I may need to use something like "malloc" to alloc the sector buffer ? But it seems difficult to do.
Any idea ?
Thanks.
/WX

sorry, typo in the title, it is 4096
On Mon, Jul 19, 2010 at 4:44 PM, wesley xie elelonger@gmail.com wrote:
I have a udisk(My MP3), which is fat32 format, and the fs block size is 4096(report by u-boot).
enable USB and FAT support for u-boot.
do "usb start" cause the system to restart. after looking into the u-boot code, I find that the "DEFAULT_SECTOR_SIZE" in disk/part_dos.h is too small(512) to fit a fat sector, so system run into a "out of range" trouble when it go into usb_storage.c/usb_stor_read() function.
and I also need to change the "FS_BLOCK_SIZE" in include/fat.h to 4096, otherwise, the "fatinfo/fatls/fatread" would run into the same trouble.
These is also check in u-boot-2010.06 code.
The FAT doc say the number of bytes per sector will be one of 512 , 1024, 2048, 4096, so i guess that I may need to use something like "malloc" to alloc the sector buffer ? But it seems difficult to do.
Any idea ?
Thanks.
/WX

or, may be we need to detect the buffer size in usb_stor_read, to prevent it from "out of range" ?
On Mon, Jul 19, 2010 at 4:45 PM, wesley xie elelonger@gmail.com wrote:
sorry, typo in the title, it is 4096
On Mon, Jul 19, 2010 at 4:44 PM, wesley xie elelonger@gmail.com wrote:
I have a udisk(My MP3), which is fat32 format, and the fs block size is 4096(report by u-boot).
enable USB and FAT support for u-boot.
do "usb start" cause the system to restart. after looking into the u-boot code, I find that the "DEFAULT_SECTOR_SIZE" in disk/part_dos.h is too small(512) to fit a fat sector, so system run into a "out of range" trouble when it go into usb_storage.c/usb_stor_read() function.
and I also need to change the "FS_BLOCK_SIZE" in include/fat.h to 4096, otherwise, the "fatinfo/fatls/fatread" would run into the same trouble.
These is also check in u-boot-2010.06 code.
The FAT doc say the number of bytes per sector will be one of 512 , 1024, 2048, 4096, so i guess that I may need to use something like "malloc" to alloc the sector buffer ? But it seems difficult to do.
Any idea ?
Thanks.
/WX
participants (1)
-
wesley xie