OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 1:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: BPB giving incorrect values?
PostPosted: Sun Jan 10, 2010 4:23 pm 
Offline

Joined: Sun Jan 10, 2010 3:23 am
Posts: 2
I've been trying to make my FAT12 bootloader not depend on being on a 1.44" floppy. I'm trying to make it boot from a bochs hard disk image partition, but for some reason it seems like mkdosfs is filling the BPB with incorrect values. It writes that there are 8 sectors per FAT, and when my code uses that value it cannot find the second stage in the root directory, but if I manually change it to 9 sectors per FAT, like it is on a floppy, then the second stage is found. Why would mkdosfs, which creates the FATs, not know how many sectors they are? How can I correct for this?


Top
 Profile  
 
 Post subject: Re: BPB giving incorrect values?
PostPosted: Mon Jan 11, 2010 7:21 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 07, 2007 1:45 pm
Posts: 1401
Location: Eugene, OR, US
Possibility #1: The sectors per fat is correct, but the number of sectors per track is wrong. Bochs uses its own idea for SPT, Heads per cyl, and # of cyls -- and mkdosfs has no way of knowing what values bochs will use.

#2: Bochs has a bug when it comes to hard disk images that are not created with bximage. The usual symptom is that the bochs BIOS locks up when you try to read the image, but there could be other errors that I don't know about.

#3: You may have an off-by-one error when you are trying to take into account the reserved sectors at the beginning of the partition, and the offset of the beginning of the partition from the beginning of the disk. Remember that in CHS, the first sector is sector #1, not sector #0 -- this one thing can easily cause off by one errors -- it tripped me up twice, as I recall.

You may want to look at the FAT12 hard disk/floppy boot code that I posted here: viewtopic.php?p=167868#p167868


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 192 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group