Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
This is my understanding. The stage1 code simply (always) jumps out - whether to stage 1.5 or 2 it neither knows nor cares. It is simply a sector number that the install procedure writes into the stage1 code as it's written into the MBR or (partition) boot sector.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.