[U-Boot] Large Block USB Flash Drive Problem

Remy Bohmer linux at bohmer.net
Mon Jun 1 18:04:06 CEST 2009


Hello,

2009/5/28 Barnes, Clifton A. <cabarnes at indesign-llc.com>:
>        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?

Well, there was a patch posted for this some time ago:
http://www.mail-archive.com/u-boot@lists.denx.de/msg05444.html

But, this patch broke several 512 byte blocksize devices, so I did not
push it to mainline.
You might take a look at it, maybe it solves your problem.
If you can make it work properly with 512 byte devices as well, I am
in for a patch...

Kind Regards,

Remy


More information about the U-Boot mailing list