Sourcer wrote:
And my question to you guys is, where does the job of the bootloader end? Does it only load the kernel into memory and transfer control to it?
Does it turn on protected mode, paging, and then transfer control to the kernel?
What does your boot loader do?
My boot loader is the operating system.
Boot sector, second stage boot loader, third stage boot loader and forth stage operating system is one contiguous assembled (
FASMg),
compiled (GCC) and linked named file which resides in the root directory of the bootable device file system.
The first 512 bytes of this file (the boot sector) and the following second stage boot loader (4096) bytes are additionally part of the
bootable image and contained within the 24 sector exFAT boot sector region or FAT32 reserved sectors (the two file systems I currently
support). The PC (or MBR loaded by the PC) loads the boot sector which loads the second stage boot loader which loads the third stage
boot loader from the named file in the root directory.
The entire file is not loaded. The beginning clusters which do not contain the third stage are skipped, the next cluster is buffer loaded
and the bytes up to the the third stage are skipped and the remaining are transferred immediately following the second stage in
memory. The remaining clusters are loaded in place up to the end of the third stage. Because the operating system is also a boot
loader, the forth stage will be loaded (the same way) only if required. No fixups or relocations are required and of course the second
stage has a rudimentary file system driver capable of loading the LFN file from the root directory.
The other benefit of this single file operating system is that the same file can be used in the
formatting of other (exFAT or FAT32)
bootable devices as the same identical file is used for both file systems. Of course this not not preclude the operating system from
loading additional auxiliary files as usual.
A further benefit is that the forth stage shares the file system driver code in the second stage and does not need to include the same code.
I fully realize that this constitutes OSDev heresy.
I would however, be completely remiss if I also didn't mention here that
the earth is not flat.