Page 3 of 3

Re: My first bootsector

Posted: Sat Nov 12, 2011 11:41 pm
by CelestialMechanic
Solar wrote:
maurolarrat wrote:if i have a new FS structure developed...
Generic advice: Be sure you can walk safely before you try to run.
If I may amplify this a bit:

Be sure you can walk safely before you try to run. Especially with a pair of scissors. :wink:

Re: My first bootsector

Posted: Sun Nov 13, 2011 5:11 am
by Combuster
Yes, if you have a new filesystem format (which is still considered a bad idea), then you will need the generic information stored in some defined location so you can always get at it without guesswork. That either means that you need to store the relevant information somewhere in the boot record. If you want your filesystem to be more friendly towards existing OSes, you also need partitioning. Some BIOSes also depend on a BPB when booting from USB, so you'll probably want that in your MBR as well.

Everything on BPBs, FATs and partitioning is otherwise well defined so if you have actual trouble understanding those documents we actually have a problem to deal with. Otherwise, it has to be laziness which we can not solve for you.

Re: My first bootsector

Posted: Sun Nov 13, 2011 6:15 am
by turdus
Combuster wrote:Some BIOSes also depend on a BPB when booting from USB, so you'll probably want that in your MBR as well.
In more than 20 years of using PC's I've never saw MBR with BPB. Also my fs does not need it, and I never experienced booting problem without it. VBR might need it, but VBR is not loaded or parsed by BIOS in any way (although you'll will need information from BPB to call some BIOS function properly).

Re: My first bootsector

Posted: Sun Nov 13, 2011 6:32 am
by Combuster
turdus wrote:In more than 20 years of using PC's I've never saw MBR with BPB.
Which means you have not seen a (typical) floppy in twenty years?

Re: My first bootsector

Posted: Sun Nov 13, 2011 8:29 am
by turdus
Combuster wrote:Which means you have not seen a (typical) floppy in twenty years?
Floppy does not have partitions therefore no MBR.

Re: My first bootsector

Posted: Sun Nov 13, 2011 1:29 pm
by turdus
berkus wrote:Floppies by definition have only MBR (because there are no partitions).
You are wrong about that, Master Boot Record is the one that has partitioning table. Even this site's wiki say so: http://wiki.osdev.org/MBR, as well as http://en.wikipedia.org/wiki/Master_boot_record and, nevertheless the author is clear about this, for example: http://support.microsoft.com/kb/69013
What is the MBR?
At the end of the ROM BIOS bootstrap routine, the BIOS reads and executes the first physical sector of the first floppy or hard disk on the system. This first sector of the hard disk is called the master boot record.
As you can see, only hard disk, not floppies. Floppies have only Volume Boot Record, just like every partition on disk, that _MAY_ contain BPB. BIOS just reads and executes the first physical sector, it does not parse BPB at all, because it's part of the FAT filesystem, not the disk or floppy.
berkus wrote:Edit: and according to wikipedia the BPB makes sense only for a few select elite filesystems anyway.
the page you linked is also clear about it's VBR that may contain BPB, not MBR, and it's also says that BPB is part of the filesystem.

Re: My first bootsector

Posted: Sun Nov 13, 2011 3:50 pm
by turdus
berkus wrote:Just trying to fit both BPB and MBR into one single sector looks like quite a stress to me :) 150 bytes wasted.
Agreed :-)

Re: My first bootsector

Posted: Fri Nov 18, 2011 6:07 am
by maurolarrat
Done.

The problem was the stuff i was using to develop, not the code.
I am using now DD for windows (i am using windows 7 64bits, partcopy does not work) , to write the code in my usb disk.
I changed the AS to NASM for simplicity.
I am using QEMU to generating the .IMG file for emulating the system (work in 7 64 bits too).

it worked fine, and i printed some data from the BPT to get sure the bits were in their right place... :)

I took all the information about NTFS and FATs file systems in www.ntfs.com and turned my FAT12 to NTFS. It is easy when we understand the concepts after reading some "1000 pages books".

thanks for helping. :mrgreen: