On Thu, Jan 16, 2003 at 04:56:48PM +1100, Stalker, Doug wrote:
> I still have one question:  if the initial RamDisk image is on a SCSI disk,
> and if the SCSI drivers are in the initial ramdisk, how does it get loaded
> in the first place?  I assume it's some sort of lilo trick, since adding
> initrd=/foo.img to the boot parameters doesn't work but adding
> initrd=/foo.img to lilo.conf and running lilo does.  Does lilo copy the
> initial ramdisk to the bootsector or some such?

It has to do with the BIOS interupts that lilo is able to use to load
files from the hard disk. (Otherwise how would you ever load any
operating system, SCSI disks or not)

In the normal boot situation, lilo loads the kernel from disk into memory, 
using the bios interupt stuff and then 
boots it, telling it where the root disk is located. If the kernel does
not have support to mount the root disk, then the boot fails.

In the initrd situation, lilo loads both the kernel AND the initrd into
memory. It then boots the kernel, telling the kernel there is an initrd
image and where it should find it in memory. The kernel mounts this file
as an initial temporary root filesystem, and executes linuxrc which is inside
the initrd along with copies of required modules. This should load all the 
modules your kernel requires to mount the real root filesystem.

linuxrc must first mount the /proc filesystem, and then write the real
location of the root filesystem to /proc/sys/kernel/real-root-dev 

As soon as linuxrc exits, the kernel mounts the real root filesystem, and the
kernel attempts to remount the initrd to /initrd

On my system linuxrc is a shell script and can be examined after booting
by "cat /initrd/linuxrc", but I believe on some systems it is statically
compile to try and reduce size.

-Colin
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to