file format
file format
can a kernel be compiled into any file format and run correctly? like an exe?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:file format
use whatever format you wish, provided that your bootloader supports it ...
historically, bootloaders have been small piece of code with limited resource, and kernel need not to be relocated (as you may decide the location at compile-time) nor linked to anything else, so there's a trend for flat binary format ...
now that we have GRUB, it's easier to support various formats, but afaik, neither EXE-MZ nor EXE-PE have a bootloader that support them ...
historically, bootloaders have been small piece of code with limited resource, and kernel need not to be relocated (as you may decide the location at compile-time) nor linked to anything else, so there's a trend for flat binary format ...
now that we have GRUB, it's easier to support various formats, but afaik, neither EXE-MZ nor EXE-PE have a bootloader that support them ...
Re:file format
GRUB can boot any format if you use the a.out kludge described in the GRUB docs. However, it's not clever enough to understand relocations. If you use it to load an MZ EXE, you'll need to do relocations yourself. If you use it to load a PE EXE, you'll need to either set the base address to a valid physical address, or set up paging soon to map the base virtual address to the actual physical address.