
I have been trying out loading the Linux kernel using a USB flash drive in the u-boot-2009.06-rc2 release and ran into a problem with one of my flash drives. This particular drive has a block size of 2048 while the other drives have block sizes of 512. The drives with a block size of 512 work perfectly. However, the flash drive with a block size of 2048 fails during the 'usb start' command. I traced this issue to the Part_dos.c file and the function test_part_dos. The buffer allocated there is only 512 bytes. When I changed it to 2048, the 'usb start' command worked correctly and found the one storage device connected. This had no adverse affect with the flash drives that were 512 bytes. Should the macro DEFAULT_SECTOR_SIZE be changed to accommodate larger block size usb flash drives?
The second problem came when I tried to use the FAT utilities. When I ran 'fatls usb 0', it failed the same way as when the 'usb start' failed before. Naturally, I guessed that it was a buffer size problem again. I was able to trace the issue to the macro SECTOR_SIZE in fat.h. I tried changing it to 2048, however, there is a check right below it that fails if SECTOR_SIZE != FS_BLOCK_SIZE. So, I assume that the support isn't written to handle sector sizes that are different than the FAT block size. However, I went ahead and changed them both to 2048. This fixed the issues with the FAT utilities partly. I was able to run 'fatls usb 0' and it listed the files but also some junk. I'm guessing it was grabbing junk after the files since the block size is too big. I was also able to run 'fatload usb 0 0x22000000 uImage' successfully and boot the kernel successfully. So, I think the fix has to be in the SECTOR_SIZE macro in the fat.h file. Can anyone with expertise in the FAT implementation take a look at supporting different sector sizes for larger block size flash drives?
I can send a large block flash drive to someone if they're willing to take a look at this issue and they don't have one of these drives.
Thanks,
Clifton A Barnes INDesign, LLC cabarnes@indesign-llc.com