From 17b4c8e9eb30e3eb305baef98eb23325e61db592 Mon Sep 17 00:00:00 2001 From: Terry Lv Date: Tue, 28 Dec 2010 10:58:36 +0800 Subject: ENGR00137408: Add FAT32 support Add FAT32 support. The code is got from community. Based on hash number 71aab09b2c1edd1b6e00819abd1e31c04db04f36. Signed-off-by: Terry Lv --- disk/part_dos.c | 7 +++++-- disk/part_dos.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'disk') diff --git a/disk/part_dos.c b/disk/part_dos.c index b915eb7484d..ff9aa6e28bf 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c @@ -77,8 +77,10 @@ static int test_block_type(unsigned char *buffer) (buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) ) { return (-1); } /* no DOS Signature at all */ - if(strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET],"FAT",3)==0) + if (strncmp((char *)&buffer[DOS_PBR_FSTYPE_OFFSET], "FAT", 3) == 0 || + strncmp((char *)&buffer[DOS_PBR32_FSTYPE_OFFSET], "FAT32", 5) == 0) { return DOS_PBR; /* is PBR */ + } return DOS_MBR; /* Is MBR */ } @@ -188,7 +190,8 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part * fdisk does not show the extended partitions that * are not in the MBR */ - if ((pt->sys_ind != 0) && + if (((pt->boot_ind & ~0x80) == 0) && + (pt->sys_ind != 0) && (part_num == which_part) && (is_extended(pt->sys_ind) == 0)) { info->blksz = 512; diff --git a/disk/part_dos.h b/disk/part_dos.h index ac93f20b3e6..195a32cb388 100644 --- a/disk/part_dos.h +++ b/disk/part_dos.h @@ -28,13 +28,14 @@ #ifdef CONFIG_ISO_PARTITION /* Make the buffers bigger if ISO partition support is enabled -- CD-ROMS have 2048 byte blocks */ -#define DEFAULT_SECTOR_SIZE 2048 +#define DEFAULT_SECTOR_SIZE 2048 #else #define DEFAULT_SECTOR_SIZE 512 #endif #define DOS_PART_TBL_OFFSET 0x1be #define DOS_PART_MAGIC_OFFSET 0x1fe #define DOS_PBR_FSTYPE_OFFSET 0x36 +#define DOS_PBR32_FSTYPE_OFFSET 0x52 #define DOS_PBR_MEDIA_TYPE_OFFSET 0x15 #define DOS_MBR 0 #define DOS_PBR 1 -- cgit v1.2.3