|BPB giving incorrect values?
|Page 1 of 1|
|Author:||EmrldDrgn [ Sun Jan 10, 2010 4:23 pm ]|
|Post subject:||BPB giving incorrect values?|
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?
|Author:||bewing [ Mon Jan 11, 2010 7:21 pm ]|
|Post subject:||Re: BPB giving incorrect values?|
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
|Page 1 of 1||All times are UTC - 6 hours|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group