LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 06-26-2010, 03:11 AM   #1
maheshp86
LQ Newbie
 
Registered: Jun 2010
Location: mumbai
Posts: 22

Rep: Reputation: 0
In linux boot process what is the role of stage1, stage1.5's file and stage 2


Hi ,
i have a doubt in linux boot process

in my PC RHEL5 has installed,




in bootig GRUB will load in 3 steps

stage 1--> stage1.5 --->stage2

stage1
=======
1st stage1 of grub is located in the 412 bytes of MBR)

also there is a file
/boot/grub/stage1 ( then what is this???)

stage1.5
=========( where does stage1.5 file located ? i found certain files in /boot/grub/)
like

e2fs_stage1_5

fat_stage1_5

ffs_stage1_5

iso9660_stage1_5

jfs_stage1_5

minix_stage1_5

reiserfs_stage1_5

ufs2_stage1_5

( i think these all are needed for accessing appropriate filesystems in stage 2 )

stage 2

===========


i found there is a file
/boot/grub/stage2





but my qusetn is




is GRUB loads from among these files??



if it is so, i removed the above mentioned files from /boot/grub still system is booting!!!!!!!!!!!!!!!!!!


how it is???


then how stage1.5 and stage2 take place??


pls give reply

i really wish to know the detailed linux boot process
pls help me
 
Old 06-26-2010, 05:34 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
Read man grub and then info grub. Move the cursor down to * Images and hit return. You may have to page up a bit to read it all.
 
Old 06-26-2010, 06:37 AM   #3
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Grub1 only needs stage1 and stage2 in normal operations.


Stage1 is exactly 512 bytes large to be placed in the MBR to be read by the Bios. Once set up the stage1 will be modified to include the hard disk address of stage2 which can be place in any partition that Grub1 supports, like Fat16, Fat32, Ext2/3/4.

Any user wanting to install Grub1 on its own can select any partition Grub1 recognises, make a directory /boot/grub and place stage1 and stage2 there. Grub1 can be set up then by "root" pointing to the partition and "setup" command pointing to the booting destination. Both root and setup command can be issued from either a Grub shell (inside Linux) or Grub prompt (before an OS is booted). Grub1 can be set up inside Linux by command "grub-install" too.

If Grub1 is set up with only stage1 and stage2 it boots to a Grub prompt. If a menu.lst is available inside /boot/grub directory it will be automatically executed in lieu of offering the Grub prompt.

All boot loaders have two stages but Grub1 actaully calls them stage1 and stage2. The stage1.5 is only used for special situations with certain filing systems. MS Windows have similar using "fixmbr and "fixboot", either on their own or as parameters with a separate command like "bootrec.exe" depending on whether it is a win2k/Xp or Vista/Win7.

In place of stage1 and stage2 Grub2 has boot.img and core.img respectively. Grub2 can only be set up inside a Linux with "grub-install".

The actual working of Grub1 is Bios reads stage1 and places it in the memory. Stage1 is then in control and loads stage2 which is the actual intelliegence of Grub1. menu.lst will then be sought from /grub, /boot/grub. If none is found Grub1 defaults to a Grub prompt.

Technically there is no installed operating system in a PC that cannot be booted up in a Grub prompt "manually"! This is because Grub can load another boot loader using the "chianloader" command and hands the control to it.

The booting process in a pc is in fact laughingly simple. Most users simply are not interested in knowing it. That is all.

Last edited by saikee; 06-26-2010 at 06:47 AM.
 
Old 06-26-2010, 11:21 AM   #4
maheshp86
LQ Newbie
 
Registered: Jun 2010
Location: mumbai
Posts: 22

Original Poster
Rep: Reputation: 0
still confused.

Quote:
Originally Posted by saikee View Post
Grub1 only needs stage1 and stage2 in normal operations.


