Re: Linux and Initrd used to access disk : how does it work ?

From: Richard B. Johnson
Date: Tue May 24 2005 - 10:38:10 EST


On Tue, 24 May 2005, Paul Rolland wrote:

Hello Dick,

initrd means Initial RAM disk.

The boot image is put onto your Hard disk. The hard disk needs
to be accessible from the BIOS to boot from it. Most controllers
have a BIOS module that lets it be accessed during boot so you
don't need a chicken before the egg to start the boot.

Ok, basically, the trick is that the BIOS knows how to access the
disk, and Linux doesn't because it doesnt use the BIOS ? Or is it
some more subtle (though I doubt) thing in which only a part of the
disk can be accessed by the BIOS.


Linux needs to load a driver before it can access the disk. The
BIOS only works for 16-bit real-mode access.

Then, when booting, LILO or grub starts linux which uncompresses
a RAM disk and mounts it instead of your hard disk. A special
version of `init` (called nash) gets started which reads a script
called linuxrc. It contains commands like:
Yes, I've seen that in my .img file...

The module(s) are in the /lib directory of the RAM disk.
They are put there by a build-script that installs initrd.
This script gets executed when you do 'make install' in
the kernel directory. If you have private modules, you
can copy them to the appropriate /lib/modules/`uname
-r`/kernel/drivers
directory. You put the module(s) name(s) you need to boot
in /etc/modprobe.conf or /etc/modules.conf (depends upon the
module tools version) as:

alias scsi_hostadapter aic7xxx
alias scsi_hostadapter1 ata_piix

... any scsi_hostadapter stuff will be put into initrd when
you execute the script, /sbin/mkinitrd.


Hmmm... I didn't know this part, thanks for the details.

So, it seems that I'm stuck with my binary module unless I can find a
way to tell the kernel to use the BIOS to access the disk ;-)))


No. You are "stuck with a driver" just like everybody else. You
either have drivers built-in (getting rare, because there are so
many), or you load a driver while booting. This is the usual
way. From the boot perspective, it doesn't matter if the module
is a 'binary' one or a GPL one.

Cheers,
Paul



Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/