Click to See Complete Forum and Search --> : Kernel compilation & initrm


ddaas
09-12-2007, 06:12 AM
Hi,
I have a question regarding initrd. As I know initrd is a RAM Disk that includes modules the system needs in the early stage of booting (ex: sata).

My question is: how can the the system get this file which resides on the root partition (or boot partition) which is not mounted? (it doesn't have the modules it needs to mount the partition).

Further, how can the system get the binary compressed image of the kernel (vmlinuz) if the partition is not YET mounted?


Thanks for your clarification.

saikee
09-12-2007, 06:58 AM
It is always the Linux boot loader's job to load the kernel (vmlinuz) and the initrd files.

Both Lilo and Grub have the commands to do exactly that.

A Linux boot loader actually goes into the specified partition to pick out the specified files, loads them into the memory, completes the handover of the control and disappears.

I think Lilo hard coded the address of the files but Grub can actually read the normal Linux filing systems. One can certainly at boot time to tell Grub to select kernel from Linux A to boot another Linux B.

ddaas
09-12-2007, 10:43 AM
Thank you for your answer. A lot of things are clearer for me now.

As I understand the boot loader can read from the hdd if there is a linux partition (ext2,ext3,reiserfs etc). Right?

But what if a very low level functionality like serial ata is compiled as module and included in initrd which is a file? How can the grub read from a hdd for which no one has drivers (at that moment)?

SATA is just an example, it could be something else. What happen then?

saikee
09-12-2007, 12:30 PM
If a Sata is connected and the mobo supports it then the Bios must know it. Grub works on the information from the Bios.

I believe from the kerenel 2.6 onward Linux officially supports the Sata disks so if Grub loads the kernel and initrd then the Sata will be read correctly accordingly.

A simple demonstration is if the USB legacy support is not enabled in the Bios then a USB hard disk will not be recognised by Grub and loading 10 times more drivers into a initrd would help because Grub could not find the USB hard disk.

Once the USB legacy support is enabled then Grub can find the USB disk immediately (by "geometry hd0" command) and the kernel can boot from it.