LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
Search this Thread
Old 12-31-2009, 03:11 AM   #1
derrickr
LQ Newbie
 
Registered: Dec 2006
Location: Shoreditch, London
Distribution: Debian
Posts: 2

Rep: Reputation: 0
Question 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
 
Old 12-31-2009, 04:11 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,309

Rep: Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032Reputation: 1032
Quote:
Originally Posted by derrickr View Post
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.
 
Old 12-31-2009, 07:57 AM   #3
ernie
Senior Member
 
Registered: Nov 2001
Location: Toledo, Ohio - USA
Distribution: Mageia 1
Posts: 1,079
Blog Entries: 4

Rep: Reputation: 70
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.

HTH,
 
Old 12-31-2009, 08:11 AM   #4
derrickr
LQ Newbie
 
Registered: Dec 2006
Location: Shoreditch, London
Distribution: Debian
Posts: 2

Original Poster
Rep: Reputation: 0
Understood.

I had a feeling that might be the case, but needed positive confirmation instead of my (hopefully) 'educated guesses'!

Thanks guys
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gotta love iPL forums SkcesttuB5000 General 2 04-08-2006 08:47 AM
Websites load slow, but once they load, any links inside them load fast smurcoch Mandriva 3 02-06-2006 12:47 AM
GRUB -> *stage1_5 files --- Which to copy? suma17 Linux From Scratch 4 10-23-2005 08:23 AM
gedit window launches at IPL. Why?? kphume Linux - Software 0 10-18-2004 09:55 AM
Linux on Zseries ,IPL/loading problem ramki Linux - Software 1 11-18-2003 11:42 PM


All times are GMT -5. The time now is 07:11 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration