Re: bootloader-bios interaction

From: Tauno Voipio (tauno.voipio_at_iki.fi.NOSPAM.invalid)
Date: 11/21/04


Date: Sun, 21 Nov 2004 21:11:51 GMT

Uday Mullangi wrote:
> Hi,
>
> I am looking for the boot sequence for Linux OS (Intel P4 processor)
> In particular, where the BIOS finisies the POST and jumps to the predefined
> location where the bootloader code is executed. I believe while the BIOS is
> running the processor is configured in real mode. So when the bootloader
> code is executing, will the processor switch to protected mode?( i am not
> sure). If the processor runs the bootloader in real mode then it can see
> only 1MB of RAM. In this case if the linux image is greater than 1MB how can
> it uncompress the image?
> Could anyone give me some pointers about this execution ??
>

If you have a kernel up to 2.4.x with sources, look at the directory
/usr/src/linux/arch/i386/boot/. These kernels are able to self-boot
if they are copied at the start of a diskette. The file first executed
is bootsect.S.

The standard loaders (LILO, GRUB) do their own loading, and
they are much more complicated than the simple self-loader.

The whole kernel is read into the memory by the boot loader,
and it has to use the BIOS disk drivers, as there are no
other disk drivers in the system yet.

The code continues from bootsect.S to setup.S which changes
the CPU to protected mode and continues to startup32() function
in /usr/src/linux/arch/i386/boot/compressed/head.S. The function
calls the function decompress_kernel() in misc.c in the same
directory. A LILO or GRUB -loaded kernel is also started
from startup32().

The decompressed kernel starts at startup32() in
/usr/src/linux/arch/i386/kernel/head.S. It sets up the rest
of the 32 bit runtime environment and calls the start_kernel()
function in /usr/src/linux/init/main.c

HTH

-- 
Tauno Voipio
tauno voipio (at) iki fi


Relevant Pages

  • Re: kernel upgrade
    ... help me understand the relation of kernel to the bootloader. ... this is done by the BIOS, which loads the boot loader. ... All this is done by the bootloader; but before executing ...
    (comp.os.linux.embedded)
  • Boot-up Questions-I.
    ... Which BIOS callis used to get the compressed image from the ... Bootloader code starts from 0x7c00. ... There is something called kernel ... 7.Before the uncompressed image starts executed, ...
    (comp.os.linux.development.system)
  • Re: BIOS and basic hardware drivers
    ... I gather that BIOS holds a series of device ... These should either be compiled directly into the kernel, ... GRUB bootloader starts running. ... Next, protected mode is initialized, and only then are the actual kernel ...
    (comp.os.linux.hardware)
  • q? bootloader
    ... that mean?(This is in context of the bootloader while copying the kernel ... Does this mean that it uses the interrupt service setup by the BIOS? ...
    (comp.os.linux.development.system)
  • Re: [PATCHv4 5/6] Allow setting O_NONBLOCK flag for new sockets
    ... here (executing an interpreted thread of execution in kernel space). ... the cost of just the single indirect - and unpredictable - call. ...
    (Linux-Kernel)