Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a multi-boot system with potentially one bootloader installed per OS installed how does the bios know which bootloader to pass control to? How is it specified which bootloader is the active one?

Let us take multiple linux installations for example. I guess you could specify a new and unique partition (or hard disks) for /boot to be mounted on for each linux os you decide to install. This will leave one bootloader per OS I assume.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

In an IBM/DOS compatible pc, the BIOS reads whatever is at the first sector of the hard drive (Boot Sector) and this is copied to memory.

There can only be one Boot Sector per drive and this is what controls which boot loader get's loaded.

Once a boot loader is loaded, it is just executable code - a bootloader can load other boot loaders from other areas of the drive.

In your example, you would install grub (boot loader) somewhere on the drive - this would have a configuration script that would have a list of different operating systems you can boot to (or other bootloaders you can pass on to - such as the Windows boot loader). A small instruction is written to the boot sector that will tell the machine the location of grub and to load it straight after the machine boots up.

share|improve this answer
    
Okay, so all harddisk drives have a boot sector. Which ever harddisk is specified as 'first boot' in the BIOS gets it's boot sector code copied to memory where it is executed. The code in this boot sector to be executed then determines which bootloader to point to (so that it' can be copied to memory and take over). So it basically comes down to which bootloader is the last scumbag to write it's own position to the bootsector? –  Wuhtzu Dec 14 '12 at 14:55
    
Yep, that's basically it. –  David Schwartz Dec 14 '12 at 15:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.