LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   In linux boot process what is the role of stage1, stage1.5's file and stage 2 (http://www.linuxquestions.org/questions/linux-hardware-18/in-linux-boot-process-what-is-the-role-of-stage1-stage1-5s-file-and-stage-2-a-816467/)

maheshp86 06-26-2010 03:11 AM

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

smoker 06-26-2010 05:34 AM

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.

saikee 06-26-2010 06:37 AM

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.

maheshp86 06-26-2010 11:21 AM

still confused.
 
Quote:

Originally Posted by saikee (Post 4015514)
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

saikee 06-26-2010 12:11 PM

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.

pr_deltoid 06-26-2010 09:40 PM

http://www.ibm.com/developerworks/li...-bootload.html has information about LILO and GRUB.

mashemat 06-30-2010 05:08 PM

Hi you can read this article i think it can help u :-)
http://www.ibm.com/developerworks/li...y/l-linuxboot/

Techsystemquery 07-13-2012 09:47 AM

Recently I have gone thru Linux boot process blog may be it helps.

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


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