Pramod (pramodp) wrote,

My Bootloader - Here's how it was done...

The bootloader is a small program that resides in the first 512 bytes of the partition containing the kernel of the OS and boots it. So, if we get hold of these 512 bytes, we can invoke the OS of our choice. GRUB provides us the option of installing it in the MBR or in the first 512 bytes of the active partition. On the contrary, Windoze bootloader, the ntldr can place itself only in the MBR. That's how it was designed, but clever engineers in the open-source community have made a work-around for this stigma, in GRUB and other clones.

First I had 2 Windoze installations. The ntldr worked fine. It was installed in the MBR. My challenge was to invoke the GRUB using ntldr. A rather simple task after I accomplished it! Just copy the first 512 bytes of the linux partition into a file, and then reference this file in boot.ini (the bible and the koran and what not, of the ntldr). It now thinks this reference is a windoze installation itself, when it reads the entry in the file. But the "file" is actually the loader for the GRUB. Now the big question is how to get hold of the first 512 bytes. Simple. use 'dd' command! It's too simple to use.

Messed up bootloader? Simple. First decide which one to be placed on the MBR. If it's GRUB, then simply run grub-install with the partition/ide- specific device identifier. eg. grub-install '(hd0)' installs grub onto the MBR. hd0 is the first HD, on the primary IDE. Suppose i need to restore ntldr to MBR. Simple. Run a recovery console from an XP installation disc and use the FIXMBR command. it "fixes" the windoze.

Cool, right? But very risky too. One wrong move, and your entire HDD will be wiped clean!
Tags: bootloader, debian, linux, mbr, technology, ubuntu, windows
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment