Robert P. J. Day wrote:
On Sun, 21 Oct 2007, William Case wrote:
Hi;
As a result of the ongoing GRUB discussion, I have been trying to
trace the use of GRUB from BIOS to the end of GRUB stage 2. I am
particularly interested in seeing how the MBR is used.
all the MBR does is:
1) provide up to 446 bytes of initial boot code (446 bytes)
Not quite, the first two bytes are a relative jmp around a volume label
and some more (disk parameter block comes to mind) information of
varying length - and so the jmp +afew.
2) define the four entries of the partition table (4 @ 16 bytes)
The standard (DOS) boot code examines these, looking for one marked
active. Having found one, it reads the first sector and executes it.
IBM's PC Techical Reference describes the process and, I think, has the
code.
More recently I've seen code from Apple's Darwin to do this. Apple's
code loops if it can't find an active partition:-)
3) have a boot block signature of x'55aa' at the end (final 2 bytes)
if you add that up, you get 512.
I can create a temporary copy of my MBR using:
# dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1
yup, so far, so good.
My question is; what program should I use to read this file in a human
meaningful way (hexdump??)?
debug in MSDOS is pretty good, it can disassemble the code.
--
Cheers
John
-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxx Z1aaaaaaa@xxxxxxxxxxxxxxxx
Please do not reply off-list