[lug] boot loader mystery

karl horlen horlenkarl at yahoo.com
Mon Jan 29 12:07:36 MST 2007


I've been reading up on bootloaders (scoured the net)
and I believe I've got a pretty solid understanding of
them.

However, there is something that I still don't get and
would be mighty glad if someone could clarify it for
me.  Because not understanding my question means I
really don't understand boot loaders ;-).  Here goes.

I understand why you sometimes need to make an initrd.
The reason being that sometimes the kernel needs a
driver that is a module and not compiled into the
kernel in order to access or use some device and
consquently boot.  In my case, a scsi driver module. 

What I don't understand is the chicken and egg
scenario my scsi (or any hd controller) module
presents.  In order for the kernel to boot, it has to
be able to access the disk and mount the partitions
right?  So if the kernel requires a scsi driver to
access the disk, why doesn't the bios itself require
that same scsi driver to access the MBR/disk and then
why doesn't the stage1 bootloader require that same
scsi driver to access /boot partition to find the
kernel and initrd files to boot in the first place?

This has always puzzled me.  

It's like the bios is smart enough to give
instructions to the scsi controller to find the things
it needs but the kernel isn't smart enough to do the
same thing to find a module on the disk so that it
requires a ramdisk.  But if the kernel requires a
ramdisk that lives on the disk to get the driver
module to access the disk, how can it ever access the
ramdisk?

And it doesn't matter whether the controller/drives
are IDE/SATA/SCSI based, the bios is always smart
enough to find that MBR. Yet a kernel is always going
to need a specific driver depending on the hardware
installed.

I've walked through the scenario many times and I
still don't quite get it.

My thought is that the bios must know how to read
physical locations on a disk.  Which is why it can
find what it needs.  That makes sense.  However, it
still has to talk to what is one of a hundred
different unique controllers installed in every
individual box that lives out there.  

Which brings me back to the catch-22 I described
earlier.  The bios can't know every new instruction
set for every controller that comes out.  So how does
it ask the controller to even get the MBR?  And if the
bios can do it, why can't the kernel access the disk
the same way to find its "boot" modules without
requiring a separate ramdisk.  Couldn't the required
"boot" modules just be placed in certain known sectors
(begin plus offset) on the disk.  Then the kernel
would be able to find it using the same physical
location mechanism the bios does?

Thanks to all who can provide some clarity about this.




 
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited



More information about the LUG mailing list