My first bootsector

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
CelestialMechanic
Member
Member
Posts: 52
Joined: Mon Oct 11, 2010 11:37 pm
Location: Milwaukee, Wisconsin

Re: My first bootsector

Post 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:
Microsoft is over if you want it.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: My first bootsector

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: My first bootsector

Post 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).
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: My first bootsector

Post 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?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: My first bootsector

Post by turdus »

Combuster wrote:Which means you have not seen a (typical) floppy in twenty years?
Floppy does not have partitions therefore no MBR.
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: My first bootsector

Post 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.
User avatar
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: My first bootsector

Post 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 :-)
maurolarrat
Posts: 8
Joined: Tue Nov 08, 2011 4:51 am

Re: My first bootsector

Post 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:
Post Reply