file format

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
slacker

file format

Post by slacker »

can a kernel be compiled into any file format and run correctly? like an exe?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:file format

Post by Pype.Clicker »

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 ...
Tim

Re:file format

Post by Tim »

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.
slacker

Re:file format

Post by slacker »

anybody have a doc on exe file formats?
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:file format

Post by Neo »

Only Human
Post Reply