public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Brad Parker <brad@heeltoe.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] fat32 w/o parition table? (a.k.a VBR instead of MBR)
Date: Thu, 08 May 2008 16:33:55 -0400	[thread overview]
Message-ID: <1998.1210278835@mini> (raw)


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

             reply	other threads:[~2008-05-08 20:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08 20:33 Brad Parker [this message]
2008-06-04 22:05 ` [U-Boot-Users] fat32 w/o parition table? (a.k.a VBR instead of MBR) Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1998.1210278835@mini \
    --to=brad@heeltoe.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox