[plug] initrd confusion!
Russell Steicke
r.steicke at bom.gov.au
Fri Apr 16 11:46:08 WST 2004
On Fri, Apr 16, 2004 at 11:28:12AM +0800, Denis Brown wrote:
> Dear PLUG list members,
>
> I have a situation where I need to have a modularised kernel, specifically
> with the RAID device as a module. The reason for this, is to allow the
> low level drive monitoring software to work. I have been reading up on
> initrd but find that I am confused, as follows...
>
> 0. There are no IDE or ATA devices in this box, only SCSI in hardware RAID.
> 1. The RAID driver will be compiled into the kernel as a module. So the
> kernel will not be able to see any file systems until the module is loaded.
> 2. The module will be inaccessible to the kernel because, well, it cannot
> be loaded!
> 3. Initrd would seem to offer help. Initrd basically, if I understand it
> correctly, will load a kernel into ramdisk, load the required RAID driver
> module and then switch over to the "real" file system.
Sort of. My understanding is this:
- lilo or grub loads the kernel into memory, then loads the initrd into
memory as a ramdisk.
- control passes to the kernel, with the ramdisk as the root filesystem.
- The kernel can insmod modules from the ramdisk. Your raid and scsi
drivers must be present in the ramdisk. This is the key point, that
the modules can be loaded _out of RAM_, before the disk is available.
- Shortly after, the real root filesystem (off your raid) is mounted on
a temporary mount point, then pivot_root is called to "rotate" the
mount points so that your real root filesystem ends up at /. See
pivot_root(8) and pivot_root(2).
You should be able to have a peek inside the initrd with something like
this:
mount -t cramfs -o ro,loop /boot/initrd.img-2.4.24 /mnt/tmp
Then have a look at /mnt/tmp/sbin/init, where the latter parts of this
magic are written down for us.
--
Russell Steicke
-- Fortune says:
Dear Lord:
I just want *one* one-armed manager so I never have to hear "On
the other hand", again.
More information about the plug
mailing list