mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
FAT32: fix support for superfloppy-format (PBR)
"Superfloppy" format (in U-Boot called PBR) did not work for FAT32 as the file system type string is at a different location. Add support for FAT32. Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
a17c548b53
commit
66c2d73cfc
3 changed files with 10 additions and 4 deletions
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#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
|
||||
|
|
|
@ -50,6 +50,7 @@ static int cur_part = 1;
|
|||
#define DOS_PART_TBL_OFFSET 0x1be
|
||||
#define DOS_PART_MAGIC_OFFSET 0x1fe
|
||||
#define DOS_FS_TYPE_OFFSET 0x36
|
||||
#define DOS_FS32_TYPE_OFFSET 0x52
|
||||
|
||||
int disk_read (__u32 startblock, __u32 getsize, __u8 * bufptr)
|
||||
{
|
||||
|
@ -94,7 +95,8 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
|
|||
if (!get_partition_info (dev_desc, part_no, &info)) {
|
||||
part_offset = info.start;
|
||||
cur_part = part_no;
|
||||
} else if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3)) {
|
||||
} else if (strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3)==0 ||
|
||||
strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET],"FAT32",5)==0) {
|
||||
/* ok, we assume we are on a PBR only */
|
||||
cur_part = 1;
|
||||
part_offset = 0;
|
||||
|
@ -105,7 +107,8 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
|
|||
}
|
||||
|
||||
#else
|
||||
if (!strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET],"FAT",3)) {
|
||||
if ((strncmp((char *)&buffer[DOS_FS_TYPE_OFFSET], "FAT", 3) == 0) ||
|
||||
(strncmp((char *)&buffer[DOS_FS32_TYPE_OFFSET], "FAT32", 5) == 0)) {
|
||||
/* ok, we assume we are on a PBR only */
|
||||
cur_part = 1;
|
||||
part_offset = 0;
|
||||
|
|
Loading…
Reference in a new issue