What is the difference between primary and secondary bootloader? Does primary and secondary refer to the two parts of the bootloader or two stages of the bootloader? I am confused.
-
Where did you find the use of such terminology? "Primary/secondary" could also connote significance/importance, which doesn't make sense in relation to bootloaders. It's really about the ordering, and first/second/third stage (or level) is a better description IMO.– sawdustCommented Mar 24, 2014 at 0:13
2 Answers
You're confused because it is an over-simplistic way of describing the process. If you've been reading the same IBM article as mentioned in primary and secondary boot loaders, which is one place where people seem to have drawn this primary/secondary notion from, note that it takes a rather narrow, Linux-only, view of the world (as it clearly states in its first sentence), that it was written in 2005, and that it is actually making a distinction between the same boot loader program (GRUB) installed in two different places on a hard disc (the MBR-virus area and a disc partition) rather than between two different boot loader programs, one "primary" and one "secondary".
In reality, bootstrapping most operating systems for PC Compatible and workstation class machines (per the tag on the question) is a series of loader programs, each one loading the next. A primary/secondary distinction erroneously implies that there are only two programs, or (as in Thayne's answer) erroneously implies that only two out of the several programs in the sequence have special status as "primary" and "secondary", or erroneously implies that PCs nowadays necessarily even use boot loader programs in MBRs and VBRs at all.
Three very brief examples of such chains with more than just two programs:
- The loader program in an old-style PC98/PC-AT machine's firmware loads the loader program in the Master Boot Record which loads the loader program in the Volume Boot Record which loads the Basic Input/Output System part of PC-DOS/DR-DOS from the
IBMBIO.COM
file which loads the Basic Disc Operating System part of PC-DOS/DR-DOS from theIBMDOS.COM
file. - The loader program in an old-style PC98/PC-AT machine's firmware loads the loader program in the Master Boot Record which loads the loader program in the Volume Boot Record which loads the
OS2BOOT
loader program which loads theOS2LDR
loader program which loads theOS2KRNL
program. - The EFI Boot Manager program in a new-style EFI machine's firmware loads the
bootmgfw.efi
program which loads thewinload.exe
program which loads thentoskrnl.exe
program.
There's no good case for designating any of these as more "primary" than the others. Indeed, there's no good case for designating the loader programs built into the machine firmware as "primary". If one looks at TianoCore in detail, for one example, one finds that there's even a series of boot loading stages that occur within the firmware and that there's even a concept known as the Firmware File System. (Those both go well beyond the scope of this answer, though, as does the boot process of IBM MicroChannel Architecture machines, which loaded stuff from DASD before even the MBR boot loader program.)
The fact that GRUB 1 rather famously had a "stage 1.5" should tell one by itself, even ignoring the fact that there's obviously another loader program that loads GRUB "stage 1" in the first place, that the idea that bootstrap sequences in the PC Compatible world are just two stages long, and bootstrap programs neatly divide into "primary" and "secondary", doesn't match reality.
Further reading
- Jonathan de Boyne Pollard (2011). The different kinds of bootstrap programs. Frequently Given Answers.
- Jonathan de Boyne Pollard (1996). The DOS-Windows boot process. Frequently Given Answers.
- Jonathan de Boyne Pollard (2011). The PC/AT boot process. Frequently Given Answers.
- Jonathan de Boyne Pollard (2006). The EFI boot process. Frequently Given Answers.
- Jonathan de Boyne Pollard (2006). The ARC boot process. Frequently Given Answers.
- Jonathan de Boyne Pollard (2006). The Windows NT 6 boot process. Frequently Given Answers.
The primary bootloader is the bootloader that is on the MBR. The secondary bootloader is on one of the partitions and is started by the primary bootloader.
For example in a dual boot Linux and windows system, grub would be the primary bootloader and would load a secondary windows bootloader if windows was selected.
-
1So what do you call the bootstrap program than reads this "primary (?) bootloader ... on the MBR" from disk into main memory?– sawdustCommented Mar 24, 2014 at 0:08
-
@sawdust BIOS. en.wikipedia.org/wiki/Master_boot_record
The BIOS reads the MBR from the storage device into physical memory, and then it directs the microprocessor to the start of the boot code
Commented Apr 7, 2014 at 12:27