flat assembler
Message board for the users of flat assembler.

Index > OS Construction > FAT32 BPB

Author
Thread Post new topic Reply to topic
Richy



Joined: 20 Aug 2014
Posts: 10
Richy 26 Aug 2014, 20:58
So I'm trying to setup a FAT32 system on a custom bootloader, to replace the FAT12 I was running before. FAT12 is simpler, but also outdated and unable to handle larger disks. I'm trying to boot from a Kingston 8GB DataTraveller.

After pouring over the MS documentation and any other resource I can find, this is my best shot for a BPB:

Code:
;FAT 12/16/32
bpbOEM                  DB "MSWIN4.1"
bpbBytesPerSector:      DW 512
bpbSectorsPerCluster:   DB 1
bpbReservedSectors:     DW 1
bpbNumberOfFATs:        DB 2
bpbRootEntries:                 DW 0
bpbTotalSectors16:      DW 0
bpbMedia:                       DB 0xF8
bpbSectorsPerFAT16:     DW 0
bpbSectorsPerTrack:     DW 0
bpbHeadsPerCylinder: DW 0
bpbHiddenSectors:      DD 0
bpbTotalSectors32:     DD 15148608

;FAT32
bpbSectorsPerFAT32:     DD 118348
bpbExtFlags:              DW 0
bpbVersion:               DW 0
bpbRootCluster:         DD 2
bpbFSInfoSector:        DW 1
bpbBackupBootSector: DW 6
bpbReserved8:           DQ 0
bpbReserved4:           DD 0

;FAT 12/16/32
bsDriveNumber:          DB 0x80
bsUnused:               DB 0
bsExtBootSignature:     DB 0x29
bsSerialNumber:         DD 0xa0a1a2a3
bsVolumeLabel:          DB "BOOT USB   "
bsFileSystem:           DB "FAT32   "    


When I do this, my computer (Windows 7) stops recognizing the USB stick and tells me it's not formatted. So obviously it's not right. But I can't figure out the mistake. Is anyone here familiar with FAT32 enough to help? Thanks!
Post 26 Aug 2014, 20:58
View user's profile Send private message Reply with quote
illys



Joined: 02 Oct 2014
Posts: 1
illys 02 Oct 2014, 22:53
I am a bit late, but let me try an answer: it is not because you declare a FAT32 partition that the partition contents make sense.

Probably there was a proper partition before you put your BPB, but you might be in slightly different settings, making it disappear and making the key content look like randomly filled from the OS point of view... i.e. look like not formatted.

So I guess Windows is right: there is a partition described in the BPB, but no data structure matching on the rest of the key (your 2 FATs are messed up with random or not aligned stuff).

After putting your BPB, just ask Windows to format the key, and check with a tool if the resulting partition matches the settings you entered in the BPB. If yes, your BPB is probably correct, just not matching the previous/older data.
Post 02 Oct 2014, 22:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.