[U-Boot] Large Block USB Flash Drive Problem

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

Hello,
2009/5/28 Barnes, Clifton A. cabarnes@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

From: l.pinguin@gmail.com [mailto:l.pinguin@gmail.com] On Behalf Of Remy Bohmer Sent: Monday, June 01, 2009 12:04 PM To: Barnes, Clifton A. Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] Large Block USB Flash Drive Problem
Hello,
2009/5/28 Barnes, Clifton A. cabarnes@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
Remy,
Do you know if anyone is actively working on this issue? I tried applying the patch to the most recent U-Boot but it doesn't apply cleanly. If no one is working on it, I might try to take a look at updating the patch and fixing the issue. Is this not a big issue with people using USB flash drives? It seems I'm running into more and more "large block" flash drives.
Also, while clicking around the Git repo, I noticed that USB Ethernet support for the AT91 micros was added to U-Boot development. How far along is the USB Ethernet support? Is it something that can be tested now?
Thanks, Clif

Hi,
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...
Do you know if anyone is actively working on this issue?
Not that I am aware of...
I tried applying the patch to the most recent U-Boot but it doesn't apply cleanly. If no one is working on it, I might try to take a look at updating the patch and fixing the issue.
Great!
Is this not a big issue with people using USB flash drives? It seems I'm running into more and more "large block" flash drives.
I heard no complains so far...
Also, while clicking around the Git repo, I noticed that USB Ethernet support for the AT91 micros was added to U-Boot development. How far along is the USB Ethernet support? Is it something that can be tested now?
Well, it should be fully operational, and I need to be push it to mainline. I left it in the u-boot-usb tree for the time being, because the ARM-subsystem (and lib_arm) was changing a lot lately and I was waiting until that was stabilised. Probably something for the next release... Currently the patches are split up in such a way that I can even push it forward without the ARM support.
Kind regards,
Remy
participants (2)
-
Barnes, Clifton A.
-
Remy Bohmer