LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-28-2007, 05:55 AM   #1
dsksatish
LQ Newbie
 
Registered: Dec 2007
Posts: 3

Rep: Reputation: 0
Doubt in Booting Sequence.


Hello friends,
I am a new member to this group and new to Linux also...
Just starting to digest the concepts and i got stuck .......The Problem ...............BOOT SEQUENCE!!!!!!!!

Let me first tell you in short what i understood.. so that u may point out if there's anything wrong in it.

First the computer initiates post and after that the bios passes control to the very first sector of the hard disk. This area on the hard disk also known as the MBR contains the IPL(Initial Program Loader). Passing control to the IPL by the BIOS is the first Stage. The IPL then loads the grub.conf file to the memory. This grub.conf file resides in /boot/grub/grub.conf .

QUESTION 1: If the IPL cannot understand the filesystem how can it understand /boot.....? It shouldn't unless the filesystem is loaded.

Then the grub.conf file loads in memory.
Then grub decides the location of a splash image(hd0,0-which means first partition in first harddrive) and loads it along with the menu
. The Menu helps us to choose the OS or Kernel or whatever. Here again there is a line of code ---- root(hd0,0).

QUESTION 2: What is the use of the line root(hd0,0)?

I couldn't understand what happens after that. I just know that the kernel and the initrd loads into memory and the init process takes over. I understood what happens after init process takes over.

So Can anyone please explain the process which takes place after the line stating root and before initrd?????
 
Old 12-28-2007, 08:31 AM   #2
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
Grub can't read a filing system

If Grub cannot read a filing system, like NTFS, then Grub boots that system by chainloading. In chainloading Grub boots up the boot loader of another operating system. It does so at the "+1" position of the 2nd sector of the partition. Booting with a sector is done at a hardware level.

Grub can use chainloading to boot an operating system that

(1) has a filing system Grub cannot understand (like Win2k, Xp, Vista, BSD)

or

(2) has no kernel inside (like a Dos)


What most Linux users do not realise is chainloading can be used equally well on fellow Linux and is good enough to boot any operating system that has been invented on a PC.

What is root (hd0,0)?


MS systems, Solaris and the majority of BSD systems has a MBR that boots any of the 4 primary partitions as long as it has the booting flag switched on. A booting flag is the first byte in the 16-byte partition table of a primary partition. When it is marked "bootable" in Linux it is the same or interpreted as "active" in a MS system.

Fundamentally the MBR of a MS Dos/Windows does not know which primary partition it will boot and cannot boot a system residing in logical partition. Thus a user can put Grub in a data-only primary partition, instructs a Vista or XP to make the data-only partition active and get a MS system to boot up Grub.

Linux boot loaders Grub and Lilo broke this rule by "declaring" which partition to be booted up front.

Grub does this by the command "root" and Lilo does this by command "other=" or "root=". Thus that explains why Linux can be booted even from a logical partition. Grub calls a disk and partition by number and counts from 0.

1st disk is (hd0) and its 1st partition is (hd0,0).

Grub and Lilo never use the booting flag.

A little bit about the kernel and initrd statements


Grub has stage1 and stage2. (there is a stage1.5 too but that can be regarded as a special case). The stage1 is 512 byte long to fit in with any MBR. The stage1's duty is to load stage2 which is the intelligence of Grub.

Grub operates flawless with just stage1 and stage2.

When the stage2 is loaded Grub will try to find menu.lst (symbolic-linked with grub.conf) in either /grub or /boot/grub directory specified in the root directory. If none is found Grub defaults to a Grub prompt. If one is loaded then the user is left to pick a system from the choices displayable in menu.lst.

When a Linux is asked to be booted the "kernel" statement instructs Grub the location of the kernel and the manner it is to be loaded. The "initrd" does the same for the ramdisk file. If the kernel and the ramdisk files are loadable then Grub finishes its tasks and will disappear from the scene.

Thereafter it is the Linux kernel's job to load the Linux.

Last edited by saikee; 12-28-2007 at 08:48 AM.
 
Old 12-29-2007, 05:34 AM   #3
dsksatish
LQ Newbie
 
Registered: Dec 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for ur answers friends,, but i still have some confusions.
I have a red hat distribution and the grub.conf has the following lines...

root (hd0,0)
kernel /vmlinuz-2.6.18-8.1.1.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-8.1.1.el5.img

As far as i have understood the first line root(hd0,0) says that the kernel is in the first partition of the first drive..So it is being loaded into memory.
The next line loads the kernel which is in (hd0,0)/vmlinuz, but i could not understand what is the purpose of
ro root=LABEL=/ in the same line
 
Old 12-29-2007, 07:00 AM   #4
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
This is a typical Red Hat Linux booting instruction.

The information inside the "kernel" statement is always in Linux and not in Grub notation because by such time the kernel would have take over. The kernel and the root filing system ("/") are stored in separate location in a Red Hat Linux. The latter can be in an ordinary partition like /dev/sda3 or in a LVM partition. It is Red Hat tradition to identify this partition by a label.

Red Hat typical stores the /boot separately so that the rest can be all inside a LVM. The former is the address of required by the "root" statement in Grub while the latter is the address for the root filing system. If a Red Hat Linux has multi partitions then the root is always referred to the partition holding "/".

There is nothing to stop /boot as a subdirectory of / and a Red Hat can run happily in a single partition. Thus my Red Hat family distros typically boot by

Code:
title Fedora 7 in 10th partition od 2nd disk sdb10
root (hd1,9)
kernel /vmlinuz-2.6.18-8.1.1.el5 ro root=/dev/sdb10 rhgb quiet
initrd /initrd-2.6.18-8.1.1.el5.img
There are several method the "root=" can be pointed to. Among them are

(1) by-path
(2) by-label
(3) by-id
(4) by-uuid

I have no by-label in my Ubuntu box and the above information is all contained in the /dev directory
Code:
root@saikee-desktop:/home/saikee# ls -l /dev/disk
total 0
drwxr-xr-x 2 root root 120 2007-12-29 14:25 by-id
drwxr-xr-x 2 root root 140 2007-12-29 14:25 by-path
drwxr-xr-x 2 root root  80 2007-12-29 14:25 by-uuid
root@saikee-desktop:/home/saikee# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root  9 2007-12-29 14:25 ata-Maxtor_6L300R0_L609G99H -> ../../hda
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 ata-Maxtor_6L300R0_L609G99H-part1 -> ../../hda1
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 ata-Maxtor_6L300R0_L609G99H-part5 -> ../../hda5
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 ata-Maxtor_6L300R0_L609G99H-part6 -> ../../hda6
root@saikee-desktop:/home/saikee# ls -l /dev/disk/by-path
total 0
lrwxrwxrwx 1 root root  9 2007-12-29 14:25 pci-0000:00:09.0-ide-0:0 -> ../../hda
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 pci-0000:00:09.0-ide-0:0-part1 -> ../../hda1
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 pci-0000:00:09.0-ide-0:0-part5 -> ../../hda5
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 pci-0000:00:09.0-ide-0:0-part6 -> ../../hda6
lrwxrwxrwx 1 root root  9 2007-12-29 14:25 pci-0000:00:09.0-ide-1:0 -> ../../hdc
root@saikee-desktop:/home/saikee# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 67299b86-bdc6-4c90-a463-1ff2c8af9a5a -> ../../hda6
lrwxrwxrwx 1 root root 10 2007-12-29 14:25 fcaf92d3-825d-4bfa-8d80-0282ff9a9d66 -> ../../hda5
root@saikee-desktop:/home/saikee#
You can see the same /dev/hda5 can be called different names in different methods, all applicable in Linux. Ubuntu starts using by-uuid method and OpenSuse homes in the by-id method. Red Hat always sticks with the by-label method.

Last edited by saikee; 12-29-2007 at 09:34 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Booting Sequence Help. ranjeet_badhe Linux - Newbie 8 05-25-2006 10:50 PM
Booting Sequence Nilesh.Shah Linux - Newbie 2 05-30-2005 03:51 AM
Change booting sequence u4u Linux - General 1 12-13-2004 06:20 AM
Help to remove script from booting sequence sasha_baranov Linux - Newbie 1 11-18-2004 10:34 AM
DOUBT .- jordomi Linux - Distributions 2 08-23-2000 07:53 AM


All times are GMT -5. The time now is 06:43 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration