Re: Linux boot question
- From: Dan Mills <dmills@xxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 21 Jan 2007 15:59:38 +0000
On Sun, 21 Jan 2007 06:55:33 -0800, dspfun wrote:
Question:
How come the bioses always are able to read the hard drives? I.e. load
the MBR (first stage boot loader) and the second stage boot loader from
the hard drive.
Because the bios is written to support the particular disk controller that
is fitted to that particular motherboard.
How can the bios have support for (be able to read/write) the hard drive
controller and the hard drive file system?
The bios knows nothing of filesystems, boot sector into ram, then run it,
that is a simplified model of what the bios does. This all happens in real
mode (X86), the first stage bootloader then uses a set of bios calls to
cause the real mode bios to load a few other sectors whose locations have
been patched into the first sector (Still no file system as such), which
the first stage loader then runs. This second stage loader then does some
magic,loads the kernel and its ramdisk and then calls the kernel entry
point.
The kernel then does some setting up, switches to protected mode, then
relocates itself, loads modules from the ramdisk, then calls pivot_root to
mount the real root device on /. Finally, init is called and the boot
scripts take the system the rest of the way.
The bios mus have
support for reading the hard drive since the bios loads the MBR from the
hard drive to ram, as well as the second stage boot loader from the hard
drive to ram. What is the problem for the linux kernel to have the same
support that the bios software has?
A 16 bit real mode bios is not a lot of use to a 32/64 bit kernel. It
cannot address all the memory, and so cannot load things where they need
to go, hence why the kernel relocates itself early in the proceedings.
Why is a ramdisk containing appropriate drivers for the hard drive
needed for the linux kernel?
Wouldn't it be possible for the linux kernel to use the services
provided by the bios to access the hard drive?
Possible? Sure. Worth it? Not a chance.
I guess the answer is that all computers have custom made bioses for
specific hard drive controllers residing on that motherboard and the
bios only supports common file systems.
The bios does not support any filesystems! That is purely an operating
system issue.
Regards, Dan.
.
- References:
- Linux boot question
- From: dspfun
- Linux boot question
- Prev by Date: Re: Generate m4 dependencies
- Next by Date: Re: Linux boot question
- Previous by thread: Linux boot question
- Next by thread: Re: Linux boot question
- Index(es):
Relevant Pages
|