LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   Path of root file system (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/path-of-root-file-system-925647/)

Mayurapriyan 01-25-2012 09:55 AM

Path of root file system
 
Hi,
In the process of booting up of linux system,my understanding is root file system is loaded on the top of kernel.Is this understanding correct? If so, how kernel knows where the root file system is? Can we change the path where it takes the root file system from?

Any help will be appreciated.

thanks and regards
nishanth

catkin 01-25-2012 10:20 AM

The root file system is not loaded on top of the kernel, it is mounted by the kernel according to the entry for / in /etc/fstab

TobiSGD 01-25-2012 10:36 AM

Quote:

Originally Posted by catkin (Post 4584153)
The root file system is not loaded on top of the kernel, it is mounted by the kernel according to the entry for / in /etc/fstab

Not quite right, if I understand it right. The kernel is not mounting the / partition. The bootloader gives the root= option to the kernel, which determines the partition where the kernel is looking for init. Then init takes over and, after loading the necessary kernel modules if needed, does the mounting stuff.

catkin 01-25-2012 11:24 AM

Thanks for the correction TobiSGD :)

More specifically init reads /etc/inittab which directs it to run boot scripts. The first boot script runs mount which uses /etc/fstab to determine what to mount at /

AFAIK (not sure) the kernel root option tells the kernel where to find the file system containing the files it needs during boot including /etc/inittab, the mount command and /etc/fstab. Normally the same as define in /etc/fstab but may not need to be?

TobiSGD 01-25-2012 03:02 PM

Quote:

Originally Posted by catkin (Post 4584208)
AFAIK (not sure) the kernel root option tells the kernel where to find the file system containing the files it needs during boot including /etc/inittab, the mount command and /etc/fstab. Normally the same as define in /etc/fstab but may not need to be?

No. The kernel will run no other program than init at boot time. The root= option has two purposes:
1. Tell the kernel were to find init (in fact it seeks on several places in the specified filesystem for init or initrc). This is not needed when using an initrd.
2. Tell init which is the root partition. Without that info init wouldn't either be able to find /etc/inittab nor to mount the partitions specified in /etc/fstab, since it wouldn't find those files. This is at least needed when using an initrd, I am not sure if it is needed when running without it.

SInce you are running Slackware, just have a look at the init-script in /boot/init-tree after making a initrd for your generic kernel. This will give you a basic idea what actually happens before the / partition and all others are mounted and the init-script invokes the "real" init from the harddisk to do the stuff like starting services, etc.

catkin 01-26-2012 07:23 AM

Thanks TobiSGD :)

I should have been more explicit and written "the kernel root option tells the kernel's init process where to find ...", yes?


All times are GMT -5. The time now is 09:28 PM.