Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
On Fri, 25 Apr 2008, Adrian Filipi wrote: It looks like fat.c is not handling the case where the sectors/cluster is 1, and the rood directory spans multiple clusters. In my case I was getting garbage directoy info after the invalid fat error. The attached patch stops the code from rolling past the end of cluster. It looks like a loop to walk the allocation chain is neccessary. I think get_contents() does all the right work, but it of course starts with a directory entry, which we don't have yet for /. A little refactoring might do the trick. Adrian -- Linux Software Engineer | EuroTech, Inc. | www.eurotech-inc.com FYI, my patch may have prevented walking off the end of a cluster on FAT32, but it has its own problems with larger directories on FAT16. As such, I don't recommend using it. Adrian -- Linux Software Engineer | EuroTech, Inc. | www.eurotech-inc.com - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, I prepare a new versione of fat support to test in user space, with some modification of the function. So before to post a patch in u-boot mailing list, we can adjust the library. I send an archive that contains a first step in this direction Regards Michael [EMAIL PROTECTED] wrote: Adrian Filipi wrote: It looks like fat.c is not handling the case where the sectors/cluster is 1, and the rood directory spans multiple clusters. In my case I was getting garbage directory info after the invalid fat error. The attached patch stops the code from rolling past the end of cluster. I was also getting these garbage directory entries which appeared to be file nodes being interpreted as directory nodes. I can confirm that Adrian's patch fixes this particular problem for FAT32. Now, on FAT32, whatever files are displayed by fatls are also readable by fatload. As Adrian mentions below, the files not displayed by fatls are completely inaccessible to the current fat.c with or without Adrian's patch. FAT16 also suffered from this garbage problem when there were 512 files, but the patch also fixes this. (If there is a volume name, it should use one of the root directory entries, leaving only 511 directory entries for files; otherwise, the lack/presence of a volume name probably has no effect on FAT16.) It looks like a loop to walk the allocation chain is necessary. I think get_contents() does all the right work, but it of course starts with a directory entry, which we don't have yet for /. A little refactoring might do the trick. Of course this only applies to FAT32. Adrian's patch appears to have fixed the only issue with FAT16 that I'm aware of. Time permitting, I will try to fix this remaining problem myself. Adrian, thanks for your insight into the problem and a potential solution. Sincerely, Ken Fuchs user-uboot-fat.gz Description: GNU Zip compressed data - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
In message [EMAIL PROTECTED] you wrote: I prepare a new versione of fat support to test in user space, with some modification of the function. So before to post a patch in u-boot mailing list, we can adjust the library. I send an archive that contains a first step in this direction Please don;t do that. Please ALWAYS send proper patches, inlined, and plain text. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED] I have yet to add the ESP-driver to the kernel to read the mind of the user... - Linus Torvalds in [EMAIL PROTECTED] - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, Wolfgang Denk wrote: Please don;t do that. Please ALWAYS send proper patches, inlined, and plain text. Best regards, Wolfgang Denk You are right. I try to fix this problem. I don't send a patch but a user space version to help who want to fix fat32 problem on u-boot. I don't send any more archive on the mailing list. Regards Michael - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, Time permitting, I will try to fix this remaining problem myself. Adrian, thanks for your insight into the problem and a potential solution. Sincerely, Ken Fuchs I think that is more simple to rewrite that code. It contains duplication and errors. I start to rewrite it in my spare time and so I hope that you will fix the remain problems. Regards Michael - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, [EMAIL PROTECTED] wrote: Michael Trimarchi wrote: confirm that the problem is in fat.c file and I will try to fix. It has been confirmed that fatls does _not_ list all files on FAT32 filesystems. There are _no_ reports of fatls failing to list all files on FAT16 filesystems. (There may be an unrelated bug caused by all 512 directory entries of FAT16 being used.) What additional information is needed to confirm that the problem is in fat.c? The problem is related to how fat.c manage the root directory. As reported by microsoft in FAT32, the root directory can be of variable size and is a cluster chain, just like any other directory is. The first cluster of the root directory on a FAT32 volume is stored in BPB_RootClus. Unlike other directories, the root directory itself on any FAT type does not have any date or time stamps, does not have a file name (other than the implied file name “\”), and does not contain “.” and “..” files as the first two directory entries in the directory. The only other special aspect of the root directory is that it is the only directory on the FAT volume for which it is valid to have a file that has only the ATTR_VOLUME_ID attribute bit set (see below). What is your response to the debug log you requested? It was sent to the ml almost 18 hours ago and is also quoted below. In my spare time a try to change the do_fat_read to support the chaining. Regards Michael - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
It looks like fat.c is not handling the case where the sectors/cluster is 1, and the rood directory spans multiple clusters. In my case I was getting garbage directoy info after the invalid fat error. The attached patch stops the code from rolling past the end of cluster. It looks like a loop to walk the allocation chain is neccessary. I think get_contents() does all the right work, but it of course starts with a directory entry, which we don't have yet for /. A little refactoring might do the trick. Adrian -- Linux Software Engineer | EuroTech, Inc. | www.eurotech-inc.com On Fri, 25 Apr 2008, michael wrote: Hi, [EMAIL PROTECTED] wrote: Michael Trimarchi wrote: confirm that the problem is in fat.c file and I will try to fix. It has been confirmed that fatls does _not_ list all files on FAT32 filesystems. There are _no_ reports of fatls failing to list all files on FAT16 filesystems. (There may be an unrelated bug caused by all 512 directory entries of FAT16 being used.) What additional information is needed to confirm that the problem is in fat.c? The problem is related to how fat.c manage the root directory. As reported by microsoft in FAT32, the root directory can be of variable size and is a cluster chain, just like any other directory is. The first cluster of the root directory on a FAT32 volume is stored in BPB_RootClus. Unlike other directories, the root directory itself on any FAT type does not have any date or time stamps, does not have a file name (other than the implied file name ?\?), and does not contain ?.? and ?..? files as the first two directory entries in the directory. The only other special aspect of the root directory is that it is the only directory on the FAT volume for which it is valid to have a file that has only the ATTR_VOLUME_ID attribute bit set (see below). What is your response to the debug log you requested? It was sent to the ml almost 18 hours ago and is also quoted below. In my spare time a try to change the do_fat_read to support the chaining. Regards Michael Index: fs/fat/fat.c === RCS file: /home/afilipi/repo-cvs/u-boot/fs/fat/fat.c,v retrieving revision 1.1.1.3.2.1 diff -u -r1.1.1.3.2.1 fat.c --- fs/fat/fat.c 22 Apr 2008 13:46:48 - 1.1.1.3.2.1 +++ fs/fat/fat.c 25 Apr 2008 17:06:49 - @@ -768,8 +768,7 @@ mydata-fatlength = bs.fat_length; } mydata-fat_sect = bs.reserved; -cursect = mydata-rootdir_sect - = mydata-fat_sect + mydata-fatlength * bs.fats; +mydata-rootdir_sect = mydata-fat_sect + mydata-fatlength * bs.fats; mydata-clust_size = bs.cluster_size; if (mydata-fatsize == 32) { rootdir_size = mydata-clust_size; @@ -812,7 +811,9 @@ isdir = 1; } -while (1) { +for (cursect = mydata-rootdir_sect; + cursect mydata-rootdir_sect + mydata-clust_size; + cursect++) { int i; if (disk_read (cursect, mydata-clust_size, do_fat_read_block) 0) { @@ -927,7 +928,6 @@ goto rootdir_done; /* We got a match */ } - cursect++; } rootdir_done: - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Michael Trimarchi wrote: In my spare time a try to change the do_fat_read to support the chaining. Thank you. Please let me know of anything I can do to help. Does this mean you are now able to duplicate the problem? The Microsoft Extensible Firmware Initiative FAT32 File System Specification white paper you quoted seems like a good reference document for FAT32. Is there anything better? BTW, in working with partitions = 32MB, I have used FAT12, but fs/fat/fat.c clearly doesn't support FAT12 properly. FAT12 can be useful for NOR flash devices which are often small enough for all four primary partitions to be = 32MB. Is anyone else (trying to) use FAT12 via U-Boot? My work-around for this problem has simply been force partitions = 32MB to contain FAT16 whenever U-Boot needs to read file from them. Sincerely, Ken Fuchs -Original Message- From: michael [mailto:[EMAIL PROTECTED] Sent: Friday, April 25, 2008 10:45 To: Fuchs, Ken Cc: [EMAIL PROTECTED]; u-boot-users@lists.sourceforge.net Subject: Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname Hi, [EMAIL PROTECTED] wrote: Michael Trimarchi wrote: confirm that the problem is in fat.c file and I will try to fix. It has been confirmed that fatls does _not_ list all files on FAT32 filesystems. There are _no_ reports of fatls failing to list all files on FAT16 filesystems. (There may be an unrelated bug caused by all 512 directory entries of FAT16 being used.) What additional information is needed to confirm that the problem is in fat.c? The problem is related to how fat.c manage the root directory. As reported by microsoft in FAT32, the root directory can be of variable size and is a cluster chain, just like any other directory is. The first cluster of the root directory on a FAT32 volume is stored in BPB_RootClus. Unlike other directories, the root directory itself on any FAT type does not have any date or time stamps, does not have a file name (other than the implied file name \), and does not contain . and .. files as the first two directory entries in the directory. The only other special aspect of the root directory is that it is the only directory on the FAT volume for which it is valid to have a file that has only the ATTR_VOLUME_ID attribute bit set (see below). What is your response to the debug log you requested? It was sent to the ml almost 18 hours ago and is also quoted below. In my spare time a try to change the do_fat_read to support the chaining. Regards Michael - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, I try my fix and old version of u-boot system. The only different is the align of the buffer. The hardware that I have is tested with the 32Mb, 64Mb, 128Mb, 256Mb, and it works fine. I try the scripts without any problem... but the tests doesn't cover all the possibility. Can you send me a dd of a compact flash of 64Mb that failed. I rewrite it and test and maybe post a patch. Regards Michael Adrian Filipi wrote: FYI, I too have been seeing this problem. It is 100% reproducible. It seems to be a FAT32 problem with media 256MB and smaller. I have tried various media sizes between 64MB and 2GB, MMC/SD, USB and CF media types, different boards (PXA270, EP93xx and IMX31), and lastly both the 1.3.2 and the 1.2.0 releases. The 64MB, 128MB and 256MB fails under *ALL* cases when using FAT32. All the other sises work with FAT32 and *all* of the media works fine with FAT16. FYI, I use mkfs.vfat -F 32 under linux to make the filesystems. All fingers are pointing to the FAT32 code and not hardware dependent code. It looks like a media size related problem. This is also an old bug given that it's in the 1.2.0 sources. Adrian - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
Re: [U-Boot-Users] FW: USB SUPPORT get_vfatname
Hi, just to know! What is the log if you define the USB_STOR_DEBUG in the usb_storage.c Can you send me the log? Regards Michael Adrian Filipi wrote: The patch didn't improve my first few test cases. CF and USB on an EP93xx board. I'm sending you an image off-list. Adrian -- Linux Software Engineer | EuroTech, Inc. | www.eurotech-inc.com On Thu, 24 Apr 2008, michael wrote: Hi, I try my fix and old version of u-boot system. The only different is the align of the buffer. The hardware that I have is tested with the 32Mb, 64Mb, 128Mb, 256Mb, and it works fine. I try the scripts without any problem... but the tests doesn't cover all the possibility. Can you send me a dd of a compact flash of 64Mb that failed. I rewrite it and test and maybe post a patch. Regards Michael Adrian Filipi wrote: FYI, I too have been seeing this problem. It is 100% reproducible. It seems to be a FAT32 problem with media 256MB and smaller. I have tried various media sizes between 64MB and 2GB, MMC/SD, USB and CF media types, different boards (PXA270, EP93xx and IMX31), and lastly both the 1.3.2 and the 1.2.0 releases. The 64MB, 128MB and 256MB fails under *ALL* cases when using FAT32. All the other sises work with FAT32 and *all* of the media works fine with FAT16. FYI, I use mkfs.vfat -F 32 under linux to make the filesystems. All fingers are pointing to the FAT32 code and not hardware dependent code. It looks like a media size related problem. This is also an old bug given that it's in the 1.2.0 sources. Adrian - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
[U-Boot-Users] FW: USB SUPPORT get_vfatname
Michael, I copied all files in fs/fat from git repository u-boot-at91. Made trivial changes to compile it with my code base. Added your latest get_vfatname patch, but it had no effect on the issue. fatls still doesn't list filenames in some FAT32 filesystems, including the one built via the Linux script I provided earlier in this thread. Thus, there's no point in looking at the fat.c file I sent earlier today. The problem remains in the git fat.c code or possibly in the USB stack code. However, FAT16 has never failed, so the issue is more likely to be with the FAT32 or vfat code. Sincerely, Ken Fuchs -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, April 23, 2008 13:01 To: [EMAIL PROTECTED] Cc: u-boot-users@lists.sourceforge.net Subject: Re: [U-Boot-Users] USB SUPPORT get_vfatname Michael, Sorry, your latest get_vfatname patch doesn't work either. FAT16 works perfectly, so the USB code is probably _not_ at fault. I see only problems with FAT32, but only for _some_ long collections of files. Thus, there may still be a problem with fs/fat/fat.c. Maybe there is something wrong with my copy of fat.c I attached it; Perhaps you can see a problem with it. Sincerely, Ken Fuchs -Original Message- From: michael [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 23, 2008 06:16 To: michael Cc: Fuchs, Ken; u-boot-users@lists.sourceforge.net; Wolfgang Denk Subject: Re: [U-Boot-Users] USB SUPPORT get_vfatname Hi, michael wrote: Hi, Can you try this one? Revert my last one patch? It change the test code, before the while. I use your script on a Compact Flash and it looks fine for me (under linux). Regards Michael -- -- Check if the entry is a valid dir_slot entry, otherwise it is a dentry and the name has to be taken by the get_name function Signed-off-by: michael trimarchi [EMAIL PROTECTED] --- fs/fat/fat.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 49c78ed..bc37cec 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -473,8 +473,14 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster, while (slotptr2-id 0x01) { slotptr2++; } + /* Save the real directory entry */ realdent = (dir_entry*)slotptr2 + 1; + if (slotptr2-attr != ATTR_VFAT) { + get_name ((dir_entry *)realdent, l_name); + goto out; + } + while ((__u8*)slotptr2 = get_vfatname_block) { slot2str(slotptr2, l_name, idx); slotptr2--; @@ -494,6 +500,7 @@ get_vfatname(fsdata *mydata, int curclust, __u8 *cluster, else if (*l_name == aRING) *l_name = 'å'; downcase(l_name); +out: /* Return the real directory entry */ memcpy(retdent, realdent, sizeof(dir_entry)); The scripts in this thread can be used to test the fat32 filesystem. I do some tests using Compact Flash device and this patchs work for me. I would like to know if is a fat layer problem or usb layer problem. Michael - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users