Bootloader: Difference between revisions

[unchecked revision][unchecked revision]
(Useful link section added)
Line 1:
A bootloader is a program written to load a more complex [[Kernels|kernel]]. Implementation details are gathered in [[Rolling Your Own Bootloader]]
 
== What does a bootloaderboot loader do ==
The bootloaderboot loader ultimately has to:
* Bring the kernel (and all the kernel needs to bootstrap) in memory
* Provide the kernel with the information it needs to work correctly
Line 8:
* Transfer control to the kernel
 
On the x86, the bootloaderboot loader runs in [[Real Mode]]. Consequently it has easy access to BIOS resources and functions. Therefore it's a good place to perform memory map detection, detecting available video modes, loading additionnaladditional files etc. The bootloaderboot loader will collect this information and present it in a way the kernel will be able to understand
 
=== Loading your kernel ===
 
 
The bits of your kernel are somewhere on some disk (presumably the booting disk, but this is not mandatory). Question is: where on the disk ? Is it a regular file on a [[FAT|FAT-formatted]] floppy ? is it a collection of consecutive sectors in the "reserved area" of the FAT12 floppy (in which case you may need a dedicated tool to format the disk and install the kernel on it) ? Or is the floppy simply left unformatted and kernel pasted directly with a disk image tool
 
All the above options are possible. Maybe the one iI'd choose myself would be to reserve enough space on a FAT12 floppy to store the list of sectors used by the kernel file. The "advantage" of being fully-FAT12 is that you don't need to re-write the bootsector everytimeevery time you rewrite the kernel.
 
What needs to be loaded mainly depends on what's in your kernel. Linux, for instance, requires an additionnaladditional 'initrd' file that will contain the 'initialization process' (as user level). If your kernel is modular and if Filesystems are understood by some modules, you need to load the modules along with the kernel. Same goes for 'microkernel services' like disk/files/memory services, etc.
 
=== Giving the kernel its information ===
Anonymous user