Stage1 is exactly 512 bytes large to be placed in the MBR to be read by the Bios. Once set up the stage1 will be modified to include the hard disk address of stage2 which can be place in any partition that Grub1 supports, like Fat16, Fat32, Ext2/3/4.

Any user wanting to install Grub1 on its own can select any partition Grub1 recognises, make a directory /boot/grub and place stage1 and stage2 there. Grub1 can be set up then by "root" pointing to the partition and "setup" command pointing to the booting destination. Both root and setup command can be issued from either a Grub shell (inside Linux) or Grub prompt (before an OS is booted). Grub1 can be set up inside Linux by command "grub-install" too.

If Grub1 is set up with only stage1 and stage2 it boots to a Grub prompt. If a menu.lst is available inside /boot/grub directory it will be automatically executed in lieu of offering the Grub prompt.

All boot loaders have two stages but Grub1 actaully calls them stage1 and stage2. The stage1.5 is only used for special situations with certain filing systems. MS Windows have similar using "fixmbr and "fixboot", either on their own or as parameters with a separate command like "bootrec.exe" depending on whether it is a win2k/Xp or Vista/Win7.

In place of stage1 and stage2 Grub2 has boot.img and core.img respectively. Grub2 can only be set up inside a Linux with "grub-install".

The actual working of Grub1 is Bios reads stage1 and places it in the memory. Stage1 is then in control and loads stage2 which is the actual intelliegence of Grub1. menu.lst will then be sought from /grub, /boot/grub. If none is found Grub1 defaults to a Grub prompt.

Technically there is no installed operating system in a PC that cannot be booted up in a Grub prompt "manually"! This is because Grub can load another boot loader using the "chianloader" command and hands the control to it.

The booting process in a pc is in fact laughingly simple. Most users simply are not interested in knowing it. That is all.

hi

thanks for your advice
but i am still confused.
ie my system is still booting without any related image files of
stage1 , stage1.5 and stage2 in /boot/grub directory,(i deleted those files from here).
how grub load without this image files??

pls advice
 
Old 06-26-2010, 12:11 PM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Very simple.

As I said the stage2 has been hard-coded into stage1. So stage1 simply go the hard disk and load whatever there. Grub will continue to work until you overwrite the area currently occupied by stage2. Stage2 can be stored in a removed partition or deleted. When you delete a file you only remove its entry in the filing index. The actual file is never deleted but its area will be make empty and ready to be overwritten by other data.

Take a look at this thread when I reported the same thing.

Last edited by saikee; 06-26-2010 at 12:13 PM.
 
Old 06-26-2010, 09:40 PM   #6
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41
http://www.ibm.com/developerworks/li...-bootload.html has information about LILO and GRUB.
 
Old 06-30-2010, 05:08 PM   #7
mashemat
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Rep: Reputation: 0
Hi you can read this article i think it can help u :-)
http://www.ibm.com/developerworks/li...y/l-linuxboot/
 
Old 07-13-2012, 09:47 AM   #8
Techsystemquery
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Rep: Reputation: 0
Recently I have gone thru Linux boot process blog may be it helps.

http://www.expertslogin.com/linux-ad...nux-in-detail/
 
  


Reply

Tags
boot


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
grub Error 6:Mismatched o corrupt version of stage1/stage 2 pgb205 Red Hat 1 07-15-2009 03:35 PM
GRUB error 15 on stage1.5. Trying to dual boot Arch and WinXP Kao Linux - Newbie 11 07-11-2009 08:16 PM
gentoo : grub: The file /boot/boot/grub/stage1 not read correctly Boudewijn Linux - Software 3 05-21-2008 04:13 AM
The file /boot/grub/stage1 not read correctly. snowsquirrel Linux - General 6 02-27-2006 08:18 AM
grub Error 6:Mismatched o corrupt version of stage1/stage 2 mikmok Linux - General 2 03-02-2004 12:52 PM


All times are GMT -5. The time now is 06:52 AM.

Main Menu
Advertisement
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