Page 1 of 1

master boot record

Posted: Thu Apr 03, 2008 11:30 am
by Gavin
Hi i've been reading alot about the master boot record and i'm a few days away from programing my own.

I'm a litte confussed because all the papers i find don't show anything about the partition table and how it's created .
Do i just use some sort of struct or what?
Thanks alot.

Posted: Thu Apr 03, 2008 11:39 am
by jzgriffin
Partition tables are 16-bytes in size for each entry. Here is a good guide that I've used in the past, first hit on Google for "partition table":

http://ata-atapi.com/hiwtab.htm

Posted: Thu Apr 03, 2008 11:55 am
by Gavin
Hi Jeremiah.

I've read that a few weeks ago but what i'm trying to say is how do i incorporate that into my actual code.
Do i just put it at a certain offset say in my nasm code say 446 ?

Posted: Thu Apr 03, 2008 12:50 pm
by devel
Partition table in c language can be simply represented by 64bytes static structure:

Code: Select all

__attribute__((aligned(1))) static unsigned char partTbl[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
As you wrote the offset shall be 446 bytes.