Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My question is about the overall Linux boot process.
I understood that the initramdisk loaded at boot time, contains modules essential to access the physical location of the kernel (modules to support IDE, SCSI, SATA,...).
So, I don't understand now how a kernel compiled without any modules can boot ?
How the bootloader access the hard-drive to find the kernel ?
I understood that the initramdisk loaded at boot time, contains modules essential to access the physical location of the kernel (modules to support IDE, SCSI, SATA,...).
Close. The initrd needs to include the required driver(s) to (pre-)mount the root - the kernel is loaded into storage by the bootloader. If you compile your own kernel and include the necessary drivers no initrd is needed.
So, I don't understand now how a kernel compiled without any modules can boot ?
That is putting it incorrectly. You mean a kernel without an initrd, not without modules - having a kernel without either is impossible. Either you leave out certain key modules, in which case they have to be included into the initrd, or you compile them straight into the kernel, in which case an initrd is not required.
So, I don't understand now how a kernel compiled without any modules can boot ?
Kernel without initrd can easily boot, but only if all required modules are compiled into kernel. Usually "required modules" means filesystem modules, few modules that are required by filesystem, and maybe few modules that might be required to access your hardware. If some modules won't be compiled in, then kernel might not be able to mount root partition. Personally, I prefer to use kernel without initrd, unless using initrd is absolutely necessary.
Quote:
Originally Posted by PlatinumX
How the bootloader access the hard-drive to find the kernel ?
I'd suggest to read info about how boot loader works, or take a look at lilo/grub source. It probably won't be easy reading, though.
Think of it this way, the kernel can be compiled in various ways. You can have one compiled with everything built-in, or one compiled with almost everything as modules, and something in-between. Not all modules are needed at boot time. The most important ones usually include SATA or AHCI drivers, filesystem drivers, and other drivers critical to the boot process that have to do with accessing the HDD and a few other things. If you have all critical drivers built-in, then there is no need for initrd. The rest of the modules are simply loaded later in the boot process.
The typical catch 22 here is that if you built the filesystem or IDE/SATA/AHCI drivers as modules and have no initrd the kernel will panic. Why ? Because it does not have the required modules to be able to access the HDD, and most unfortunately these are located on the HDD ... yes a catch 22.
The bootloader doesn't have too much to do with this. All it really does is load the kernel into RAM and pass control over to it. Read the wiki for more details: http://en.wikipedia.org/wiki/Bootloader
True but irrelevant - mounting is not required for accessing data. Makes it more convenient though.
The loader needs to be aware of filesystem structure so it can navigate the inode chain properly to assemble the kernel. Most filesystems are supported, but new filesystems/features can fail - for example the recent change to ext3 inode size for ext4 compatability. Unpatched versions of grub (at least - I don't know about lilo) failed to load kernels from newly allocated ext3 partitions with the larger inode size.
True but irrelevant - mounting is not required for accessing data
This is the information I missed: the bootlaoder is able to read the kernel (which is a file) without mounting the filesystem itself. (which is the role of the kernel).
Not irrelevant, because this means that bootloader uses other mechanisms to access required files.
Quote:
Originally Posted by syg00
Unpatched versions of grub (at least - I don't know about lilo)
I already gave link to lilo documentation where it is explained how lilo works. Looks like it doesn't understand filesystems at all and simply uses disk offsets (or something similar).
It's true that lilo uses disk offset to access the drive, so this is why it's recommended to use an ext2 /boot partition, because with journaled filesystems the disk offset for the kernel may actually change and lilo will no longer find it. GRUB on the other hand seems to have different stages for each filesystem, for example look inside '/boot/grub' if you have it installed...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.