Re: linux bootup

From: Tauno Voipio (tauno.voipio_at_iki.INVALID.fi)
Date: 12/07/04


Date: Tue, 07 Dec 2004 15:16:30 GMT

Kasper Dupont wrote:
> Uday Mullangi wrote:
>
>>Hi,
>>Could anyone answer few questions on bootup sequence of linux that i have.
>>

I guess that you mean on IBM PC-style hardware (Linux runs on many
other platforms, the boot on a Sparcstation or S/390 is vastly
different).

>>1.What is the typical size of a bootloader?
>
>
> There is no such thing as a typical size, it vary a lot.
> AFAIR syslinux is about 5KB. Grub is a litle more than
> 100KB.
>
>
>>Since the booloader code starts
>>from 0x7c00 and can touch till 0x9A000,
>
>
> I'm not sure what you think about here. The boot record
> on a PC is loaded on 0x7c00 and is 512 bytes long. (At
> least as long as you are booting from floppy or harddisk).

What happens after that is dependent only on the code
from the coot record. There is a limitation that the code
must run on real mode, so this limits it to 16 bit code.
This is due to the BIOS design handling only real-mode calls,
and the BIOS disk drivers have to be used, as there are no other
disk drivers in the system until the kernel is in and started.

>>Can i assume that the max size of
>>the bootloader could be 0x9a000-0x7c00=0x92400[ 585kb ].
>
>
> Who knows? Because of crappy hardware design, it is nice
> to keep the loader within that limit. How much would you
> want to put in a loader? When the Linux development was
> started you would have been considered insane if you
> wanted to use 100KB for your loader. Today people really
> like grub in spite of that size, and personally I think
> it have almost every feature I could ever want in a loader.
>
>
>>What if the
>>bootloader exceeds this size?
>
>
> If you want a loader larger than that, you will have to do
> something else. And if the loader try to use some memory
> that just isn't there, it will not work.

The loader could have its own disk drivers and boot up as a
kernel. Then the only limitation is that the booted-up target kernel
must fit in together with all the bootloader memory usage. The
current kernel start-up assumes that there is the BIOS available
and the entry is done in 16 bit real mode, so if your loader gets
over the one-megabyte boundary, it must be able to come back to
real mode.

>>2.Will the bootloader use the magic number of the(0xAA55) of the kernel
>>header? If so, when?
>
>
> Dunno. I believe that magic number originally existed
> because the first sector of a kernel image was in fact a
> loader (a primitve one).
>

0xaa55 is a signature needed by the BIOS boot to accept
the initial boot record.

>>3. Is the BIOS setting the IVT for loading linux standardised? (I asked the
>>because some vector numbers are used by the bootloader BIOS calls). If so,
>>where can i get the details?
>
>
> The loader will need to use some of these to access disk,
> keyboard, serial port, and screen. (Not all loaders need
> all of them). But Linux itself does not need them (except
> from stuff like VESA and ACPI).
>

One good source (1100+ pages) is:

Frank van Gilluwe, The Undocumented PC, Addison-Wesley,
ISBN 0-201-47950-8

-- 
Tauno Voipio
tauno voipio (at) iki fi


Relevant Pages

  • Re: usb keyboard dying at loader prompt
    ... All of USB is out of kernel and is loaded via modules. ... BIOS has "Legacy USB" enabled. ... It also works in loader menu. ...
    (freebsd-hackers)
  • Re: usb keyboard dying at loader prompt
    ... All of USB is out of kernel and is loaded via modules. ... BIOS has "Legacy USB" enabled. ... It also works in loader menu. ...
    (freebsd-stable)
  • Re: openSUSE 11: Bootloader wird deinstalliert
    ... Ich habe auf einem System neben Vista openSUSE 11 installiert - die ... Installation lief reibungslos bis zum ersten Neustart. ... nicht Linux startete. ... Es kam eine Fehlermeldung in der Art "Boot Loader Error ...
    (de.comp.os.unix.linux.misc)
  • Re: My SUSE Linux-XP problem--a clue?
    ... > Linux machine, ... What loader did you install and where did you install it? ... > Linux boot loader. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: My SUSE Linux-XP problem--a clue?
    ... > Linux machine, ... What loader did you install and where did you install it? ... > Linux boot loader. ...
    (comp.os.linux.setup)