[U-Boot-Users] fat32 w/o parition table? (a.k.a VBR instead of MBR)

After some user complaints about not being able to fatls micro sd cards which were formatted by Windows XP, I felt compelled to make the following change (to u-boot 1.1.6, which I know is ancient, but looking at the git tree, the latest doesn't handle it either near as I can tell.
Just curious if anyone has any thoughts.
In the latest code, it seems like checking the partition table first is dangerous as a VBR might looks like it has a partition table (but it would be bogus)
Some documents suggest checking the first 3 bytes of the block for the branch instructions. The idea being that an MBR with a valid partition table won't have the branch. voodoo, I know...
-brad
--- fat.c.orig 2008-05-08 16:18:40.000000000 -0400 +++ fat.c 2008-05-08 12:54:56.000000000 -0400 @@ -52,6 +52,7 @@ #define DOS_PART_TBL_OFFSET 0x1be #define DOS_PART_MAGIC_OFFSET 0x1fe #define DOS_FS_TYPE_OFFSET 0x36 +#define DOS_FS_FAT32_TYPE_OFFSET 0x52
int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr) { @@ -85,7 +86,9 @@ return -1; }
- if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) { + if(!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3) || + !strncmp((char *)&buffer[DOS_FS_FAT32_TYPE_OFFSET],"FAT32",5)) + { /* ok, we assume we are on a PBR only */ cur_part = 1; part_offset=0;
This lets me fatls/fatload from the fat32 file systems created by windows.
I've done a little FAT hacking, and I think this falls under the category of "disk with VBR instead of MBR".
-brad

Hello,
in message 1998.1210278835@mini you wrote:
After some user complaints about not being able to fatls micro sd cards which were formatted by Windows XP, I felt compelled to make the following change (to u-boot 1.1.6, which I know is ancient, but looking at the git tree, the latest doesn't handle it either near as I can tell.
Just curious if anyone has any thoughts.
In the latest code, it seems like checking the partition table first is dangerous as a VBR might looks like it has a partition table (but it would be bogus)
Some documents suggest checking the first 3 bytes of the block for the branch instructions. The idea being that an MBR with a valid partition table won't have the branch. voodoo, I know...
Strangely enough, this message seems to have received no feedback at all.
So what do we do about this?
Best regards,
Wolfgang Denk
participants (2)
-
Brad Parker
-
Wolfgang Denk