How does the IPL know to load Stage1_5?
Iíve been searching high & low, but cannot find a definitive answer as to how GRUB Stage_1 (IPL of MBR) knows how to load Stage1_5.
Iíve read the GNU Grub manual and various other forums but since I donít know C, I canít reverse engineer or figure out the source code to determine whether Stage1_5 is loaded or not.
I understand that, as part of the OS install procedure, GRUB writes Stage_1 (as the IPL) into the MBR, and that this then calls either Stage1_5 or Stage_2, depending on whether Stage1_5 is installed.
I also believe that Stage1_5 is usually installed into the sectors following the MBR into the so-called DOS compatibility region (the next 62 sectors within the first cylinder before the first partition).
However, assuming Stage1_5 is installed, is there a routine within Stage_1 that checks to see if Stage1_5 is installed and if so jumps & runs to it?
Or, if Stage1_5 is not installed would the same routine then jump to & run Stage_2?
Or, does the GRUB installer intelligently install specific Stage_1 code dependent upon whether Stage1_5 was installed or not? i.e. If the GRUB installer was able to load Stage1_5 then the Stage_1 code it installs would have the routine to jump to & run Stage1_5. Or, if the GRUB installer did not install Stage1_5, it would install different Stage_1 code to jump to & run Stage_2
I appreciate this may be moot, what with GRUB 2 but Iíd like to have a better understanding of this process.
TIA Ė Derrick
The GRUB installer writes the jump instruction in the stage 1 code, directing the CPU where to pick up the next set of instructions. The installer keeps track of if stage 1_5 is installed, and writes the jump instruction to point to it if it is installed. If stage1_5 is mot installed, the installer sets the jump instruction to point to the first instruction in stage_2. If anything changes (e.g.: a GRUB update) that may relocate or eliminate stage 1_5, or relocate stage _2, the boot loader in the MBR is rewritten with a new jump instruction.
I had a feeling that might be the case, but needed positive confirmation instead of my (hopefully) 'educated guesses'!
Thanks guys :)
|All times are GMT -5. The time now is 02:53 PM.|