i've been messing with grub version 0.97 and trying to figure some things out. I've gotten to the point where i have things working, but i don't know why exactly.
some background info here, and what i'm doing is with Novell SLES 11.3:
http://www.linuxquestions.org/questi...lp-4175500045/
so now i'm looking to understand what the first 446 bytes in the MBR pertain to. if you look at my attached pic in the link above, SLES gives you a yast bootloader window with options to boot from the boot partition, extended partition, MBR, or root partition. What gets selected by default and that i am using is "boot from root partition".
That said, i have two hard disks of different make and size. Both are formatted /dev/sda1 as swap 1gb in size then /dev/sda2 remainder of disk as ext3. I have SLES 11.3 on each and both boot fine and work in 2 different systems like there was no difference.
if i compare the /boot/grub/stage1 file from each disk in a hex editor, they are identical. they both are 512 bytes in size, starting with "EB 48 90 00 00..." and then about 3/4 way to the end the hex data reads in ascii "GRUB .Geom.Hard.Disk.Read. Error." but both these disks boot fine and i don't really care about the stored error message in there, except maybe they are at different locations in each file.
if i disk dump using 'dd if=/dev/sda of=mbr bs=512 count=1' for both hard disks and compare these 2 mbr files the first 446 bytes of the boot code are different.
I was reading online and started to get the impression that the stage1 file might get copied into the MBR, but that is not at all the case here. I also have 'boot from root partition' selected in my boot loader settings. If I had told grub to 'boot from MBR' would that actually copy part of the stage1 file to the MBR? And if it does what parts because the MBR is 446 bytes in size but stage1 is 512 in size.
I also have the options in my sles yast bootloader window which are not shown in my pic it's under 'Boot Loader Options' button, to 'Write generic boot code to MBR' along with 'Set Active Flag in Partition Table'.
I sort of proved the active flag setting does not happen if i choose that, but that's a separate issue which i manually do with a hex editor.
But does anyone know what this generic boot code would be and how it works?
At very least i'm looking to understand the chain of events in lamens terms.
so far i know the bios of the pc begins to read the MBR of the selected boot drive. I understand the 64 bytes of the MSDOS partition table and the ending 55AA value and the 80 value in the partition table that's flagging the partition to be the bootable partition- i assume this is how grub knows how to boot from root partition or from boot partition.
But for the first 446 bytes in the mbr i'm clueless all i've read is, it's executable code? And i cannot even see any similarity between the stage1 file and the mbr of the disk, although i have not specifically tried telling grub to 'boot from master boot record' then compare stage1 and the mbr.
I also ask all this because (as explained in linked thread above) i am trying to clone disks and everything works except this bootloader, which i believe is bugged by Novell. And i can boot the install dvd and do a repair bootloader but that's not even straightforward anymore and is now bugged in SLES 11.3, it alters the menu.lst file which i then have to manually edit afterwards to tell it 'kernel vmlinuz' and 'root=/dev/sda2'. and this repair bootloader also reports errors saying cannot install boot loader because of partition table. but if i select various options i eventually get it to work... and so far i've tracked it down to i somehow manage to get grub to install something correct in that 446 bytes of the MBR.
if you've made it this far, thanks for reading and for any help or understanding you can provide.